Merge branch 'master' of http://192.168.0.200/knowledge-base-bj/deerflow-code into dhk-dev
# Conflicts: # frontend-web/src/open-canvas/components/ai-writing/AIWritingForm.tsx
This commit is contained in:
commit
27e6b0b23e
718 files changed
+1168
-142636
No files matched your search
+25
-3
@@ -311,8 +311,13 @@ async def run_skill_via_real_agent(
|
||||
skill_dir = skill.get_container_path(base_path)
|
||||
except Exception: # noqa: BLE001
|
||||
skill_dir = ""
|
||||
try:
|
||||
skill_file_path = skill.get_container_file_path(base_path)
|
||||
except Exception: # noqa: BLE001
|
||||
skill_file_path = f"{skill_dir}/SKILL.md" if skill_dir else ""
|
||||
skill_loc_hint = (
|
||||
f"\n\n【技能目录(重要)】技能「{skill_name}」在容器内的目录是:{skill_dir}\n"
|
||||
f"- 技能说明文件是:{skill_file_path}\n"
|
||||
f"- 运行该技能自带的脚本时,**务必先 `cd {skill_dir}` 再执行**"
|
||||
f"(例如 `cd {skill_dir} && python3 scripts/xxx.py ...`),或对脚本用绝对路径;\n"
|
||||
"- **不要用相对路径**(如 `python3 scripts/xxx.py`),否则当前目录不对会报 No such file。"
|
||||
@@ -326,6 +331,20 @@ async def run_skill_via_real_agent(
|
||||
if keywords:
|
||||
task_lines.append(f"可参考的检索方向:{', '.join(keywords[:8])}")
|
||||
task_lines.append(f"目标素材数量约 {max_results} 条。")
|
||||
if skill_file_path or skill_dir:
|
||||
task_lines.extend([
|
||||
"",
|
||||
"【必须使用技能(弱模型也必须遵守)】",
|
||||
f"- 当前指定技能:{skill_name}",
|
||||
f"- SKILL.md 路径:{skill_file_path or '(见上方 <skill> 内容)'}",
|
||||
f"- 技能目录:{skill_dir or '(未知)'}",
|
||||
"- 你的下一步必须先调用 `read_file` 读取这个 SKILL.md(即使上方已有技能摘要,也要读取完整说明),"
|
||||
"再按 SKILL.md 的脚本/接口流程获取真实数据。",
|
||||
"- 如果 SKILL.md 提到 `scripts/*.py`,必须调用 `bash` 实际运行脚本;优先使用 "
|
||||
f"`cd {skill_dir or '<技能目录>'} && python scripts/xxx.py ...` 或 "
|
||||
f"`cd {skill_dir or '<技能目录>'} && python3 scripts/xxx.py ...`。",
|
||||
"- 禁止第一轮就直接输出 JSON;没有执行过 read_file 和技能要求的脚本/工具前,不能输出 `materials`。",
|
||||
])
|
||||
# 弱模型强提示:明确要求「先动手执行技能脚本」,避免它直接吐空 JSON 不检索。
|
||||
task_lines.append(
|
||||
f"现在请**立刻开始执行检索**:按上面挂载技能的 SKILL.md,用 bash 运行它的脚本"
|
||||
@@ -365,10 +384,13 @@ async def run_skill_via_real_agent(
|
||||
# recursion_limit 计的是 graph 超级步(每个「模型→工具」回合≈2 步),不能直接等于 max_turns,
|
||||
# 否则模型做了 N 个检索词后还没来得及写最终汇总就被 GraphRecursionError 截断(实测 10 个
|
||||
# 检索词≈20 步 > 16,结果汇总丢失)。给到 ~2×turns + 余量,让模型正常情况下能写完汇总。
|
||||
run_config: dict = {"recursion_limit": _REAL_AGENT_MAX_TURNS * 2 + 4}
|
||||
run_context: dict = {}
|
||||
run_config: dict = {
|
||||
"recursion_limit": _REAL_AGENT_MAX_TURNS * 2 + 4,
|
||||
"configurable": {"agent_id": RESEARCHER_AGENT_ID},
|
||||
}
|
||||
run_context: dict = {"agent_id": RESEARCHER_AGENT_ID, "agent_name": RESEARCHER_AGENT_ID}
|
||||
if thread_id:
|
||||
run_config["configurable"] = {"thread_id": thread_id}
|
||||
run_config["configurable"]["thread_id"] = thread_id
|
||||
run_context["thread_id"] = thread_id
|
||||
if app_config is not None:
|
||||
run_context["app_config"] = app_config
|
||||
|
||||
Reference in new issue
Block a user