From cc9de661cc75ce1da43b63c0fcd43d21f8a59536 Mon Sep 17 00:00:00 2001 From: Cosmo Date: Tue, 14 Apr 2026 15:02:00 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20barge-in=20support=20=E2=80=94=20stop?= =?UTF-8?q?=20TTS=20when=20wake=20word=20detected=20during=20playback?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- satellite/modes.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/satellite/modes.py b/satellite/modes.py index e901a57..d8e1cc1 100644 --- a/satellite/modes.py +++ b/satellite/modes.py @@ -3,7 +3,7 @@ import sys from .config import GATEWAY_URL, AGENT, log from .audio import record -from .tts import speak, stop_speaking +from .tts import speak, stop_speaking, is_speaking from .llm import ask_agent_stream, is_reset_command WAKE_THRESHOLD = float(os.getenv("WAKE_THRESHOLD", "0.5")) @@ -89,6 +89,12 @@ def run_with_porcupine(): print(f"PREDICTION cosmo: {cosmo_score:.3f}") if cosmo_score > WAKE_THRESHOLD: + if is_speaking(): + # Barge-in: прерываем TTS + print("✋ Barge-in: прерываю ответ") + stop_speaking() + cosmo_model.reset() + continue stream.stop_stream() _conversation_loop("cosmo", "Cosmo") cosmo_model.reset()