Fix command detection and improve weather timing

This commit is contained in:
2026-02-02 23:30:57 +03:00
parent 845ef7c531
commit a61f526ce4
5 changed files with 38 additions and 18 deletions

View File

@@ -38,6 +38,8 @@ def _send_request(messages, max_tokens, temperature, error_text):
temperature: "Креативность" (0.2 - строго, 1.0 - креативно).
error_text: Текст ошибки для пользователя в случае сбоя.
"""
if not PERPLEXITY_API_KEY:
return "Не настроен PERPLEXITY_API_KEY. Проверьте файл .env."
headers = {
"Authorization": f"Bearer {PERPLEXITY_API_KEY}",
"Content-Type": "application/json",
@@ -102,6 +104,9 @@ def ask_ai_stream(messages_history: list):
"""
Generator that yields chunks of the AI response as they arrive.
"""
if not PERPLEXITY_API_KEY:
yield "Не настроен ключ PERPLEXITY_API_KEY. Проверьте файл .env."
return
if not messages_history:
yield "Извините, я не расслышал вашу команду."
return