Add cities game to avoid rambling responses

This commit is contained in:
2026-02-02 23:40:36 +03:00
parent a61f526ce4
commit 38b95e0de6
2 changed files with 336 additions and 0 deletions

View File

@@ -56,6 +56,7 @@ from .features.alarm import get_alarm_clock
from .features.timer import get_timer_manager
from .features.weather import get_weather_report
from .features.music import get_music_controller
from .features.cities_game import get_cities_game
def signal_handler(sig, frame):
"""
@@ -176,6 +177,7 @@ def main():
init_tts() # Загрузка нейросети для синтеза речи (Silero)
alarm_clock = get_alarm_clock() # Загрузка будильников
timer_manager = get_timer_manager() # Загрузка таймеров
cities_game = get_cities_game() # Игра "Города"
print()
# История чата (храним последние 10 обменов репликами для контекста)
@@ -479,6 +481,15 @@ def main():
print("⏹️ Перевод прерван - слушаю следующий вопрос")
continue
# Игра "Города"
cities_response = cities_game.handle(user_text)
if cities_response:
clean_cities_response = clean_response(cities_response, language="ru")
speak(clean_cities_response)
last_response = clean_cities_response
skip_wakeword = True
continue
# --- Шаг 3: Запрос к AI (Streaming) ---
# Добавляем сообщение пользователя в историю
chat_history.append({"role": "user", "content": user_text})