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()