sync snapshot from LAN repo (source xuhd-new @ edb08220)
This commit is contained in:
1 parent
ea9dcff9c0
commit
bbe365429d
404 files changed
+3576
-47782
No files matched your search
+2
-36
@@ -812,12 +812,6 @@ def make_lead_agent(config: RunnableConfig):
|
||||
return _make_lead_agent(config, app_config=runtime_app_config or get_app_config())
|
||||
|
||||
|
||||
# The Gateway may build this synchronous graph in its dedicated initializer.
|
||||
# It restores ContextVar changes and keeps MCP discovery on the request loop;
|
||||
# graph execution/checkpoint operations still run in the original async task.
|
||||
make_lead_agent._deerflow_background_build = True
|
||||
|
||||
|
||||
def _make_lead_agent(config: RunnableConfig, *, app_config: AppConfig):
|
||||
# Lazy import to avoid circular dependency
|
||||
from deerflow.tools import get_available_tools
|
||||
@@ -949,12 +943,6 @@ def _make_lead_agent(config: RunnableConfig, *, app_config: AppConfig):
|
||||
agent_display_name = agent_config.name if agent_config else agent_id
|
||||
# Custom agent model from agent config (if any), or None to let _resolve_model_name pick the default
|
||||
agent_model_name = agent_config.model if agent_config and agent_config.model else None
|
||||
# The global prompt suffix remains on unless this particular custom agent
|
||||
# explicitly opts out. ``getattr`` preserves compatibility with callers
|
||||
# that supply lightweight agent-config test doubles.
|
||||
model_prompt_suffix_enabled = bool(
|
||||
getattr(agent_config, "model_prompt_suffix_enabled", True)
|
||||
) if agent_config else True
|
||||
|
||||
# Final model name resolution: request → agent config → global default, with fallback for unknown names
|
||||
model_name = _resolve_model_name(requested_model_name or agent_model_name, app_config=resolved_app_config)
|
||||
@@ -1014,7 +1002,6 @@ def _make_lead_agent(config: RunnableConfig, *, app_config: AppConfig):
|
||||
"agent_id": agent_id,
|
||||
"agent_name": agent_display_name or "default",
|
||||
"model_name": model_name or "default",
|
||||
"model_prompt_suffix_enabled": model_prompt_suffix_enabled,
|
||||
"thinking_enabled": thinking_enabled,
|
||||
"reasoning_effort": reasoning_effort,
|
||||
"is_plan_mode": is_plan_mode,
|
||||
@@ -1159,12 +1146,7 @@ def _make_lead_agent(config: RunnableConfig, *, app_config: AppConfig):
|
||||
# 模型手工 write_file。续写轮(已有 report.md)不挂,保持原有「直接编辑
|
||||
# 该文件」行为。不受 tool_groups/excluded_tools 过滤——它是写作模式合约
|
||||
# 的核心交付手段。
|
||||
# Workbench delivery writes only from collected materials; it does not
|
||||
# expand the selected knowledge scope or enable external search tools.
|
||||
workbench_report_delivery = workbench_write_now and bool(cfg.get("workbench_session_id"))
|
||||
if writing_mode and not writing_artifact_path and (
|
||||
not classic_knowledge_space_strict or workbench_report_delivery
|
||||
):
|
||||
if writing_mode and not writing_artifact_path and not classic_knowledge_space_strict:
|
||||
from deerflow.tools.builtins.deep_research_report_tool import deep_research_report_tool
|
||||
|
||||
default_tools = [*default_tools, deep_research_report_tool]
|
||||
@@ -1257,14 +1239,6 @@ def _make_lead_agent(config: RunnableConfig, *, app_config: AppConfig):
|
||||
|
||||
system_prompt += project_system_prompt(cfg)
|
||||
|
||||
if cfg.get("knowledge_research_session_id") and disable_tools:
|
||||
from deerflow.agents.lead_agent.knowledge_research_prompt import KNOWLEDGE_RESEARCH_PROMPT
|
||||
|
||||
# Research is an inline document editor. Generic file/tool contracts
|
||||
# contradict this server-enforced tool-free mode.
|
||||
system_prompt = KNOWLEDGE_RESEARCH_PROMPT
|
||||
|
||||
|
||||
_log_es_query_routing_registration(
|
||||
system_prompt=system_prompt,
|
||||
app_config=resolved_app_config,
|
||||
@@ -1273,15 +1247,7 @@ def _make_lead_agent(config: RunnableConfig, *, app_config: AppConfig):
|
||||
)
|
||||
|
||||
return create_agent(
|
||||
model=create_chat_model(
|
||||
name=model_name,
|
||||
thinking_enabled=thinking_enabled,
|
||||
reasoning_effort=reasoning_effort,
|
||||
force_disable_thinking=thinking_force_disabled,
|
||||
write_file_compatibility=write_file_compatibility,
|
||||
prompt_suffix_enabled=model_prompt_suffix_enabled,
|
||||
app_config=resolved_app_config,
|
||||
),
|
||||
model=create_chat_model(name=model_name, thinking_enabled=thinking_enabled, reasoning_effort=reasoning_effort, force_disable_thinking=thinking_force_disabled, write_file_compatibility=write_file_compatibility, app_config=resolved_app_config),
|
||||
tools=default_tools,
|
||||
middleware=_build_middlewares(config, model_name=model_name, agent_name=agent_id, app_config=resolved_app_config),
|
||||
system_prompt=system_prompt,
|
||||
|
||||
Reference in new issue
Block a user