feat: add DECTalk voice selector to webui dashboard
This commit is contained in:
+3
-1
@@ -416,8 +416,10 @@ def api_tts_generate():
|
|||||||
|
|
||||||
if mode == "dectalk":
|
if mode == "dectalk":
|
||||||
try:
|
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")
|
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()
|
r.raise_for_status()
|
||||||
job_id = str(uuid.uuid4())
|
job_id = str(uuid.uuid4())
|
||||||
out_path = tempfile.mktemp(suffix=".wav")
|
out_path = tempfile.mktemp(suffix=".wav")
|
||||||
|
|||||||
@@ -243,6 +243,25 @@ function populateVoiceSelect(mode, restoreVoice) {
|
|||||||
});
|
});
|
||||||
const target = restoreVoice || settings.user_voice || '';
|
const target = restoreVoice || settings.user_voice || '';
|
||||||
if (target) sel.value = target;
|
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 = '<option value="">— Paul (default) —</option>';
|
||||||
|
dectalkVoices.forEach(v => {
|
||||||
|
const opt = document.createElement('option');
|
||||||
|
opt.value = v.id; opt.textContent = v.name;
|
||||||
|
sel.appendChild(opt);
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
group.style.display = 'none';
|
group.style.display = 'none';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user