Fix conversation TTS dropdown showing 'No TTS backend available'

Two bugs: (1) populateConvTtsBackends() referenced window._ttsBackends
which doesn't exist — fixed to use module-scope _ttsBackends directly.
(2) Broken hook that wrapped window.refreshTtsBackendAvailability (never
set on window) — replaced with _ttsRefreshHooks array dispatched at end
of refreshTtsBackendAvailability().

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
mARTin-B78 2026-05-28 02:11:59 +02:00
parent 214f2c61cf
commit 7bced9f126
2 changed files with 8 additions and 9 deletions

3
.gitignore vendored
View File

@ -28,3 +28,6 @@ hidden_voices/
# Local settings and generated scratch data # Local settings and generated scratch data
settings.json settings.json
voice_design_presets.json voice_design_presets.json
# Personal documentation (not part of the public repo)
APP_ERKLÄRUNG.md

View File

@ -1952,6 +1952,8 @@ async function refreshTtsBackendAvailability(selected = '') {
updateBackendHelp(); updateBackendHelp();
updateStyleBackendHelp(); updateStyleBackendHelp();
updateBackendDependentTabs(); updateBackendDependentTabs();
// Call any post-refresh hooks registered by sub-sections (e.g. conversation panel)
(window._ttsRefreshHooks || []).forEach(fn => { try { fn(); } catch(_) {} });
return _ttsBackends; return _ttsBackends;
} }
@ -8271,7 +8273,7 @@ $('s-import-voices-file')?.addEventListener('change', async function () {
function populateConvTtsBackends() { function populateConvTtsBackends() {
if (!ttsBkSel) return; if (!ttsBkSel) return;
const prev = ttsBkSel.value; const prev = ttsBkSel.value;
const all = window._ttsBackends || []; const all = _ttsBackends || [];
if (!all.length) { if (!all.length) {
ttsBkSel.innerHTML = '<option value="">No TTS backend available</option>'; ttsBkSel.innerHTML = '<option value="">No TTS backend available</option>';
return; return;
@ -8592,12 +8594,6 @@ $('s-import-voices-file')?.addEventListener('change', async function () {
populateConvTtsBackends(); populateConvTtsBackends();
// Keep TTS backend select in sync after global backend refresh // Keep TTS backend select in sync after global backend refresh
const origRefresh = window.refreshTtsBackendAvailability; window._ttsRefreshHooks = window._ttsRefreshHooks || [];
if (typeof origRefresh === 'function') { window._ttsRefreshHooks.push(populateConvTtsBackends);
window.refreshTtsBackendAvailability = async function(...args) {
const result = await origRefresh.apply(this, args);
populateConvTtsBackends();
return result;
};
}
})(); })();