feat(web): Stimmen-Umschalter (piper/chatterbox/cloud) in der UI

Dropdown im Menue setzt tts_provider als Request-Override fuer Text- und Sprach-Turns
-> live umschaltbar zwischen schnellem piper, hochwertigem chatterbox und Cloud.
Asset-Version v5.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Dieter Schlüter 2026-06-18 09:49:25 +02:00
commit b7c59d8c85
3 changed files with 20 additions and 4 deletions

View file

@ -7,6 +7,13 @@ const statusEl = $("#status");
const promptEl = $("#prompt");
const formEl = $("#prompt-form");
const micBtn = $("#mic");
const ttsSel = $("#tts");
// Gewählter TTS-Provider (leer = Default/piper) als Request-Override.
function overrides() {
const t = ttsSel && ttsSel.value;
return t ? { tts_provider: t } : {};
}
let busy = false;
// Session-ID pro Nutzer (sonst "gehoert einem anderen Nutzer"-Konflikt). Wird aus
@ -169,7 +176,7 @@ async function sendText(text) {
addMessage("user", text);
statusEl.textContent = "denkt …";
await runTurn("/ws/chat", (ws) => {
ws.send(JSON.stringify({ text, stream: true, audio_stream: true }));
ws.send(JSON.stringify({ text, stream: true, audio_stream: true, ...overrides() }));
});
busy = false;
}
@ -219,7 +226,7 @@ async function sendVoice(bytes) {
await ensureSession();
statusEl.textContent = "verarbeite Sprache …";
await runTurn("/ws/voice", (ws) => {
ws.send(JSON.stringify({ type: "start", format: "webm", stream: true, audio_stream: true }));
ws.send(JSON.stringify({ type: "start", format: "webm", stream: true, audio_stream: true, ...overrides() }));
ws.send(bytes);
ws.send(JSON.stringify({ type: "end" }));
});