From e48d77d55c16b3ace0affa3b1cd6d47f04ee1b78 Mon Sep 17 00:00:00 2001 From: Kingston-SCYD Date: Tue, 9 Jun 2026 11:09:38 -0500 Subject: [PATCH] feat: add DECTalk voice selector to webui dashboard --- ttstoy/webui/app.py | 4 +++- ttstoy/webui/templates/dashboard.html | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/ttstoy/webui/app.py b/ttstoy/webui/app.py index 974a507..6bdb040 100644 --- a/ttstoy/webui/app.py +++ b/ttstoy/webui/app.py @@ -416,8 +416,10 @@ def api_tts_generate(): if mode == "dectalk": try: + voice = data.get("voice") or "" + dectalk_text = f"{voice}{text}" if voice else text dectalk_url = gcfg.get("dectalk_api_url", "http://127.0.0.1:33001") - r = requests.get(f"{dectalk_url}/say", params={"text": text}, timeout=30) + r = requests.get(f"{dectalk_url}/say", params={"text": dectalk_text}, timeout=30) r.raise_for_status() job_id = str(uuid.uuid4()) out_path = tempfile.mktemp(suffix=".wav") diff --git a/ttstoy/webui/templates/dashboard.html b/ttstoy/webui/templates/dashboard.html index 5a02c0f..a4e7bbd 100644 --- a/ttstoy/webui/templates/dashboard.html +++ b/ttstoy/webui/templates/dashboard.html @@ -243,6 +243,25 @@ function populateVoiceSelect(mode, restoreVoice) { }); const target = restoreVoice || settings.user_voice || ''; if (target) sel.value = target; + } else if (mode === 'dectalk') { + group.style.display = ''; + const dectalkVoices = [ + {id: '[:np]', name: 'Paul (default)'}, + {id: '[:nb]', name: 'Betty'}, + {id: '[:nh]', name: 'Harry'}, + {id: '[:nf]', name: 'Frank'}, + {id: '[:nd]', name: 'Dennis'}, + {id: '[:nk]', name: 'Kit'}, + {id: '[:nu]', name: 'Ursula'}, + {id: '[:nr]', name: 'Rita'}, + {id: '[:nw]', name: 'Wendy'}, + ]; + sel.innerHTML = ''; + dectalkVoices.forEach(v => { + const opt = document.createElement('option'); + opt.value = v.id; opt.textContent = v.name; + sel.appendChild(opt); + }); } else { group.style.display = 'none'; }