diff --git a/AI/talk_handler.py b/AI/talk_handler.py index 4f94380..48e7cb4 100644 --- a/AI/talk_handler.py +++ b/AI/talk_handler.py @@ -19,6 +19,7 @@ LLAMA_API_URL = os.getenv("LLAMA_API_URL", "https://mirror.porno4free.ru/zovos-a DB_PATH = os.getenv("CHAT_HISTORY_DB_PATH") or str(Path(__file__).resolve().with_name("chat_history.sqlite3")) BOT_MEMORY_NAME = os.getenv("BOT_MEMORY_NAME", "бот") SKIP_TOKEN = "" +FORCE_DISABLE_THINKING = os.getenv("LLAMA_FORCE_DISABLE_THINKING", "1").lower() not in {"0", "false", "no"} RECENT_MESSAGES_LIMIT = 14 SUMMARY_TRIGGER_MESSAGES = 24 @@ -313,8 +314,9 @@ async def _call_llm( max_tokens: int, temperature: float, top_p: float, - disable_thinking: bool = False, + disable_thinking: bool | None = None, ) -> str: + disable_thinking = FORCE_DISABLE_THINKING if disable_thinking is None else disable_thinking url = f"{LLAMA_API_URL.rstrip('/')}/v1/chat/completions" payload = { "messages": messages,