From 09a1718103fe28a6423c48c5ad596436f98d7df5 Mon Sep 17 00:00:00 2001 From: pewdiepie-archdaemon Date: Sat, 13 Jun 2026 23:09:15 +0900 Subject: [PATCH] Skills test: set explicit max_tokens=4096 instead of 0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit max_tokens=0 made stream_agent_loop omit the param entirely, which on some OpenAI-compat upstreams (DeepSeek in the report) meant the model defaulted to a very short or zero-token completion — the user saw "the model returned an empty" even though normal chat with the same model worked (chat sends its preset's max_tokens). Match the chat default. --- routes/skills_routes.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/routes/skills_routes.py b/routes/skills_routes.py index 3d6ede921..444dd69cf 100644 --- a/routes/skills_routes.py +++ b/routes/skills_routes.py @@ -691,8 +691,12 @@ async def _run_skill_test_once(md: str, task: str, url, model, headers, owner) - {"role": "user", "content": task}, ] try: + # max_tokens explicitly set: passing 0 lets some upstreams (Ollama, + # OpenAI-compat) generate an empty completion, which manifested as + # the skill test returning nothing while chat (which carries its + # preset's max_tokens) worked. 4096 matches the chat default. async for chunk in stream_agent_loop(url, model, messages, headers=headers, - temperature=0.3, max_tokens=0, max_rounds=8, owner=owner): + temperature=0.3, max_tokens=4096, max_rounds=8, owner=owner): if not chunk.startswith("data: ") or chunk.strip() == "data: [DONE]": continue try: