From 1cbebeec3782a5e2a00c2fcf063cdea9324b43d9 Mon Sep 17 00:00:00 2001 From: q Date: Tue, 3 Mar 2026 14:54:48 +0300 Subject: [PATCH] try to fix ai --- AI/talk_handler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AI/talk_handler.py b/AI/talk_handler.py index 207605b..fa3080c 100644 --- a/AI/talk_handler.py +++ b/AI/talk_handler.py @@ -63,7 +63,7 @@ SYSTEM_PROMPT = ( # Размер контекста — количество сообщений на чат # Сколько сообщений держим в БД. Нужно для быстрой очистки. -_CONTEXT_SIZE = 100 +_CONTEXT_SIZE = 20 # Ограничение на общий размер промпта, чтобы системное сообщение не вытеснялось # при сборке длинной истории (приблизительно ~8k символов ≈ 2k токенов). _MAX_PROMPT_CHARS = 8_000 @@ -145,7 +145,7 @@ async def _generate_response(chat_id: int, user_text: str, user_name: str) -> st msgs = await asyncio.to_thread(_build_messages, chat_id, SYSTEM_PROMPT, user_text, user_name) payload = { "messages": msgs, - "max_tokens": 500, + "max_tokens": 200, "temperature": 0.8, "top_p": 0.9, }