perf(bot): Thinking-Modus abschalten (/no_think) — drastisch schnellere Antworten

This commit is contained in:
Cursor 2026-03-21 00:49:27 +01:00
parent 72d68a1e83
commit 9133ca4e05

View file

@ -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}"}