Fix command detection and improve weather timing
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user