Skip to content

DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.

fix(visualize): point the no-payload diagnosis at the real remedy (#1546)

sjagadeebc15b75708bb
diff --git a/deeptutor/agents/visualize/capability.py b/deeptutor/agents/visualize/capability.py
index 938138698..32b247740 100644
--- a/deeptutor/agents/visualize/capability.py
+++ b/deeptutor/agents/visualize/capability.py
@@ -45,7 +45,13 @@ _NO_PAYLOAD_TOOL_CALLING_DISABLED = (
"Settings → Models → LLM → Capabilities → Tool calling → Supported, "
"then run the visualization again."
)
-_NO_PAYLOAD = "The visualization agent finished without a valid canvas payload."
+_NO_PAYLOAD = (
+ "The visualization agent finished without a valid canvas payload. A "
+ "reasoning model can spend most of its output budget on internal "
+ "thinking before the submit_visualization call is even written, which "
+ "cuts the call off mid-argument. If this repeats, raise Max tokens for "
+ "Visualize in Settings → Capabilities → Visualize."
+)
# Stages exposed in the manifest. The first three cover the text-emitting
# path (svg/chartjs/mermaid/html); the rest cover the manim subprocess
diff --git a/deeptutor/agents/visualize/prompts/en/visualize.yaml b/deeptutor/agents/visualize/prompts/en/visualize.yaml
index e34bcd355..2f4a03a7e 100644
--- a/deeptutor/agents/visualize/prompts/en/visualize.yaml
+++ b/deeptutor/agents/visualize/prompts/en/visualize.yaml
@@ -10,5 +10,5 @@ status:
manim_artifacts_many: "Prepared {count} artifacts."
llm_call_failed: "LLM call failed."
tool_calling_disabled: "Tool calling is disabled for {target}, but a visualization only reaches the canvas through the submit_visualization tool call. Enable it in Settings → Models → LLM → Capabilities → Tool calling → Supported."
- no_payload: "The visualization agent finished without a valid canvas payload."
+ no_payload: "The visualization agent finished without a valid canvas payload. A reasoning model can spend most of its output budget on internal thinking before the submit_visualization call is even written, which cuts the call off mid-argument. If this repeats, raise Max tokens for Visualize in Settings → Capabilities → Visualize."
no_payload_tool_calling_disabled: "No visualization was committed: tool calling is disabled for {target}, so the model could not call submit_visualization — the only way to hand a payload to the canvas. Local servers (LM Studio, Ollama, vLLM, llama.cpp) are opted out by default; declare the model as tool-capable in Settings → Models → LLM → Capabilities → Tool calling → Supported, then run the visualization again."
diff --git a/deeptutor/agents/visualize/prompts/zh/visualize.yaml b/deeptutor/agents/visualize/prompts/zh/visualize.yaml
index 846fd678e..e44dae7c0 100644
--- a/deeptutor/agents/visualize/prompts/zh/visualize.yaml
+++ b/deeptutor/agents/visualize/prompts/zh/visualize.yaml
@@ -10,5 +10,5 @@ status:
manim_artifacts_many: "已准备 {count} 个产物。"
llm_call_failed: "LLM 调用失败。"
tool_calling_disabled: "{target} 未启用工具调用,而可视化只能通过 submit_visualization 工具调用提交到画布。请在 设置 → 模型 → LLM → 能力 → 工具调用 中选择「已支持」。"
- no_payload: "可视化智能体结束时没有产出有效的画布内容。"
+ no_payload: "可视化智能体结束时没有产出有效的画布内容。推理模型可能在思考阶段就耗尽了大部分输出预算,导致 submit_visualization 调用还没写完就被截断。如果反复出现,请在 设置 → 能力 → 可视化 中调高 Max tokens。"
no_payload_tool_calling_disabled: "本次没有提交任何可视化:{target} 未启用工具调用,模型无法调用 submit_visualization,而这是把内容交给画布的唯一途径。本地服务(LM Studio、Ollama、vLLM、llama.cpp)默认关闭工具调用;请在 设置 → 模型 → LLM → 能力 → 工具调用 中把该模型声明为「已支持」,然后重新生成。"
diff --git a/tests/agents/visualize/test_tool_calling_diagnosis.py b/tests/agents/visualize/test_tool_calling_diagnosis.py
index 9688e5bfd..6b78dcb60 100644
--- a/tests/agents/visualize/test_tool_calling_diagnosis.py
+++ b/tests/agents/visualize/test_tool_calling_diagnosis.py
@@ -116,13 +116,21 @@ async def test_local_provider_is_warned_up_front_and_diagnosed_on_failure(
async def test_tool_capable_provider_keeps_the_generic_diagnosis(
monkeypatch: pytest.MonkeyPatch,
) -> None:
- """With tools attached, a missing payload is the model's own doing."""
+ """With tools attached, a missing payload is the model's own doing.
+
+ A reasoning model that spends its budget on chain-of-thought before
+ finishing ``submit_visualization`` looks identical to this from the
+ capability's side (#1546), so the message must point at the concrete
+ remedy — the Settings knob that actually reaches this call — not just
+ describe the symptom.
+ """
_use_llm_config(monkeypatch, "openai", "gpt-4o")
events, error = await _run_visualize(monkeypatch)
assert _warnings(events) == []
- assert error == "The visualization agent finished without a valid canvas payload."
+ assert error.startswith("The visualization agent finished without a valid canvas payload.")
+ assert "Settings → Capabilities → Visualize" in error
@pytest.mark.asyncio
@@ -142,7 +150,7 @@ async def test_declaring_tool_support_clears_the_warning(
set_catalog_capability_overrides([])
assert _warnings(events) == []
- assert error == "The visualization agent finished without a valid canvas payload."
+ assert error.startswith("The visualization agent finished without a valid canvas payload.")
@pytest.mark.asyncio
@@ -159,4 +167,4 @@ async def test_probe_failure_leaves_the_turn_alone(
events, error = await _run_visualize(monkeypatch)
assert _warnings(events) == []
- assert error == "The visualization agent finished without a valid canvas payload."
+ assert error.startswith("The visualization agent finished without a valid canvas payload.")