Skip to content

JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.

Python

feat:移除报告字符数计算能力

hy592070616221775747bc9
diff --git a/jiuwenswarm/agents/harness/common/tools/deepresearch/execution.py b/jiuwenswarm/agents/harness/common/tools/deepresearch/execution.py
index 4d5ce6a8d2..310d407b69 100644
--- a/jiuwenswarm/agents/harness/common/tools/deepresearch/execution.py
+++ b/jiuwenswarm/agents/harness/common/tools/deepresearch/execution.py
@@ -648,7 +648,7 @@ def _outline_sections(outline_text: str) -> list[str]:
def _completion_content(
- state: Mapping[str, Any], report_chars: Any, html_style_status: Any = None
+ state: Mapping[str, Any], html_style_status: Any = None
) -> str:
file_name = str(state.get("file_name") or "研究报告").strip()
title = re.sub(r"\.(?:md|markdown)$", "", file_name, flags=re.IGNORECASE)
@@ -658,10 +658,8 @@ def _completion_content(
f"{title or '研究报告'}已成功生成并交付。",
]
sections = state.get("outline_sections")
- if isinstance(report_chars, int) or isinstance(sections, list):
+ if isinstance(sections, list):
lines.extend(["", "**报告概览**:"])
- if isinstance(report_chars, int):
- lines.append(f"- **报告字符数**:{report_chars:,} 字")
normalized_sections = [
str(section).strip()
for section in (sections if isinstance(sections, list) else [])
@@ -841,7 +839,6 @@ async def _handle_outcome(
content="DeepResearch 返回了不支持的交互节点,任务已停止。",
)
if status == "completed" and outcome.get("report_delivered") is True:
- report_chars = outcome.get("report_chars")
html_style_status = outcome.get("html_style_status")
if html_style_status not in {"applied", "fallback"}:
html_style_status = None
@@ -854,7 +851,7 @@ async def _handle_outcome(
):
html_style_phase = None
html_style_reason_code = None
- content = _completion_content(state, report_chars, html_style_status)
+ content = _completion_content(state, html_style_status)
completed_updates: dict[str, Any] = {"conversation_id": conversation_id}
if html_style_status is not None:
completed_updates["html_style_status"] = html_style_status
diff --git a/jiuwenswarm/agents/harness/common/tools/deepresearch/tools.py b/jiuwenswarm/agents/harness/common/tools/deepresearch/tools.py
index e1ae941e58..50aff21829 100644
--- a/jiuwenswarm/agents/harness/common/tools/deepresearch/tools.py
+++ b/jiuwenswarm/agents/harness/common/tools/deepresearch/tools.py
@@ -142,7 +142,6 @@ _PROTOCOL_FIXED_KEYS = frozenset(
"questions",
"reasoning_content",
"report",
- "report_chars",
"report_delivered",
"response_content",
"response_content_type",
@@ -2502,7 +2501,6 @@ async def _consume_stream(
"status": "completed",
"conversation_id": chunk.get("conversation_id", outcome_cid),
"report_delivered": True,
- "report_chars": len(response_content),
}
if html_style_status in {"applied", "fallback"}:
completed_outcome["html_style_status"] = html_style_status
diff --git a/tests/unit_tests/agentserver/test_deepresearch_execute_tool.py b/tests/unit_tests/agentserver/test_deepresearch_execute_tool.py
index a38a291376..87eebe04e8 100644
--- a/tests/unit_tests/agentserver/test_deepresearch_execute_tool.py
+++ b/tests/unit_tests/agentserver/test_deepresearch_execute_tool.py
@@ -132,7 +132,6 @@ async def test_new_query_starts_sdk_directly():
"status": "completed",
"conversation_id": "conversation-1",
"report_delivered": True,
- "report_chars": 42,
"workflow_llm_token_usage": sdk_usage,
}
with patch.object(
@@ -455,7 +454,6 @@ async def test_feedback_answer_resumes_once_and_returns_direct_completion():
"status": "completed",
"conversation_id": "conversation-1",
"report_delivered": True,
- "report_chars": 12345,
}
with patch.object(
@@ -470,7 +468,6 @@ async def test_feedback_answer_resumes_once_and_returns_direct_completion():
)
assert result["kind"] == "completed"
- assert "12,345" in result["content"]
assert "✅ **深度研究已完成!**" in result["content"]
assert "智能家电报告已成功生成并交付" in result["content"]
assert saved[0]["phase"] == "resuming_feedback"
@@ -523,7 +520,6 @@ async def test_completion_warns_when_html_style_falls_back():
"status": "completed",
"conversation_id": "conversation-1",
"report_delivered": True,
- "report_chars": 42,
"html_style_status": "fallback",
"html_style_phase": "invoke_llm",
"html_style_reason_code": "llm_call_failed",
@@ -582,7 +578,6 @@ async def test_terminal_result_preserves_all_sdk_timing_windows():
"status": "completed",
"conversation_id": "conversation-1",
"report_delivered": True,
- "report_chars": 42,
"timing": {
"schema_version": 2,
"runner_total_ms": 340,
@@ -692,7 +687,6 @@ async def test_outline_is_presented_once_then_confirmed_without_main_agent():
"status": "completed",
"conversation_id": "conversation-1",
"report_delivered": True,
- "report_chars": 100,
}
outline_answer = {
"status": "answered",
@@ -920,7 +914,6 @@ async def test_same_outer_tool_call_survives_multiple_native_interrupts():
"status": "completed",
"conversation_id": "conversation-1",
"report_delivered": True,
- "report_chars": 321,
}
second = _rail_ctx(
result=None,
@@ -941,6 +934,6 @@ async def test_same_outer_tool_call_survives_multiple_native_interrupts():
await rail.after_tool_call(second)
assert second.force_finish_requests[0]["result_type"] == "answer"
- assert "321" in second.force_finish_requests[0]["output"]
+ assert "✅ **深度研究已完成!**" in second.force_finish_requests[0]["output"]
assert session.state[DEEPRESEARCH_EXECUTION_STATE_KEY] == {}
assert session.state[DEEPRESEARCH_EXECUTION_ALIAS_KEY] == {}
diff --git a/tests/unit_tests/agentserver/test_deepresearch_stream_tool.py b/tests/unit_tests/agentserver/test_deepresearch_stream_tool.py
index e403352bd2..f55b893bd9 100644
--- a/tests/unit_tests/agentserver/test_deepresearch_stream_tool.py
+++ b/tests/unit_tests/agentserver/test_deepresearch_stream_tool.py
@@ -1308,7 +1308,6 @@ async def test_completed_marker_accepts_p_numbered_sections_beneath_wrapper_head
"status": "completed",
"conversation_id": "C1",
"report_delivered": True,
- "report_chars": len("# Final"),
"workflow_llm_token_usage": sdk_usage,
}
@@ -1377,7 +1376,6 @@ async def test_completed_marker_accepts_sdk_final_report_after_degraded_section(
"status": "completed",
"conversation_id": "C1",
"report_delivered": True,
- "report_chars": len("# Final"),
}
@@ -1452,7 +1450,6 @@ async def test_completed_marker_accepts_formal_sdk_end_result_when_section_done_
"status": "completed",
"conversation_id": "C1",
"report_delivered": True,
- "report_chars": len("# Final"),
}
@@ -1515,7 +1512,6 @@ async def test_completed_marker_delivers_large_sdk_end_result(tmp_path: Path):
"status": "completed",
"conversation_id": "C1",
"report_delivered": True,
- "report_chars": len("# Final"),
}
write_artifacts.assert_awaited_once()
@@ -1665,7 +1661,6 @@ async def test_completed_report_delivers_markdown_html_and_hidden_bundle(tmp_pat
"status": "completed",
"conversation_id": "C1",
"report_delivered": True,
- "report_chars": len("# Final"),
"html_style_status": "fallback",
"html_style_phase": "invoke_llm",
"html_style_reason_code": "llm_call_failed",
@@ -1753,7 +1748,6 @@ async def test_completed_native_html_delivers_exactly_one_brief_file(tmp_path: P
"status": "completed",
"conversation_id": "C1",
"report_delivered": True,
- "report_chars": len(native_html),
}
write_html.assert_awaited_once_with(native_html, "brief.md")
markdown_writer.assert_not_awaited()
@@ -2862,7 +2856,6 @@ async def test_large_completed_marker_above_streamreader_limit_is_supported(tmp_
)
outcome = json.loads(await dt.deepresearch_stream._func(action="start", query="q"))
assert outcome["status"] == "completed"
- assert outcome["report_chars"] == len(report)
@pytest.mark.asyncio