Merge branch 'main' of https://git.digital-home.site/daniil/home-voice-assistant
This commit is contained in:
@@ -3,7 +3,7 @@ import sys
|
||||
|
||||
from .config import GATEWAY_URL, AGENT, AGENTS, 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, VOICE_SESSION_KEY
|
||||
|
||||
WAKE_THRESHOLD = float(os.getenv("WAKE_THRESHOLD", "0.5"))
|
||||
@@ -110,6 +110,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()
|
||||
|
||||
Reference in New Issue
Block a user