Skip to content

Self-hosted AI workspace.

Python

Skills test: set explicit max_tokens=4096 instead of 0

pewdiepie-archdaemon18b985df4c61
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: