diff --git a/ai_agent.py b/ai_agent.py index 2c2da35..060b7be 100644 --- a/ai_agent.py +++ b/ai_agent.py @@ -72,8 +72,11 @@ class AiAgent: except Exception as e: context.remove_last_message() - print(f"Ошибка выполнения запроса к ИИ: {e}") - return f"Извините, при обработке запроса произошла ошибка:\n{e}" + if str(e).find("Rate limit exceeded") != -1: + return "Извините, достигнут дневной лимит запросов к ИИ (обновляется в 03:00 МСК)." + else: + print(f"Ошибка выполнения запроса к ИИ: {e}") + return f"Извините, при обработке запроса произошла ошибка." def clear_chat_context(self, chat_id: int): self.chat_contexts.pop(chat_id, None)