From 9133ca4e056f25b4c4bddc4322a870a66a5d91f2 Mon Sep 17 00:00:00 2001 From: Cursor Date: Sat, 21 Mar 2026 00:49:27 +0100 Subject: [PATCH] =?UTF-8?q?perf(bot):=20Thinking-Modus=20abschalten=20(/no?= =?UTF-8?q?=5Fthink)=20=E2=80=94=20drastisch=20schnellere=20Antworten?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- homelab-ai-bot/llm.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/homelab-ai-bot/llm.py b/homelab-ai-bot/llm.py index fd9ff3d2..9c9918de 100644 --- a/homelab-ai-bot/llm.py +++ b/homelab-ai-bot/llm.py @@ -204,7 +204,18 @@ def _call_openrouter(messages: list, api_key: str, use_tools: bool = True, if use_ollama: url = f"{OLLAMA_BASE}/v1/chat/completions" headers = {"Content-Type": "application/json"} - timeout = 180 + timeout = 120 + for msg in reversed(payload.get("messages", [])): + if msg.get("role") == "user": + content = msg.get("content", "") + if isinstance(content, str) and "/no_think" not in content: + msg["content"] = content + " /no_think" + elif isinstance(content, list): + for item in content: + if item.get("type") == "text" and "/no_think" not in item.get("text", ""): + item["text"] = item["text"] + " /no_think" + break + break else: url = f"{OPENROUTER_BASE}/chat/completions" headers = {"Authorization": f"Bearer {api_key}"}