Add russian translate
This commit is contained in:
@@ -6,6 +6,9 @@ from .audio import record
|
||||
from .tts import speak, stop_speaking
|
||||
from .llm import ask_agent_stream, is_reset_command
|
||||
|
||||
WAKE_THRESHOLD = float(os.getenv("WAKE_THRESHOLD", "0.5"))
|
||||
|
||||
|
||||
def _handle_reset(text: str, agent_id: str) -> bool:
|
||||
"""Команда сброса — на сервере OpenClaw сессия рулится session_key, клиент только сообщает."""
|
||||
if is_reset_command(text):
|
||||
@@ -17,8 +20,7 @@ def _handle_reset(text: str, agent_id: str) -> bool:
|
||||
|
||||
|
||||
def _conversation_loop(agent_id: str, agent_name: str = "Cosmo"):
|
||||
"""Основной цикл диалога — слушает и отвечает пока пользователь говорит.
|
||||
Выходит когда в течение MAX_DURATION не было речи."""
|
||||
"""Основной цикл диалога — слушает и отвечает пока пользователь говорит."""
|
||||
while True:
|
||||
text = record()
|
||||
if not text:
|
||||
@@ -32,8 +34,6 @@ def _conversation_loop(agent_id: str, agent_name: str = "Cosmo"):
|
||||
|
||||
response = ask_agent_stream(text, agent_id=agent_id)
|
||||
print(f"🤖 {agent_name}: {response}\n")
|
||||
# после ответа — следующая итерация с новым record()
|
||||
# record() сам гасит эхо через ECHO_WARMUP
|
||||
|
||||
|
||||
def run_with_enter():
|
||||
@@ -76,8 +76,6 @@ def run_with_porcupine():
|
||||
stream = audio.open(rate=16000, channels=1, format=pyaudio.paInt16,
|
||||
input=True, frames_per_buffer=1280)
|
||||
|
||||
print("✅ Слушаю через OpenWakeWord...")
|
||||
print("\nСкажи 'Космо'...\n")
|
||||
# print("\nСкажи 'Космо' или 'Люся'...\n") # TODO: после подключения Люси
|
||||
|
||||
try:
|
||||
@@ -90,8 +88,7 @@ def run_with_porcupine():
|
||||
if cosmo_score > 0.1:
|
||||
print(f"PREDICTION cosmo: {cosmo_score:.3f}")
|
||||
|
||||
if cosmo_score > 0.5:
|
||||
print("✅ Услышал 'Космо'!")
|
||||
if cosmo_score > WAKE_THRESHOLD:
|
||||
stream.stop_stream()
|
||||
_conversation_loop("cosmo", "Cosmo")
|
||||
cosmo_model.reset()
|
||||
|
||||
Reference in New Issue
Block a user