feat: 新增 agentfx 任务深链与研判报告入库流程
支持 goPath=agentfx 的 iframe 嵌入问答、内置研判助手种子与报告导入协助卡,并完善深度研究流式报告能力。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
6e9e89a6cb
commit
52b9cbf707
34 files changed
+4488
-392
No files matched your search
+9
-1
@@ -175,10 +175,14 @@ class DeerFlowCompletionBackend:
|
||||
config: DeepResearchConfig,
|
||||
event_sink: EventSink | None = None,
|
||||
cancellation: CancellationToken | None = None,
|
||||
force_disable_thinking: bool = False,
|
||||
) -> None:
|
||||
self._config = config
|
||||
self._events = event_sink
|
||||
self._cancel = cancellation
|
||||
# 与 lead agent 同语义的「思考硬关」开关(内网 vLLM/Qwen 只声明
|
||||
# supports_thinking 时,thinking_enabled=False 不会注入 enable_thinking=false)。
|
||||
self._force_disable_thinking = force_disable_thinking
|
||||
self._models: dict[str, BaseChatModel] = {}
|
||||
# Running token totals (keyed by model name) for the final usage report.
|
||||
self._usage_totals: dict[str, dict[str, int]] = {}
|
||||
@@ -196,7 +200,11 @@ class DeerFlowCompletionBackend:
|
||||
return cached
|
||||
from deerflow.models import create_chat_model
|
||||
|
||||
model = create_chat_model(name=name, thinking_enabled=self._config.thinking_enabled)
|
||||
model = create_chat_model(
|
||||
name=name,
|
||||
thinking_enabled=self._config.thinking_enabled,
|
||||
force_disable_thinking=self._force_disable_thinking,
|
||||
)
|
||||
self._models[cache_key] = model
|
||||
return model
|
||||
|
||||
|
||||
+19
-1
@@ -57,7 +57,7 @@ _TOOL_SOURCE_TYPES: dict[str, str] = {
|
||||
}
|
||||
|
||||
# Tool results that never carry report materials.
|
||||
_IGNORED_TOOLS = {"ask_clarification", "write_todos"}
|
||||
_IGNORED_TOOLS = {"ask_clarification", "write_todos", "deep_research_report"}
|
||||
|
||||
|
||||
async def harvest_thread_materials(
|
||||
@@ -80,7 +80,24 @@ async def harvest_thread_materials(
|
||||
return [], ""
|
||||
values = checkpoint_tuple.checkpoint.get("channel_values", {}) or {}
|
||||
messages = values.get("messages") or []
|
||||
return harvest_messages_materials(messages, query=query)
|
||||
|
||||
|
||||
def harvest_messages_materials(
|
||||
messages: list[Any],
|
||||
*,
|
||||
query: str,
|
||||
) -> tuple[list[ResearchMaterial], str]:
|
||||
"""Convert an in-memory message list into research materials.
|
||||
|
||||
Same conversion as :func:`harvest_thread_materials` minus the checkpoint
|
||||
read — for callers that already hold the messages (e.g. a tool reading
|
||||
``runtime.state`` inside the same run).
|
||||
|
||||
Returns ``(materials, agent_summary)`` — the summary is the agent's last
|
||||
visible text (its collection小结) and doubles as a fallback material when
|
||||
the thread produced no harvestable tool results.
|
||||
"""
|
||||
materials = _harvest_tool_messages(messages, query=query)
|
||||
agent_summary = _last_assistant_text(messages)
|
||||
if not materials and agent_summary.strip():
|
||||
@@ -235,5 +252,6 @@ class StaticHarvestMaterialProvider:
|
||||
__all__ = [
|
||||
"MAX_HARVESTED_MATERIALS",
|
||||
"StaticHarvestMaterialProvider",
|
||||
"harvest_messages_materials",
|
||||
"harvest_thread_materials",
|
||||
]
|
||||
Reference in new issue
Block a user