diff --git a/app/web/app.js b/app/web/app.js index 0dbf06b..c575b65 100644 --- a/app/web/app.js +++ b/app/web/app.js @@ -630,6 +630,7 @@ function runTurn(path, onopen) { ws.onmessage = (event) => { if (typeof event.data !== "string") { + if (ws._aborted) return; // nach Barge-in: in-flight-Chunks verwerfen, nicht mehr abspielen pcm.push(event.data); // immer cachen (Replay je Bubble) if (expectChunk) { // satzweiser Chunk -> sofort lueckenlos abspielen expectChunk = false; @@ -792,7 +793,7 @@ micBtn.addEventListener("click", () => { unlockTTS(); // iOS: Geräte-TTS bei der Nutzergeste freischalten if (busy) { // Barge-in: laufende KI-Antwort sofort unterbrechen - if (activeWs) activeWs.send(JSON.stringify({ type: "interrupt" })); + if (activeWs) { activeWs._aborted = true; activeWs.send(JSON.stringify({ type: "interrupt" })); } stopAudio(); statusEl.textContent = "Unterbrochen"; // busy + Button-Reset erfolgen sobald die WS schliesst (-> runTurn resolve -> sendVoice/sendText)