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
settings.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();
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 = '<option value="">No TTS backend available</option>';
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);
})();