perf(bot): Thinking-Modus abschalten (/no_think) — drastisch schnellere Antworten
This commit is contained in:
parent
72d68a1e83
commit
9133ca4e05
1 changed files with 12 additions and 1 deletions
|
|
@ -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}"}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue