From a400989f6401a8cabaf2b7e5bc9efabfcf86c6ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=A3=E5=AE=8F=E5=87=AF?= Date: Fri, 26 Jun 2026 09:55:31 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat(=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1):?= =?UTF-8?q?=20=E6=96=B0=E5=A2=9E=209=20=E4=B8=AA=20HTML=20=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=EF=BC=8C=E4=B8=8B=E6=8B=89=E8=A1=A5=E9=BD=90=E4=B8=BA?= =?UTF-8?q?=20no.1~no.18=EF=BC=88=E5=8F=AA=E5=B1=95=E7=A4=BA=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 从 zt-0625 加入 no.8/no.9/no.10/no.11/no.14/no.15/no.16/no.17/no.18 - 新 no.8/no.9 的 id 用 no8b/no9b(no8/no9 已被显示名 no.12/no.13 的模板占用) - 重排 TEMPLATES 使下拉按显示名升序 no.1→no.18;均 convertible=False 只展示 - 测试覆盖全部 id 存在、显示名覆盖 1~18、各模板文件可读为完整 HTML Co-Authored-By: Claude Opus 4.8 (1M context) --- .../runtime/scheduler/template_fill.py | 65 + .../scheduler/templates/no10/no10.html | 61 + .../scheduler/templates/no11/no11.html | 282 + .../scheduler/templates/no14/no14.html | 204 + .../scheduler/templates/no15/no15.html | 273 + .../scheduler/templates/no16/no16.html | 242 + .../scheduler/templates/no17/no17.html | 10758 ++++++++++++++++ .../scheduler/templates/no18/no18.html | 220 + .../scheduler/templates/no8b/no8b.html | 302 + .../scheduler/templates/no9b/no9b.html | 255 + 10 files changed, 12662 insertions(+) create mode 100644 offline-backend-20260512/backend/packages/harness/deerflow/runtime/scheduler/templates/no10/no10.html create mode 100644 offline-backend-20260512/backend/packages/harness/deerflow/runtime/scheduler/templates/no11/no11.html create mode 100644 offline-backend-20260512/backend/packages/harness/deerflow/runtime/scheduler/templates/no14/no14.html create mode 100644 offline-backend-20260512/backend/packages/harness/deerflow/runtime/scheduler/templates/no15/no15.html create mode 100644 offline-backend-20260512/backend/packages/harness/deerflow/runtime/scheduler/templates/no16/no16.html create mode 100644 offline-backend-20260512/backend/packages/harness/deerflow/runtime/scheduler/templates/no17/no17.html create mode 100644 offline-backend-20260512/backend/packages/harness/deerflow/runtime/scheduler/templates/no18/no18.html create mode 100644 offline-backend-20260512/backend/packages/harness/deerflow/runtime/scheduler/templates/no8b/no8b.html create mode 100644 offline-backend-20260512/backend/packages/harness/deerflow/runtime/scheduler/templates/no9b/no9b.html diff --git a/offline-backend-20260512/backend/packages/harness/deerflow/runtime/scheduler/template_fill.py b/offline-backend-20260512/backend/packages/harness/deerflow/runtime/scheduler/template_fill.py index b7075e4f..18ca995e 100644 --- a/offline-backend-20260512/backend/packages/harness/deerflow/runtime/scheduler/template_fill.py +++ b/offline-backend-20260512/backend/packages/harness/deerflow/runtime/scheduler/template_fill.py @@ -184,6 +184,36 @@ TEMPLATES: tuple[TemplateSpec, ...] = ( # 当前引擎只支持 const VAR= 行注入,故暂注册为只展示;接转换需扩展元素注入。 convertible=False, ), + TemplateSpec( + # 显示 no.8;id 用 no8b(no8 已被显示名 no.12 的模板占用)。 + id="no8b", + name="no.8", + description="", + file="no8b/no8b.html", + convertible=False, + ), + TemplateSpec( + # 显示 no.9;id 用 no9b(no9 已被显示名 no.13 的模板占用)。 + id="no9b", + name="no.9", + description="", + file="no9b/no9b.html", + convertible=False, + ), + TemplateSpec( + id="no10", + name="no.10", + description="", + file="no10/no10.html", + convertible=False, + ), + TemplateSpec( + id="no11", + name="no.11", + description="", + file="no11/no11.html", + convertible=False, + ), TemplateSpec( id="no8", name="no.12", @@ -202,6 +232,41 @@ TEMPLATES: tuple[TemplateSpec, ...] = ( # 故暂注册为只展示;接转换需放宽行注入正则。 convertible=False, ), + TemplateSpec( + id="no14", + name="no.14", + description="", + file="no14/no14.html", + convertible=False, + ), + TemplateSpec( + id="no15", + name="no.15", + description="", + file="no15/no15.html", + convertible=False, + ), + TemplateSpec( + id="no16", + name="no.16", + description="", + file="no16/no16.html", + convertible=False, + ), + TemplateSpec( + id="no17", + name="no.17", + description="", + file="no17/no17.html", + convertible=False, + ), + TemplateSpec( + id="no18", + name="no.18", + description="", + file="no18/no18.html", + convertible=False, + ), ) _TEMPLATES_BY_ID: dict[str, TemplateSpec] = {t.id: t for t in TEMPLATES} diff --git a/offline-backend-20260512/backend/packages/harness/deerflow/runtime/scheduler/templates/no10/no10.html b/offline-backend-20260512/backend/packages/harness/deerflow/runtime/scheduler/templates/no10/no10.html new file mode 100644 index 00000000..9786213e --- /dev/null +++ b/offline-backend-20260512/backend/packages/harness/deerflow/runtime/scheduler/templates/no10/no10.html @@ -0,0 +1,61 @@ + + +台方向“解放军无法战胜”叙事专题数据库 +

台方向“解放军无法战胜”叙事专题数据库

围绕“台湾难以抗衡 / 抵抗代价过高 / 外援不确定”的安全叙事,展示事件、口径、党派转译、平台链路、受众画像、青年兵役与疑美叙事。

版本:纯中文展示版 v5.0横向 Tab 导航无可见 JSON 区块本地单文件可运行
+

专题总览

定义研究对象、时间范围、边界、资料来源和系统结构。

本页将底层数据转为中文卡片、时间线、链条图、表格和详情面板,不显示 JSON 原文。

4条目
8标签
3来源引用
研究重点

给出专题边界、研究对象、数据层构成、平台环境基线与安全边界。

展示方式

总览卡片、统计面板、叙事—心理—行为模型、来源索引。

适合回答
  • 这个专题研究什么?
  • 数据有哪些层次?
  • 哪些内容可以直接入库?
  • 有哪些伦理边界?
核心字段
  • 研究对象
  • 时间范围
  • 研究边界
  • 主要社群平台
  • 数据结构
当前显示 4 / 4 条记录。点击“查看完整详情”可打开中文详情面板。
OV001 · 专题总览

专题定义

研究台湾方向围绕“解放军无法战胜 / 台湾难以抗衡 / 抵抗代价过高”的安全叙事体系。

研究对象台湾舆论场中的安全叙事、党派转译、平台传播、受众心理与社会反应
时间范围1995—1996;2022—2026为重点
研究边界公开资料研究,不做隐蔽影响、定向操控、恐吓传播或虚假信息设计
研究对象范围
OV002 · 专题总览

数据层说明

本库包括10个栏目、12类核心叙事、6条叙事链、12个事件/战术动作条目、9类平台链路和10类受众画像。

栏目数量10
核心叙事12
叙事链6
事件条目12
数据结构知识库
OV003 · 专题总览

安全与伦理边界

本系统定位为研究型工具,输出为公开舆情研究、风险沟通和信息韧性分析。

允许方向公开舆情研究、平台机制分析、风险沟通、政策研究
禁止方向隐蔽投放、心理操控、恐吓传播、谣言制造、群体污名化、军事攻击细节
安全边界研究用途
OV004 · 专题总览

数字与平台环境基线

台湾互联网和社群普及率很高,YouTube、Facebook、Instagram、Dcard、Threads、PTT 等平台承担不同传播功能。

2025社群用户身份约1840万,占总人口约79.4%
2025年底互联网用户约2230万,普及率约96.7%
主要社群平台YouTube、Facebook、Instagram、Dcard、Threads、PTT、LINE
平台环境基线数据
+ + + \ No newline at end of file diff --git a/offline-backend-20260512/backend/packages/harness/deerflow/runtime/scheduler/templates/no11/no11.html b/offline-backend-20260512/backend/packages/harness/deerflow/runtime/scheduler/templates/no11/no11.html new file mode 100644 index 00000000..3fe03178 --- /dev/null +++ b/offline-backend-20260512/backend/packages/harness/deerflow/runtime/scheduler/templates/no11/no11.html @@ -0,0 +1,282 @@ + + + + + +驻印太美国军事群体专题数据库 + + + +
+
+
+

驻印太美国军事群体专题库

+

围绕日本、韩国、关岛等地区的美国军事群体、基地网络、地方舆情、SOFA争议、环境健康、NEO撤离与信息安全风险进行结构化展示。

+
+
V1.2
+
+
+ +
+
+ +
+ +
+
+ + + + + + \ No newline at end of file diff --git a/offline-backend-20260512/backend/packages/harness/deerflow/runtime/scheduler/templates/no14/no14.html b/offline-backend-20260512/backend/packages/harness/deerflow/runtime/scheduler/templates/no14/no14.html new file mode 100644 index 00000000..872d1262 --- /dev/null +++ b/offline-backend-20260512/backend/packages/harness/deerflow/runtime/scheduler/templates/no14/no14.html @@ -0,0 +1,204 @@ + + + + + +美国涉华涉台政策权力网络专题平台 + + + +
+

美国涉华涉台政策权力网络专题平台

+
基于公开资料与 Skill 框架整理的结构化研究平台:覆盖白宫、行政部门、国会委员会、利益集团、智库媒体、摩擦事件、风险指标与关系图谱。研究边界:公开资料、结构性分析、风险预警;不包含私人信息或定向影响操作。
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+ + + + \ No newline at end of file diff --git a/offline-backend-20260512/backend/packages/harness/deerflow/runtime/scheduler/templates/no15/no15.html b/offline-backend-20260512/backend/packages/harness/deerflow/runtime/scheduler/templates/no15/no15.html new file mode 100644 index 00000000..3d1c4281 --- /dev/null +++ b/offline-backend-20260512/backend/packages/harness/deerflow/runtime/scheduler/templates/no15/no15.html @@ -0,0 +1,273 @@ + + + + + +美国左翼/进步群体涉华涉台专题研究平台(增强版) + + + +
+
+
Research Dashboard · Enhanced Display
+

美国左翼/进步群体涉华涉台专题研究平台(增强版)

+
+
+
+
+ + + + + + +
+ +
+ +
+ + + + + diff --git a/offline-backend-20260512/backend/packages/harness/deerflow/runtime/scheduler/templates/no16/no16.html b/offline-backend-20260512/backend/packages/harness/deerflow/runtime/scheduler/templates/no16/no16.html new file mode 100644 index 00000000..3ca5f472 --- /dev/null +++ b/offline-backend-20260512/backend/packages/harness/deerflow/runtime/scheduler/templates/no16/no16.html @@ -0,0 +1,242 @@ + + + + + +美方新右翼与极右翼群体研究专题库 v3 + + + +

+
+
+
+ + + + + +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/offline-backend-20260512/backend/packages/harness/deerflow/runtime/scheduler/templates/no17/no17.html b/offline-backend-20260512/backend/packages/harness/deerflow/runtime/scheduler/templates/no17/no17.html new file mode 100644 index 00000000..c85b3c7a --- /dev/null +++ b/offline-backend-20260512/backend/packages/harness/deerflow/runtime/scheduler/templates/no17/no17.html @@ -0,0 +1,10758 @@ + + + + + +美国涉台叙事生态专题研究平台 · 增强版(修复表头) + + + +
+
+

美国涉台叙事生态专题研究平台 · 增强版

+

围绕“中国统一进程难阻挡”这一研究母题,展示其在美国政策圈、媒体场、平台生态、受众派系、竞争叙事和风险预警中的接受、转译、抵抗与反弹机制。

+

本页面重构为结构化资料库:详情弹框不再显示 JSON 原文,而是按“基本信息、逻辑链、共鸣机制、反弹机制、平台行为、观察指标、研究备注”等分区展示。

+
+
+ +
+ + + + + +
+ + +
+
+
+ +
+ + + + + + \ No newline at end of file diff --git a/offline-backend-20260512/backend/packages/harness/deerflow/runtime/scheduler/templates/no18/no18.html b/offline-backend-20260512/backend/packages/harness/deerflow/runtime/scheduler/templates/no18/no18.html new file mode 100644 index 00000000..b5b86393 --- /dev/null +++ b/offline-backend-20260512/backend/packages/harness/deerflow/runtime/scheduler/templates/no18/no18.html @@ -0,0 +1,220 @@ + + + + + +台海经济民生叙事监测专题平台 + + + +
+
+

台海经济民生叙事监测专题平台

+

围绕“军事介入台海经济民生必下降”这一叙事,建立公开资料研究型数据库。页面用于拆解事件、预算、军售、半导体、航运、贸易、受众和平台传播之间的关系,同时展示竞争叙事与反弹逻辑。

+
+ 版本 1.0 + 生成日期:2026-06-25 + 公开资料研究 + 非操纵性传播方案 +
+
+
+ + + + +
+ +
+ +
+ + + + + diff --git a/offline-backend-20260512/backend/packages/harness/deerflow/runtime/scheduler/templates/no8b/no8b.html b/offline-backend-20260512/backend/packages/harness/deerflow/runtime/scheduler/templates/no8b/no8b.html new file mode 100644 index 00000000..095d0ad0 --- /dev/null +++ b/offline-backend-20260512/backend/packages/harness/deerflow/runtime/scheduler/templates/no8b/no8b.html @@ -0,0 +1,302 @@ + + + + + +台湾涉两岸政治叙事监测专题 + + + +
+
+
专题研究平台 · 精简栏目版 v0.3
+

台湾涉两岸政治叙事监测专题

+
公开资料监测、叙事结构拆解、平台传播观察、群体匿名反应、竞争叙事识别与主体节点观察
+
研究边界:仅用于公开资料研究和舆情态势理解;不生成定向影响、群体操控、个人画像或宣传执行方案。
+
+
+
+ +
+
+
+ +
+
+ +
+
+
+
+
+
+
+
+
+
+ + + +
+ 本页面为单文件离线版,已移除来源审查、风险评估与 Schema 栏目。建议正式研究时继续补充每条事件的原始链接、样本截图、平台互动量和跨平台传播链。 +
+ + + + + \ No newline at end of file diff --git a/offline-backend-20260512/backend/packages/harness/deerflow/runtime/scheduler/templates/no9b/no9b.html b/offline-backend-20260512/backend/packages/harness/deerflow/runtime/scheduler/templates/no9b/no9b.html new file mode 100644 index 00000000..651bc9c1 --- /dev/null +++ b/offline-backend-20260512/backend/packages/harness/deerflow/runtime/scheduler/templates/no9b/no9b.html @@ -0,0 +1,255 @@ + + + + + +台湾经济安全与公共叙事研究专题数据库 + + + +
+
+ 专题数据库 · JSON + HTML 离线版 +

台湾经济安全与公共叙事研究专题

+
围绕台积电赴美、CHIPS Act、军费军购、台美贸易倡议、CPTPP/RCEP、ECFA、两岸经贸、台商供应链与平台舆情进行结构化整理。页面强调事实边界,避免把事件直接写成单向结论。
+
+ + + + +
+
+ +
+ + + +
+ + +
+ + + + + + From 3d6065149148f33a2284eae1fdf20eb2742016df Mon Sep 17 00:00:00 2001 From: fengxiangdebaozi <10845145+fengxiangdebaozi@user.noreply.gitee.com> Date: Fri, 26 Jun 2026 10:04:38 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feat(ai-writing):=20=E6=A3=80=E7=B4=A2?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E5=8A=A0=E5=9B=9E=E3=80=8C=E7=9F=A5=E8=AF=86?= =?UTF-8?q?=E5=BA=93=E6=A3=80=E7=B4=A2=E3=80=8D(=E7=9B=B4=E8=BF=9E?= =?UTF-8?q?=E5=86=85=E7=BD=91=20ES=20=E6=8E=A5=E5=8F=A3)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 弱模型常识别不了配置技能(deepseek-chat 等),恢复旧的"不用技能"检索路径 作为独立检索类型 knowledge_base:绕过技能编排,直接调 ai_writing.intranet_search_url 内网知识库 ES 接口(IntranetSearchProvider) 对检索词并发检索;未配地址 → 无素材 + skill_error 告警。 - researcher.py: material_source 归一保留 knowledge_base + 新增直连内网分支 - state.py: material_source 三值注释 - 前端 AIWritingForm/WritingFormContext/types: 下拉新增「知识库检索」 - tests/test_ai_writing_knowledge_base.py: 直连/未配/不编排技能 3 用例 - backend CLAUDE.md: 检索类型段更新为三值 Co-Authored-By: Claude Opus 4.8 (1M context) --- .../components/ai-writing/AIWritingForm.tsx | 3 +- .../contexts/WritingFormContext.tsx | 14 ++- .../src/open-canvas/types/ai-writing.ts | 5 +- offline-backend-20260512/backend/CLAUDE.md | 2 +- .../agents/ai_writing/nodes/researcher.py | 64 ++++++++++- .../deerflow/agents/ai_writing/state.py | 5 +- .../tests/test_ai_writing_knowledge_base.py | 105 ++++++++++++++++++ 7 files changed, 182 insertions(+), 16 deletions(-) create mode 100644 offline-backend-20260512/backend/tests/test_ai_writing_knowledge_base.py diff --git a/frontend-web/src/open-canvas/components/ai-writing/AIWritingForm.tsx b/frontend-web/src/open-canvas/components/ai-writing/AIWritingForm.tsx index cbf26130..9b95b7ff 100644 --- a/frontend-web/src/open-canvas/components/ai-writing/AIWritingForm.tsx +++ b/frontend-web/src/open-canvas/components/ai-writing/AIWritingForm.tsx @@ -40,11 +40,12 @@ const INPUT_CLASS = const DEFAULT_KEYWORD_COUNT = 1; const DEFAULT_AUDIENCE = '普通读者'; -type MaterialSource = 'general' | 'notebook'; +type MaterialSource = 'general' | 'knowledge_base' | 'notebook'; const MAX_INTENT_LENGTH = 500; const MATERIAL_SOURCE_OPTIONS: Array<{ value: MaterialSource; label: string; desc: string }> = [ { value: 'general', label: '通用检索', desc: '用素材收集专家配置的技能检索(默认:知识库检索)' }, + { value: 'knowledge_base', label: '知识库检索', desc: '直连内网知识库检索接口,不走技能编排' }, { value: 'notebook', label: '我的空间', desc: '从空间中检索素材' }, ]; diff --git a/frontend-web/src/open-canvas/contexts/WritingFormContext.tsx b/frontend-web/src/open-canvas/contexts/WritingFormContext.tsx index 364dc78c..e8ca3b0d 100644 --- a/frontend-web/src/open-canvas/contexts/WritingFormContext.tsx +++ b/frontend-web/src/open-canvas/contexts/WritingFormContext.tsx @@ -37,8 +37,8 @@ export interface WritingFormValue { /** 是否在成稿里加参考文献(正文 [n] 角标 + 文末「参考文献」列表,像论文)。默认开。 */ addReferences: boolean; setAddReferences: (v: boolean) => void; - materialSource: 'general' | 'notebook'; - setMaterialSource: (v: 'general' | 'notebook') => void; + materialSource: 'general' | 'knowledge_base' | 'notebook'; + setMaterialSource: (v: 'general' | 'knowledge_base' | 'notebook') => void; /** 不收集素材,直接用通用知识写作:勾选后跳过素材检索阶段(含素材确认暂停点)。默认关。 */ skipResearch: boolean; setSkipResearch: (v: boolean) => void; @@ -75,7 +75,7 @@ export function WritingFormProvider({ initialDocumentIds, }: { children: ReactNode; - initialMaterialSource?: 'general' | 'notebook'; + initialMaterialSource?: 'general' | 'knowledge_base' | 'notebook'; initialNotebookId?: number | null; initialDocumentIds?: number[]; }) { @@ -88,7 +88,7 @@ export function WritingFormProvider({ const [audience, setAudience] = useState('普通读者'); const [strictMode, setStrictMode] = useState(false); const [addReferences, setAddReferences] = useState(true); - const [materialSource, setMaterialSource] = useState<'general' | 'notebook'>(initialMaterialSource ?? 'general'); + const [materialSource, setMaterialSource] = useState<'general' | 'knowledge_base' | 'notebook'>(initialMaterialSource ?? 'general'); const [skipResearch, setSkipResearch] = useState(false); const [selectedNotebookId, setSelectedNotebookId] = useState(initialNotebookId ?? null); const [selectedDocumentIds, setSelectedDocumentIds] = useState(initialDocumentIds ?? []); @@ -105,8 +105,10 @@ export function WritingFormProvider({ if (payload.target_audience?.trim()) setAudience(payload.target_audience.trim()); if (payload.writing_mode === 'strict') setStrictMode(true); else if (payload.writing_mode === 'loose') setStrictMode(false); - // 旧值 skill / knowledge_base 已合并为通用检索 general - if (payload.material_source === 'skill' || payload.material_source === 'knowledge_base' || payload.material_source === 'general') { + // knowledge_base=知识库检索(直连内网 ES)保留;旧值 skill 归一为通用检索 general + if (payload.material_source === 'knowledge_base') { + setMaterialSource('knowledge_base'); + } else if (payload.material_source === 'skill' || payload.material_source === 'general') { setMaterialSource('general'); } if (payload.outline?.trim()) { diff --git a/frontend-web/src/open-canvas/types/ai-writing.ts b/frontend-web/src/open-canvas/types/ai-writing.ts index 82c245a8..dabafb9a 100644 --- a/frontend-web/src/open-canvas/types/ai-writing.ts +++ b/frontend-web/src/open-canvas/types/ai-writing.ts @@ -265,8 +265,9 @@ export interface AIWritingRequest { writingMode: "strict" | "loose"; /** 是否在成稿里加参考文献(正文 [n] 角标 + 文末「参考文献」列表,像论文)。默认 true。 */ addReferences?: boolean; - /** 检索类型:general=通用检索(素材收集专家按配置技能检索,默认知识库检索技能)/ notebook=我的空间 */ - materialSource: "general" | "notebook"; + /** 检索类型:general=通用检索(素材收集专家按配置技能检索,默认知识库检索技能)/ + * knowledge_base=知识库检索(直连内网知识库 ES 接口,不走技能编排)/ notebook=我的空间 */ + materialSource: "general" | "knowledge_base" | "notebook"; /** 不收集素材,直接用通用知识写作:勾选后跳过整个素材检索流程(含素材确认暂停点), * 直接进入大纲规划;后端强制 loose 写作模式。默认 false。 */ skipResearch?: boolean; diff --git a/offline-backend-20260512/backend/CLAUDE.md b/offline-backend-20260512/backend/CLAUDE.md index eab65988..fbfd72cd 100644 --- a/offline-backend-20260512/backend/CLAUDE.md +++ b/offline-backend-20260512/backend/CLAUDE.md @@ -273,7 +273,7 @@ The AI-writing graph (`packages/harness/deerflow/agents/ai_writing/`) has four s Seeding mirrors the roundtable pattern: verified `config.yaml` + `SOUL.md` ship in `app/gateway/routers/_ai_writing_seed_assets//`; `_ai_writing_seed.py::ensure_ai_writing_functional_agents()` copies them to `.deer-flow/agents/` when missing (never overwrites local edits), called from the startup lifespan (before `_sync_legacy_agents`, so the agents appear in `/api/agents` on first boot) and self-heals from `GET /api/ai-writing/sessions` + `GET /api/ai-writing/article-types`. Tests: `tests/test_ai_writing_seed.py`, `tests/test_ai_writing_agent_runner.py`. -**Skill-driven retrieval (检索类型).** `material_source` has exactly two values: `general` (通用检索, default) and `notebook` (我的空间); legacy `knowledge_base`/`skill` are normalized to `general` by the researcher node. General retrieval is orchestrated from the **skills configured on the `ai-writing-researcher` agent** (`config.yaml → skills`, editable from the agent management page): the built-in `knowledge-base-search` skill (知识库检索) runs the native keyword fan-out web/intranet search (the old default path), while any other configured skill searches with a `description`-targeted query; skills run in configured order with early-stop at `max_materials`, and an empty/unresolvable skills config falls back to the built-in knowledge search so retrieval always works. The skill itself is seeded from `_ai_writing_seed_assets/skills/knowledge-base-search/SKILL.md` into `skills/public/` (never overwrites), and a pre-existing researcher `config.yaml` lacking the `skills` key is patched in place with the default (explicit `skills: []` is respected). **PAUSE-1 input append flow**: when the user types natural language into the material-confirm input (`re_search`/legacy `enable_skill_search` + `user_query`), the node matches the most relevant configured skill via `SkillPicker(candidates=…)` (skipped when only one skill is configured), searches with the user's words, and **appends** the new materials to the existing package (URL-dedup, original order preserved, no LLM re-rank/truncation, 100-item hard cap). **Skill-failure fault tolerance**: a configured skill that times out / raises / has all its keyword searches fail (vs. legitimately returning 0 results) no longer just silently moves on — the researcher node emits a `skill_search_step` of type `skill_error` (carrying the error `reason`), and if the configured skills collected **no** new materials at all it runs a `fallback` pass over other available skills (`_fallback_candidate_skills`: the built-in `knowledge-base-search` native path first, then other enabled catalog skills not yet tried) instead of erroring out. The frontend `SkillStepsCard` renders `skill_error` (rose) and `fallback` (amber) so the timeline shows "技能报错 → 改用其他技能搜集". Tests: `tests/test_ai_writing_material_source.py`. +**Skill-driven retrieval (检索类型).** `material_source` has three values: `general` (通用检索, default), `knowledge_base` (知识库检索), and `notebook` (我的空间); legacy `skill` is normalized to `general` by the researcher node. **`knowledge_base` 直连内网 ES 接口** — it bypasses skill orchestration entirely and calls `IntranetSearchProvider` over `ai_writing.intranet_search_url` (concurrent over the generated keywords; `intranet_knowledge_base`/`intranet_search_timeout` apply); an unconfigured url → no materials + a `skill_error` notice. This is the "弱模型识别不了技能" escape hatch — the old no-skill retrieval path restored as an explicit option (weak models like deepseek-chat often fail to invoke configured skills). Tests: `tests/test_ai_writing_knowledge_base.py`. General retrieval is orchestrated from the **skills configured on the `ai-writing-researcher` agent** (`config.yaml → skills`, editable from the agent management page): the built-in `knowledge-base-search` skill (知识库检索) runs the native keyword fan-out web/intranet search (the old default path), while any other configured skill searches with a `description`-targeted query; skills run in configured order with early-stop at `max_materials`, and an empty/unresolvable skills config falls back to the built-in knowledge search so retrieval always works. The skill itself is seeded from `_ai_writing_seed_assets/skills/knowledge-base-search/SKILL.md` into `skills/public/` (never overwrites), and a pre-existing researcher `config.yaml` lacking the `skills` key is patched in place with the default (explicit `skills: []` is respected). **PAUSE-1 input append flow**: when the user types natural language into the material-confirm input (`re_search`/legacy `enable_skill_search` + `user_query`), the node matches the most relevant configured skill via `SkillPicker(candidates=…)` (skipped when only one skill is configured), searches with the user's words, and **appends** the new materials to the existing package (URL-dedup, original order preserved, no LLM re-rank/truncation, 100-item hard cap). **Skill-failure fault tolerance**: a configured skill that times out / raises / has all its keyword searches fail (vs. legitimately returning 0 results) no longer just silently moves on — the researcher node emits a `skill_search_step` of type `skill_error` (carrying the error `reason`), and if the configured skills collected **no** new materials at all it runs a `fallback` pass over other available skills (`_fallback_candidate_skills`: the built-in `knowledge-base-search` native path first, then other enabled catalog skills not yet tried) instead of erroring out. The frontend `SkillStepsCard` renders `skill_error` (rose) and `fallback` (amber) so the timeline shows "技能报错 → 改用其他技能搜集". Tests: `tests/test_ai_writing_material_source.py`. **Skill-call timeout** is hardcoded **300s (5 min)** — `researcher.py` `_SKILL_SEARCH_TIMEOUT_SECONDS` (per-skill wrapper) and `_skill_agent.py` `_REAL_AGENT_TIMEOUT_SECONDS` (whole real-agent skill run). The intranet ES fallback (`IntranetSearchProvider`) gets a longer **600s (10 min)** default (`intranet_stub.py`; overridable via `ai_writing.intranet_search_timeout`) — that interface is the slow one, so our own fallback timeout is generous to avoid being blamed for "检不出". diff --git a/offline-backend-20260512/backend/packages/harness/deerflow/agents/ai_writing/nodes/researcher.py b/offline-backend-20260512/backend/packages/harness/deerflow/agents/ai_writing/nodes/researcher.py index c5790883..5ce92152 100644 --- a/offline-backend-20260512/backend/packages/harness/deerflow/agents/ai_writing/nodes/researcher.py +++ b/offline-backend-20260512/backend/packages/harness/deerflow/agents/ai_writing/nodes/researcher.py @@ -1,12 +1,15 @@ """素材收集专家节点:关键词提取 → 配置技能编排检索(含笔记) → 相关度排序。 -检索类型(material_source)只有两种: +检索类型(material_source)有三种: - ``general``(通用检索,默认):按素材收集专家 agent(ai-writing-researcher) config.yaml 配置的技能顺序编排检索。内置「知识库检索」技能 (knowledge-base-search)走原生 web/intranet 关键词并发检索;其它技能用 其 description 生成定向 query 后调真实 provider 检索。 + - ``knowledge_base``(知识库检索):**直连内网知识库 ES 接口** + (``ai_writing.intranet_search_url`` 配的 ``IntranetSearchProvider``), + 不编排任何技能、也不跑通用 provider。未配置接口地址时本次无素材并给出告警。 - ``notebook``(我的空间):仅用笔记 API 素材。 -旧值 ``knowledge_base`` / ``skill`` 一律按 ``general`` 兼容处理。 +旧值 ``skill`` 仍按 ``general`` 兼容处理。 PAUSE-1 素材确认卡的单输入框:用户用自然语言描述想补充检索的内容 (如「检索 A 的数据」)时,让模型从已配置技能中按相关度匹配,逐个检索, @@ -414,9 +417,10 @@ async def researcher_node(state: AIWritingState, config: RunnableConfig) -> dict if requested_append_count is not None: effective_user_query = residual_topic or intent # 用户在写作表单选择的检索类型:general(通用检索,按 agent 配置技能编排)/ - # notebook(我的空间)。旧值 knowledge_base / skill 一律按 general 兼容。 + # knowledge_base(知识库检索,直连内网 ES 接口)/ notebook(我的空间)。 + # 旧值 skill 一律按 general 兼容。 raw_source = (state.get("material_source") or "general").strip() - material_source = "notebook" if raw_source == "notebook" else "general" + material_source = raw_source if raw_source in ("notebook", "knowledge_base") else "general" # 用户指定的检索关键词数量(1~10),决定生成多少个检索词、检索多少个方向 keyword_count = _resolve_keyword_count(state.get("keyword_count")) @@ -560,6 +564,58 @@ async def researcher_node(state: AIWritingState, config: RunnableConfig) -> dict # 用户在表单选了「我的空间」作为检索类型 → 跳过技能编排, # 仅使用 Step 1.5 已拉取的 notebook_materials。 _emit(f"仅使用笔记素材,跳过技能检索({len(notebook_materials)} 条)") + elif material_source == "knowledge_base": + # ── 知识库检索:直连内网 ES 接口 ── + # 用户在表单选了「知识库检索」→ 跳过技能编排、跳过通用 provider, + # 直接调 config.yaml 配的 ai_writing.intranet_search_url 内网知识库 ES 接口 + # (IntranetSearchProvider)对检索词并发检索。未配置地址 → 无素材 + 告警。 + intranet_url = (ai_writing_config.get("intranet_search_url") or "").strip() + if not intranet_url: + _emit("未配置内网知识库检索接口(ai_writing.intranet_search_url),本次未检索到素材") + search_errors.append("未配置 ai_writing.intranet_search_url,知识库检索不可用") + _emit_skill_step({ + "type": "skill_error", + "message": "「知识库检索」未配置内网接口地址(ai_writing.intranet_search_url),无法检索", + "skill_name": KNOWLEDGE_SEARCH_SKILL_NAME, + "reason": "intranet_search_url 为空", + }) + else: + from ..search.intranet_stub import IntranetSearchProvider + + provider = IntranetSearchProvider( + base_url=intranet_url, + knowledge_base_name=ai_writing_config.get("intranet_knowledge_base", "samples"), + # 内网慢检索超时可在 config.yaml 的 ai_writing.intranet_search_timeout 调大,默认 600s。 + timeout=ai_writing_config.get("intranet_search_timeout", 600), + ) + # 用户输入框追加(is_user_query_search)时 keywords 已是 [用户原话],全部检索; + # 首次检索按 keyword_count 截断检索词。 + search_keywords = keywords if is_user_query_search else keywords[:keyword_count] + total = len(search_keywords) + per_keyword = _per_keyword_limit(max_materials, total) + _emit(f"知识库检索:直连内网接口检索 {total} 个方向…") + _emit_skill_step({ + "type": "invoke_skill", + "message": f"使用「{_KNOWLEDGE_SKILL_DISPLAY}」直连内网接口检索 {total} 个方向:{('、'.join(search_keywords[:3]))[:60]}", + "skill_name": KNOWLEDGE_SEARCH_SKILL_NAME, + }) + gathered = await asyncio.gather( + *[provider.search(kw, max_results=per_keyword) for kw in search_keywords], + return_exceptions=True, + ) + for results in gathered: + if isinstance(results, Exception): + logger.warning("[knowledge-base] search failed: %s", results) + search_errors.append(f"{type(results).__name__}: {results}") + continue + new_results.extend(results or []) + search_errors.extend(getattr(provider, "errors", [])) + _emit_skill_step({ + "type": "skill_result", + "message": f"「{_KNOWLEDGE_SKILL_DISPLAY}」(内网接口)检索到 {len(new_results)} 条素材", + "skill_name": KNOWLEDGE_SEARCH_SKILL_NAME, + "matched_count": len(new_results), + }) elif is_append_only: # ── 兼容旧版追加关键词模式 ── # 直接对用户给的关键词做原生并发检索(不走技能编排),结果追加到旧素材。 diff --git a/offline-backend-20260512/backend/packages/harness/deerflow/agents/ai_writing/state.py b/offline-backend-20260512/backend/packages/harness/deerflow/agents/ai_writing/state.py index 71156c0f..ebceca9f 100644 --- a/offline-backend-20260512/backend/packages/harness/deerflow/agents/ai_writing/state.py +++ b/offline-backend-20260512/backend/packages/harness/deerflow/agents/ai_writing/state.py @@ -141,8 +141,9 @@ class AIWritingState(TypedDict): # 是否在成稿里加参考文献:正文引用素材处加角标 [n],文末按出现顺序生成「参考文献」列表(像论文)。 add_references: bool # 检索类型:general=通用检索(按素材收集专家 agent 配置的技能编排,默认)/ - # notebook=我的空间(仅笔记检索)。旧值 knowledge_base / skill 由 researcher - # 节点按 general 兼容处理。 + # knowledge_base=知识库检索(直连 ai_writing.intranet_search_url 内网 ES 接口, + # 不走技能编排——弱模型识别不了技能时用这条)/ notebook=我的空间(仅笔记检索)。 + # 旧值 skill 由 researcher 节点按 general 兼容处理。 material_source: str # 跳过素材收集:用户在初始表单勾选「不收集素材,直接用通用知识写作」时为 True。 # researcher 节点在**首次**进入(无任何 pause 干预)时短路,跳过整个检索流程直接 diff --git a/offline-backend-20260512/backend/tests/test_ai_writing_knowledge_base.py b/offline-backend-20260512/backend/tests/test_ai_writing_knowledge_base.py new file mode 100644 index 00000000..99fa41b0 --- /dev/null +++ b/offline-backend-20260512/backend/tests/test_ai_writing_knowledge_base.py @@ -0,0 +1,105 @@ +"""researcher_node:检索类型 `knowledge_base`(知识库检索)= 直连内网 ES 接口。 + +弱模型识别不了技能时用这条路:不编排任何技能、不跑通用 provider, +直接调 ai_writing.intranet_search_url 内网知识库 ES 接口检索。 +""" +from __future__ import annotations + +from types import SimpleNamespace + +import pytest + +from deerflow.agents.ai_writing.nodes import researcher as R +from deerflow.agents.ai_writing.search.base import SearchResult + + +class _FakeIntranet: + instances: list = [] + + def __init__(self, **kw): + self.errors = [] + self.raw_responses = [] + self.kw = kw + _FakeIntranet.instances.append(self) + + async def search(self, query, max_results=5, **_): + return [SearchResult( + title=f"内网-{query}", content="内网正文", source="ES", + published_at="", url=f"http://es/{query}", source_type="intranet", + )] + + +class _SkillProviderShouldNotRun: + """knowledge_base 模式不应触碰通用 provider —— 调到就让测试爆。""" + errors: list = [] + raw_responses: list = [] + + async def search(self, query, max_results=5, **_): # pragma: no cover - 不应被调用 + raise AssertionError("knowledge_base 模式不应调用通用 provider / 技能检索") + + +def _patch(monkeypatch, intranet_url="http://es/api"): + _FakeIntranet.instances = [] + cfg = { + "max_materials": 20, + "intranet_search_url": intranet_url, + "intranet_knowledge_base": "samples", + } + monkeypatch.setattr(R, "get_ai_writing_config", lambda: cfg) + monkeypatch.setattr(R, "use_builtin_agent", lambda *_: False) + monkeypatch.setattr(R, "safe_get_stream_writer", lambda: (lambda *a, **k: None)) + monkeypatch.setattr(R, "use_skill_search_agent", lambda: False) + + async def fake_llm_json(*a, **k): + return {"keywords": ["特朗普竞选"]} + + monkeypatch.setattr(R, "llm_json", fake_llm_json) + # knowledge_base 模式不该加载/编排技能,但仍打桩以防意外路径 + monkeypatch.setattr(R, "_load_configured_skills", + lambda: [SimpleNamespace(name="knowledge-search-v2", description="内网检索")]) + monkeypatch.setattr(R, "get_search_provider", lambda _cfg: _SkillProviderShouldNotRun()) + monkeypatch.setattr( + "deerflow.agents.ai_writing.search.intranet_stub.IntranetSearchProvider", + _FakeIntranet, + ) + + +def _state(material_source="knowledge_base"): + return { + "user_intent": "分析特朗普近期动向", + "article_type": "政治分析", + "target_audience": "普通读者", + "keyword_count": 1, + "material_source": material_source, + } + + +@pytest.mark.asyncio +async def test_knowledge_base_hits_intranet_directly(monkeypatch): + _patch(monkeypatch) + out = await R.researcher_node(_state(), {"configurable": {}}) + mats = out["material_package"]["materials"] + assert mats, "知识库检索应返回内网素材" + assert all(m["source_type"] == "intranet" for m in mats) + assert mats[0]["title"] == "内网-特朗普竞选" + assert _FakeIntranet.instances, "应实例化 IntranetSearchProvider 直连内网接口" + # 走素材确认暂停点 + assert out["status"] == "awaiting_material_confirm" + + +@pytest.mark.asyncio +async def test_knowledge_base_no_url_empty(monkeypatch): + """未配置内网接口地址:无素材,且不实例化 provider。""" + _patch(monkeypatch, intranet_url="") + out = await R.researcher_node(_state(), {"configurable": {}}) + assert out["material_package"]["materials"] == [] + assert _FakeIntranet.instances == [], "无地址时不应实例化内网 provider" + + +@pytest.mark.asyncio +async def test_knowledge_base_does_not_orchestrate_skills(monkeypatch): + """knowledge_base 不编排技能:通用 provider 一旦被调用就会 raise。""" + _patch(monkeypatch) + # 不抛异常即证明没走 _SkillProviderShouldNotRun + out = await R.researcher_node(_state(), {"configurable": {}}) + assert out["material_package"]["materials"] From abf97cdc7803f4cbe251914ab02f301c6ade3f59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=A3=E5=AE=8F=E5=87=AF?= Date: Fri, 26 Jun 2026 14:35:45 +0800 Subject: [PATCH 3/3] =?UTF-8?q?feat(=E5=A4=A7=E5=B1=8F=E7=BB=98=E5=88=B6):?= =?UTF-8?q?=20=E6=88=98=E6=83=85=E5=A4=A7=E5=B1=8F=E9=9A=90=E8=97=8F?= =?UTF-8?q?=E9=A1=B6=E9=83=A8=E6=A0=87=E9=A2=98=E5=8C=BA=EF=BC=8C=E5=8F=AA?= =?UTF-8?q?=E4=BF=9D=E7=95=99=E5=AF=BC=E8=88=AA=20Tab?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DashboardApp 顶部 Header(标题+副标题+生成时间)在 usingPages 模式下整块隐藏, dashboard-agent 战情大屏直接从导航 Tab 起;会商 Step3 大屏行为不变。 Co-Authored-By: Claude Opus 4.8 (1M context) --- frontend-web/.env.development | 2 +- .../dashboard/DashboardApp.tsx | 34 +++++++++---------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/frontend-web/.env.development b/frontend-web/.env.development index 3837c075..ac6db962 100644 --- a/frontend-web/.env.development +++ b/frontend-web/.env.development @@ -5,7 +5,7 @@ VITE_USE_REAL_DATA=true # 任务详情(登录深链 cop-task-detail)数据源:默认真实接口;改成 true 走本地假数据(consumer 外网不可达时调试用)。 -VITE_MOCK_COP_TASK_DETAIL=true +VITE_MOCK_COP_TASK_DETAIL=flase # 研判情报报告(大屏绘制智能体深链 selectSqReport)数据源:true 走本地样例假数据(真实接口未就绪时调试用);联调通过后置 false。 VITE_MOCK_SQ_REPORT=true diff --git a/frontend-web/src/roundtable-planning/dashboard/DashboardApp.tsx b/frontend-web/src/roundtable-planning/dashboard/DashboardApp.tsx index c636df23..3b2046c9 100644 --- a/frontend-web/src/roundtable-planning/dashboard/DashboardApp.tsx +++ b/frontend-web/src/roundtable-planning/dashboard/DashboardApp.tsx @@ -86,31 +86,31 @@ export function DashboardApp({
- {/* Header */} -
-
-
-

- {data.meta.title} -

+ {/* Header(标题 + 副标题 + 生成时间)。战情多页(dashboard-agent 战情大屏)隐藏整块标题区, + 只保留下方导航 Tab;会商 Step3 大屏照常展示。 */} + {!usingPages && ( +
+
+
+

+ {data.meta.title} +

+
+ {data.meta.subtitle && ( +

+ {data.meta.subtitle} +

+ )}
- {data.meta.subtitle && ( -

- {data.meta.subtitle} -

- )} -
- {/* 战情多页(dashboard-agent)不展示「生成于」时间标签;会商 Step3 大屏保留。 */} - {!usingPages && (
生成于 {data.meta.generatedAt}
- )} -
+ + )} {/* 导航 Tab */}