From 7bced9f126f523534383dac12edad30fc6b939dd Mon Sep 17 00:00:00 2001 From: mARTin-B78 Date: Thu, 28 May 2026 02:11:59 +0200 Subject: [PATCH] Fix conversation TTS dropdown showing 'No TTS backend available' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .gitignore | 3 +++ static/app.js | 14 +++++--------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index cfb05df..f85438f 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,6 @@ hidden_voices/ # Local settings and generated scratch data settings.json voice_design_presets.json + +# Personal documentation (not part of the public repo) +APP_ERKLÄRUNG.md diff --git a/static/app.js b/static/app.js index d23b0cb..66c8a6e 100644 --- a/static/app.js +++ b/static/app.js @@ -1952,6 +1952,8 @@ async function refreshTtsBackendAvailability(selected = '') { updateBackendHelp(); updateStyleBackendHelp(); updateBackendDependentTabs(); + // Call any post-refresh hooks registered by sub-sections (e.g. conversation panel) + (window._ttsRefreshHooks || []).forEach(fn => { try { fn(); } catch(_) {} }); return _ttsBackends; } @@ -8271,7 +8273,7 @@ $('s-import-voices-file')?.addEventListener('change', async function () { function populateConvTtsBackends() { if (!ttsBkSel) return; const prev = ttsBkSel.value; - const all = window._ttsBackends || []; + const all = _ttsBackends || []; if (!all.length) { ttsBkSel.innerHTML = ''; return; @@ -8592,12 +8594,6 @@ $('s-import-voices-file')?.addEventListener('change', async function () { populateConvTtsBackends(); // Keep TTS backend select in sync after global backend refresh - const origRefresh = window.refreshTtsBackendAvailability; - if (typeof origRefresh === 'function') { - window.refreshTtsBackendAvailability = async function(...args) { - const result = await origRefresh.apply(this, args); - populateConvTtsBackends(); - return result; - }; - } + window._ttsRefreshHooks = window._ttsRefreshHooks || []; + window._ttsRefreshHooks.push(populateConvTtsBackends); })();