dknowc-dsh 2.0.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -8
- package/package.json +3 -3
- package/skills/dknowc-official-doc-writer/README.md +24 -11
- package/skills/dknowc-official-doc-writer/SKILL.md +43 -36
- package/skills/dknowc-official-doc-writer/reference/fact_discipline.md +2 -0
- package/skills/dknowc-official-doc-writer/reference/material_usage_guidance.md +1 -1
- package/skills/dknowc-official-doc-writer/reference/onboarding_scripts.md +42 -5
- package/skills/dknowc-official-doc-writer/reference/output_guide.md +4 -4
- package/skills/dknowc-official-doc-writer/reference/research_notes.md +6 -2
- package/skills/dknowc-official-doc-writer/reference/review_checklist.md +11 -11
- package/skills/dknowc-official-doc-writer/reference/revision_workflow.md +4 -4
- package/skills/dknowc-official-doc-writer/reference/sample_search_result.md +1 -1
- package/skills/dknowc-official-doc-writer/reference/sample_trace_report.html +387 -430
- package/skills/dknowc-official-doc-writer/reference/search_guide.md +13 -13
- package/skills/dknowc-official-doc-writer/reference/search_intro.md +2 -2
- package/skills/dknowc-official-doc-writer/reference/search_policy.md +5 -5
- package/skills/dknowc-official-doc-writer/reference/task_router.md +77 -34
- package/skills/dknowc-official-doc-writer/scripts/api_key.py +1 -1
- package/skills/dknowc-official-doc-writer/scripts/attribution.py +5 -4
- package/skills/dknowc-official-doc-writer/scripts/build_trace_json.py +16 -3
- package/skills/dknowc-official-doc-writer/scripts/check_materials.py +63 -31
- package/skills/dknowc-official-doc-writer/scripts/deep_convert.py +27 -4
- package/skills/dknowc-official-doc-writer/scripts/deep_query.py +2 -2
- package/skills/dknowc-official-doc-writer/scripts/dkag_search.py +6 -3
- package/skills/dknowc-official-doc-writer/scripts/extract_reference.py +6 -6
- package/skills/dknowc-official-doc-writer/scripts/format_document.py +8 -8
- package/skills/dknowc-official-doc-writer/scripts/initialize.py +1 -1
- package/skills/dknowc-official-doc-writer/scripts/mcp_convert.py +1 -1
- package/skills/dknowc-official-doc-writer/scripts/merge_search_results.py +103 -3
- package/skills/dknowc-official-doc-writer/scripts/outline_reference.py +1 -1
- package/skills/dknowc-official-doc-writer/scripts/prose_lint.py +1 -1
- package/skills/dknowc-official-doc-writer/scripts/register.mjs +173 -21
- package/skills/dknowc-official-doc-writer/scripts/render_trace_html.py +293 -263
- package/skills/dknowc-official-doc-writer/scripts/review_document.py +1 -1
- package/skills/dknowc-official-doc-writer/scripts/source_note_html.py +26 -64
- package/skills/dknowc-official-doc-writer/scripts/template_generator.py +2 -2
- package/skills/dknowc-ppt-assistant/README.md +11 -13
- package/skills/dknowc-ppt-assistant/SKILL.md +12 -12
- package/skills/dknowc-ppt-assistant/references/material_usage.md +2 -2
- package/skills/dknowc-ppt-assistant/references/onboarding_scripts.md +44 -15
- package/skills/dknowc-ppt-assistant/scripts/attribution.py +4 -3
- package/skills/dknowc-ppt-assistant/scripts/initialize.py +2 -2
- package/skills/dknowc-ppt-assistant/scripts/preview_slide_html.py +2 -2
- package/skills/dknowc-ppt-assistant/scripts/register_key.mjs +202 -30
- package/skills/dknowc-ppt-assistant/scripts/render_trace_html.py +126 -116
- package/skills/dknowc-ppt-assistant/scripts/trusted_search.py +2 -2
- package/skills/dknowc-ppt-assistant/workflows/generate-pptx.md +24 -21
- package/skills/dknowc-trusted-search/README.md +11 -12
- package/skills/dknowc-trusted-search/SKILL.md +52 -44
- package/skills/dknowc-trusted-search/reference/onboarding_scripts.md +35 -6
- package/skills/dknowc-trusted-search/resources/echarts.custom.min.js +48 -0
- package/skills/dknowc-trusted-search/scripts/attribution.py +5 -5
- package/skills/dknowc-trusted-search/scripts/chart_embed.py +1 -1
- package/skills/dknowc-trusted-search/scripts/deep_convert.py +124 -0
- package/skills/dknowc-trusted-search/scripts/deep_query.py +12 -2
- package/skills/dknowc-trusted-search/scripts/initialize.py +4 -4
- package/skills/dknowc-trusted-search/scripts/mcp_convert.py +11 -2
- package/skills/dknowc-trusted-search/scripts/merge_search_results.py +176 -16
- package/skills/dknowc-trusted-search/scripts/register_key.mjs +206 -38
- package/skills/dknowc-trusted-search/scripts/render_trace_html.py +389 -344
- package/skills/dknowc-trusted-search/scripts/trusted_search.py +10 -3
- package/src/index.js +3 -3
|
@@ -11,10 +11,11 @@
|
|
|
11
11
|
- 过程回顾条:检索 → 入库 → 逐条比对 → 核验完成(静态回放,数字全部真实计算)
|
|
12
12
|
- 核验报告视图(默认):核验报告单 + 正文文档流(章节标题 + 句后引文胶囊,点击原地展开溯源卡)
|
|
13
13
|
- 知识专库视图(全屏):大搜索 + 热词(真实计算)+ 检索分组 tabs + 来源文章卡
|
|
14
|
-
-
|
|
15
|
-
|
|
14
|
+
- 链接给出方式:接口返回的原文链接**原样进报告**(不做连通性检测、不隐藏);
|
|
15
|
+
接口提供存档快照(screenShotPath)时作为**附加回看入口**与原文链接并存
|
|
16
|
+
(路径容错补 /A/、纯本地格式校验)
|
|
16
17
|
|
|
17
|
-
PPT
|
|
18
|
+
PPT 特有口径(与公文写作版本的既定差异):
|
|
18
19
|
- 提醒制:数据缺口(缺原文链接/缺摘录)不判不通过、指标恒绿附温和提醒;只有无素材/
|
|
19
20
|
正文无角标/角标未绑定三种真实错误才判不通过
|
|
20
21
|
- 双版 stage:提纲版(事前核验)与成稿版(事后溯源)同脚本同形式,标题与身份章带版本后缀
|
|
@@ -29,13 +30,10 @@ PPT 特有口径(与公文写作的差异,均为产品决策):
|
|
|
29
30
|
from __future__ import annotations
|
|
30
31
|
|
|
31
32
|
import argparse
|
|
32
|
-
import concurrent.futures
|
|
33
33
|
import html
|
|
34
34
|
import json
|
|
35
35
|
import re
|
|
36
36
|
import sys
|
|
37
|
-
import urllib.error
|
|
38
|
-
import urllib.request
|
|
39
37
|
from datetime import datetime
|
|
40
38
|
from pathlib import Path
|
|
41
39
|
from typing import Any, Dict, List, Optional, Tuple
|
|
@@ -339,17 +337,17 @@ def source_from_article(item: Dict[str, Any], index: int, segment: Optional[Dict
|
|
|
339
337
|
source["used"] = item.get("已引用", item.get("used", True))
|
|
340
338
|
if not isinstance(source["used"], bool):
|
|
341
339
|
source["used"] = True
|
|
342
|
-
#
|
|
343
|
-
#
|
|
340
|
+
# 存档快照(接口 screenShotPath):**附加回看入口**,与原文链接并存展示。
|
|
341
|
+
# 2026-10-08 起不做链接连通性检测(链接原样给出):接口返回的链接
|
|
342
|
+
# 原样进报告,"打不开"不再由脚本判定、也不隐藏链接。
|
|
344
343
|
source["snapshot"] = first_str(item.get("快照链接"), item.get("snapshot"), item.get("screenShotPath"))
|
|
345
|
-
source["link_dead"] = item.get("链接失效") is True or item.get("link_dead") is True
|
|
346
344
|
# 发布日期可信度(实测:「高」=模型治理入库、标题模型精抽;「较高」=门户抓取、标题规则提取)
|
|
347
345
|
source["conf"] = first_str(item.get("发布日期可信度"), item.get("可信度"), item.get("confidence"))
|
|
348
346
|
key, label = normalize_kind(source["kind"])
|
|
349
347
|
source["type_key"] = key
|
|
350
348
|
source["type_label"] = label
|
|
351
349
|
source["type_css"] = KIND_CATALOG[key][1]
|
|
352
|
-
live_url = bool(source["url"] and source["url"] != "接口未返回")
|
|
350
|
+
live_url = bool(source["url"] and source["url"] != "接口未返回")
|
|
353
351
|
source["has_link"] = live_url or bool(source["policy_url"]) or bool(source["snapshot"])
|
|
354
352
|
# 核验状态只看摘录可比对;原文链接死活与快照有无是回看通道问题,不影响核验结论
|
|
355
353
|
# (PPT 提醒制:数据缺口不判不通过,卡片与指标行温和提醒)
|
|
@@ -411,7 +409,27 @@ def collect_raw_articles(payload: Dict[str, Any]) -> List[Dict[str, Any]]:
|
|
|
411
409
|
return raws
|
|
412
410
|
|
|
413
411
|
|
|
414
|
-
def
|
|
412
|
+
def _dedupe_key(source: Dict[str, Any]) -> tuple:
|
|
413
|
+
"""归一去重键:标题 + 原网址(对齐公文 3.7.8 / 可信搜索 1.4.4 的同款修复)。
|
|
414
|
+
|
|
415
|
+
旧键含 id(材料编号),而 id 要么是位置兜底序号、要么是角标号——同一篇文章被
|
|
416
|
+
多路召回或按段落返回多条片段时,各条 id 不同,含 id 的键**等于从不去重**,
|
|
417
|
+
同名卡片会成批出现(实测《医疗保障法》重复 17 张)。改为:
|
|
418
|
+
标题去空白、URL 去尾斜杠后组键;单边缺失退用其一,均缺失退用摘录前缀
|
|
419
|
+
(避免把"信息都缺"的不同材料并成一张)。
|
|
420
|
+
"""
|
|
421
|
+
title = re.sub(r"\s+", "", str(source.get("title") or ""))
|
|
422
|
+
url = str(source.get("url") or "").strip().rstrip("/")
|
|
423
|
+
if title and url:
|
|
424
|
+
return ("t+u", title, url)
|
|
425
|
+
if title:
|
|
426
|
+
return ("t", title)
|
|
427
|
+
if url:
|
|
428
|
+
return ("u", url)
|
|
429
|
+
return ("x", re.sub(r"\s+", "", (source.get("excerpt") or "")[:80]))
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
def extract_sources(payload: Dict[str, Any]) -> List[Dict[str, Any]]:
|
|
415
433
|
raw_sources: List[Dict[str, Any]] = []
|
|
416
434
|
raw_sources.extend(extract_reference_materials(payload))
|
|
417
435
|
raw_sources.extend(extract_articles_from_search(payload))
|
|
@@ -422,30 +440,39 @@ def extract_sources(payload: Dict[str, Any]) -> List[Dict[str, str]]:
|
|
|
422
440
|
if isinstance(recalled, list):
|
|
423
441
|
raw_sources.extend({**{"已引用": False}, **x} for x in recalled if isinstance(x, dict))
|
|
424
442
|
|
|
425
|
-
sources: List[Dict[str,
|
|
426
|
-
|
|
443
|
+
sources: List[Dict[str, Any]] = []
|
|
444
|
+
by_key: Dict[tuple, Dict[str, Any]] = {}
|
|
427
445
|
for item in raw_sources:
|
|
428
|
-
# 一篇材料一张卡:段落合并为摘录(paragraph_text
|
|
429
|
-
# 素材清单与正文角标按「材料」粒度一一对应,拆段会使编号错位。
|
|
446
|
+
# 一篇材料一张卡:段落合并为摘录(paragraph_text 拼接全部段落),不按段落拆卡。
|
|
430
447
|
source = source_from_article(item, len(sources) + 1)
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
448
|
+
key = _dedupe_key(source)
|
|
449
|
+
existing = by_key.get(key)
|
|
450
|
+
if existing is not None:
|
|
451
|
+
# 同文再次出现:**不新建卡**(消除重复卡片),把它的编号并入已有卡——
|
|
452
|
+
# 提纲里同一篇文章可能占多个角标(如 [8] 与 [13]),合并后卡上并列显示
|
|
453
|
+
# 全部编号,正文引用任一编号都能定位到这张卡(既去重、又不产生"未绑定"红项)。
|
|
454
|
+
sid = str(source["id"] or "").strip()
|
|
455
|
+
if sid and sid not in existing["all_ids"]:
|
|
456
|
+
existing["all_ids"].append(sid)
|
|
457
|
+
# 已引用优先:未引用召回与已引用同名同链时,以已引用为准(不留两张卡)
|
|
458
|
+
if source.get("used", True) and not existing.get("used", True):
|
|
459
|
+
existing["used"] = True
|
|
441
460
|
continue
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
source["id"] = str(len(sources) + 1)
|
|
461
|
+
source["all_ids"] = [str(source["id"])] if source.get("id") else []
|
|
462
|
+
by_key[key] = source
|
|
445
463
|
sources.append(source)
|
|
446
464
|
return sources
|
|
447
465
|
|
|
448
466
|
|
|
467
|
+
def collect_material_ids(source: Dict[str, Any]) -> List[str]:
|
|
468
|
+
"""材料的全部编号(主编号 + 同文异号并入的其它编号),用于角标绑定与卡片显示。"""
|
|
469
|
+
ids = [str(i) for i in (source.get("all_ids") or []) if str(i).strip()]
|
|
470
|
+
main = str(source.get("id") or "").strip()
|
|
471
|
+
if main and main not in ids:
|
|
472
|
+
ids.insert(0, main)
|
|
473
|
+
return ids
|
|
474
|
+
|
|
475
|
+
|
|
449
476
|
def extract_answer(payload: Dict[str, Any]) -> str:
|
|
450
477
|
resp = payload.get("resp")
|
|
451
478
|
if isinstance(resp, dict):
|
|
@@ -566,7 +593,9 @@ def compute_verification(answer: str, sources: List[Dict[str, str]], payload: Di
|
|
|
566
593
|
# ② 引用绑定:正文角标与来源卡一一对应(按角标出现次数计,与用户在正文中数到的一致)
|
|
567
594
|
cited = citation_ids(answer)
|
|
568
595
|
all_marks = re.findall(r"\[(\d+)\]", answer)
|
|
569
|
-
source_ids =
|
|
596
|
+
source_ids = set()
|
|
597
|
+
for s in sources:
|
|
598
|
+
source_ids.update(collect_material_ids(s))
|
|
570
599
|
unbound_ids = [cid for cid in cited if cid not in source_ids]
|
|
571
600
|
unbound = [cid for cid in unbound_ids for _ in range(all_marks.count(cid))]
|
|
572
601
|
no_citation = bool(sources) and not cited
|
|
@@ -814,10 +843,13 @@ def parse_answer_blocks(answer: str, valid_ids: set, chip_map: Optional[Dict[str
|
|
|
814
843
|
jb = chip_map.get(cid)
|
|
815
844
|
if not jb:
|
|
816
845
|
return ""
|
|
846
|
+
# 链接原样给出(不做死活检测);无原文链接但有存档快照时,快照作为附加入口
|
|
817
847
|
if jb.get("url"):
|
|
818
|
-
btn_txt = "查看存档全文" if jb.get("dead") else "查看全文"
|
|
819
848
|
link = (f'<a class="jb-src" href="{esc(jb["url"])}" target="_blank" rel="noopener noreferrer">'
|
|
820
|
-
f'{ARROW_SVG}<span
|
|
849
|
+
f'{ARROW_SVG}<span>查看全文</span></a>')
|
|
850
|
+
elif jb.get("snapshot"):
|
|
851
|
+
link = (f'<a class="jb-src" href="{esc(jb["snapshot"])}" target="_blank" rel="noopener noreferrer">'
|
|
852
|
+
f'{ARROW_SVG}<span>查看存档全文</span></a>')
|
|
821
853
|
else:
|
|
822
854
|
link = ""
|
|
823
855
|
# 原文直达区展示标题链(多段分块,各段带链——快速人工核验的核心抓手)
|
|
@@ -979,35 +1011,34 @@ def build_chip_data(sources: List[Dict[str, str]]) -> Dict[str, Dict[str, Any]]:
|
|
|
979
1011
|
原文原段、不截断——块内去重后重复量可控,核对场景下就地读全文。
|
|
980
1012
|
"""
|
|
981
1013
|
chip_map: Dict[str, Dict[str, Any]] = {}
|
|
1014
|
+
material_ids = []
|
|
982
1015
|
for source in sources:
|
|
983
|
-
cid
|
|
1016
|
+
for cid in collect_material_ids(source):
|
|
1017
|
+
material_ids.append((cid, source))
|
|
1018
|
+
for cid, source in material_ids:
|
|
984
1019
|
if cid in chip_map:
|
|
985
1020
|
continue
|
|
986
1021
|
meta_bits = [v for v in [source.get("agency"), source.get("date")] if v and v != "未知来源"]
|
|
987
1022
|
url = source.get("url") if (source.get("url") and source["url"] != "接口未返回") else (source.get("policy_url") or "")
|
|
988
|
-
if source.get("link_dead"):
|
|
989
|
-
url = source.get("snapshot") or ""
|
|
990
1023
|
site_bits = ([source["doc_number"]] if source.get("doc_number") else []) + meta_bits
|
|
991
1024
|
chip_map[cid] = {
|
|
992
1025
|
"title": short(source.get("title") or "未命名来源文章", 30),
|
|
993
1026
|
"site": " · ".join(site_bits) or "来源站点",
|
|
994
1027
|
"url": url,
|
|
995
1028
|
"snapshot": source.get("snapshot") or "",
|
|
996
|
-
"dead": bool(source.get("link_dead")),
|
|
997
1029
|
"excerpt": (source.get("excerpt") or "").strip(),
|
|
998
1030
|
"segments": source.get("segments") or [],
|
|
999
1031
|
}
|
|
1000
1032
|
return chip_map
|
|
1001
1033
|
|
|
1002
1034
|
|
|
1003
|
-
def render_source_links(url: str, policy_url: str = "", snapshot: str = ""
|
|
1004
|
-
"""
|
|
1005
|
-
|
|
1035
|
+
def render_source_links(url: str, policy_url: str = "", snapshot: str = "") -> str:
|
|
1036
|
+
"""链接区:接口返回的链接**原样展示**(不做连通性检测、不隐藏);
|
|
1037
|
+
存档快照作为**附加回看入口**与原文链接并存,文案如实区分不冒充原文。"""
|
|
1006
1038
|
links = []
|
|
1007
|
-
if url and url != "接口未返回"
|
|
1039
|
+
if url and url != "接口未返回":
|
|
1008
1040
|
links.append(f'<a href="{esc(url)}" target="_blank" rel="noopener">查看全文 ↗</a>')
|
|
1009
1041
|
if snapshot:
|
|
1010
|
-
# 有哪个显示哪个:快照统一展示"查看存档全文",不做原文失效的状态解释
|
|
1011
1042
|
links.append(f'<a class="snap" href="{esc(snapshot)}" target="_blank" rel="noopener">查看存档全文 ↗</a>')
|
|
1012
1043
|
if policy_url:
|
|
1013
1044
|
links.append(f'<a href="{esc(policy_url)}" target="_blank" rel="noopener">知识专库原文 ↗</a>')
|
|
@@ -1092,7 +1123,7 @@ def render_verify_panel(v: Dict[str, Any], stage: str = "final") -> str:
|
|
|
1092
1123
|
f'<span class="d">检索 JSON 没写入 self_check(默认查:{esc(default_names)})</span></div>')
|
|
1093
1124
|
|
|
1094
1125
|
# 3.7.2 起「现行效力」提示行移除:该提示对用户无操作价值,policy_count
|
|
1095
|
-
# 保留在计算层不再展示(对齐公文写作 3.7.2
|
|
1126
|
+
# 保留在计算层不再展示(对齐公文写作 3.7.2 口径)。
|
|
1096
1127
|
|
|
1097
1128
|
what = "提纲页面规划" if stage == "outline" else "页面级结论"
|
|
1098
1129
|
return f"""
|
|
@@ -1235,7 +1266,7 @@ def render_source_card(source: Dict[str, str], for_print: bool = False) -> str:
|
|
|
1235
1266
|
reason = "待补原文链接" if not source.get("has_link") else "待补摘录"
|
|
1236
1267
|
vk = f'<span class="sc-vk warn">◐ {reason}</span>'
|
|
1237
1268
|
note_html = ""
|
|
1238
|
-
links = render_source_links(source.get("url"), source.get("policy_url", ""), source.get("snapshot", "")
|
|
1269
|
+
links = render_source_links(source.get("url"), source.get("policy_url", ""), source.get("snapshot", ""))
|
|
1239
1270
|
# 关键性行:有文号(接口字段或合并 JSON)时"文号 · 数据源 · 日期",否则"数据源 · 日期"
|
|
1240
1271
|
meta_parts = [v for v in [source.get("doc_number"), source.get("agency"), source.get("date"), source.get("area")]
|
|
1241
1272
|
if v and v != "未知来源"]
|
|
@@ -1245,8 +1276,12 @@ def render_source_card(source: Dict[str, str], for_print: bool = False) -> str:
|
|
|
1245
1276
|
if source.get("conf") == "高":
|
|
1246
1277
|
conf_badge = ('<span class="sc-conf" title="发布日期可信度:高。内容经模型治理入库,'
|
|
1247
1278
|
'标题为模型从原文动态抽取,非规则提取">高可信</span>')
|
|
1248
|
-
#
|
|
1249
|
-
|
|
1279
|
+
# 已引用材料显示角标编号(同文异号时并列显示全部,如 [8][13]);未引用召回材料显示"未引用"灰标
|
|
1280
|
+
if source.get("used", True):
|
|
1281
|
+
ids = sorted(collect_material_ids(source), key=lambda x: (int(x) if x.isdigit() else 10 ** 9, x))
|
|
1282
|
+
id_html = "".join(f'<span class="sc-id">[{esc(i)}]</span>' for i in ids)
|
|
1283
|
+
else:
|
|
1284
|
+
id_html = '<span class="sc-unused">未引用</span>'
|
|
1250
1285
|
body_html = (f'<div class="sc-head">{id_html}'
|
|
1251
1286
|
f'<span class="sc-type">{esc(source["type_label"])}</span>{conf_badge}{vk}</div>'
|
|
1252
1287
|
f'<h4>{esc(source.get("title"))}</h4>'
|
|
@@ -1258,9 +1293,11 @@ def render_source_card(source: Dict[str, str], for_print: bool = False) -> str:
|
|
|
1258
1293
|
# 打印附录版:无交互属性,避免与专库卡片 id 冲突
|
|
1259
1294
|
return f'<article class="scard print-only {source["type_css"]}">{body_html}</article>'
|
|
1260
1295
|
unused_attr = "" if source.get("used", True) else ' data-unused="1"'
|
|
1296
|
+
all_ids_attr = ",".join(collect_material_ids(source))
|
|
1261
1297
|
return (
|
|
1262
1298
|
f'<article class="scard {source["type_css"]}" id="src-{esc(source["id"])}" data-type="{esc(source["type_key"])}" '
|
|
1263
|
-
f'data-cite-id="{esc(source["id"])}" data-
|
|
1299
|
+
f'data-cite-id="{esc(source["id"])}" data-cite-ids="{esc(all_ids_attr)}" '
|
|
1300
|
+
f'data-search="{esc(source.get("search_key", ""))}"{unused_attr}>{body_html}</article>'
|
|
1264
1301
|
)
|
|
1265
1302
|
|
|
1266
1303
|
|
|
@@ -1428,65 +1465,15 @@ def safe_output_filename(question: str, timestamp: datetime, fallback: str = "dk
|
|
|
1428
1465
|
# 链接活性检测与快照兜底(生成时真实检测,就地改写材料 dict)
|
|
1429
1466
|
# ============================================================
|
|
1430
1467
|
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
连接失败、超时、403、5xx 等一律视为"无法确认"按有效处理——政府站
|
|
1441
|
-
常对脚本请求反爬,凭这些判死会误杀可用链接。
|
|
1442
|
-
"""
|
|
1443
|
-
for method in ("HEAD", "GET"):
|
|
1444
|
-
try:
|
|
1445
|
-
req = urllib.request.Request(
|
|
1446
|
-
url, method=method,
|
|
1447
|
-
headers={"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36"},
|
|
1448
|
-
)
|
|
1449
|
-
with urllib.request.urlopen(req, timeout=timeout) as resp:
|
|
1450
|
-
if resp.status in (404, 410):
|
|
1451
|
-
return False
|
|
1452
|
-
if method == "GET":
|
|
1453
|
-
chunk = resp.read(4096).decode("utf-8", errors="replace")
|
|
1454
|
-
title = re.search(r"<title>(.*?)</title>", chunk, re.I | re.S)
|
|
1455
|
-
text = title.group(1) if title else chunk[:200]
|
|
1456
|
-
lowered = text.lower()
|
|
1457
|
-
return not any(k in text or k in lowered for k in SOFT_404_KEYWORDS)
|
|
1458
|
-
except urllib.error.HTTPError as e:
|
|
1459
|
-
if method == "GET":
|
|
1460
|
-
return e.code not in (404, 410)
|
|
1461
|
-
except Exception:
|
|
1462
|
-
if method == "GET":
|
|
1463
|
-
return True
|
|
1464
|
-
return True
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
def normalize_snapshot_url(url: str) -> str:
|
|
1468
|
-
"""快照路径容错:接口部分返回值缺 /A/ 层级(实测拼接 bug),统一规范化为
|
|
1469
|
-
https://attach.dknowc.cn/snapshot/A/<2位>/<2位>/<哈希>.jpg。"""
|
|
1470
|
-
u = (url or "").strip()
|
|
1471
|
-
if u.startswith("https://attach.dknowc.cn/snapshot/") and "/snapshot/A/" not in u:
|
|
1472
|
-
return u.replace("/snapshot/", "/snapshot/A/", 1)
|
|
1473
|
-
return u
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
def mark_dead_links(articles: List[Dict[str, Any]]) -> int:
|
|
1477
|
-
"""并发检测全部材料的原文链接,404/410(含软 404)的标记 链接失效=True。返回失效数。"""
|
|
1478
|
-
targets = [(i, a) for i, a in enumerate(articles) if (first_str(a.get("源网址"), a.get("sourceUrl"), a.get("source_url"), a.get("原文链接"), a.get("url")) or "").strip()]
|
|
1479
|
-
if not targets:
|
|
1480
|
-
return 0
|
|
1481
|
-
urls = [first_str(a.get("源网址"), a.get("sourceUrl"), a.get("source_url"), a.get("原文链接"), a.get("url")) for _, a in targets]
|
|
1482
|
-
with concurrent.futures.ThreadPoolExecutor(max_workers=8) as pool:
|
|
1483
|
-
alive = dict(zip((i for i, _ in targets), pool.map(check_link_alive, urls)))
|
|
1484
|
-
dead = 0
|
|
1485
|
-
for i, _ in targets:
|
|
1486
|
-
if not alive.get(i, True):
|
|
1487
|
-
articles[i]["链接失效"] = True
|
|
1488
|
-
dead += 1
|
|
1489
|
-
return dead
|
|
1468
|
+
def normalize_snapshot_url(raw: str) -> str:
|
|
1469
|
+
"""快照链接规范化:补全 /A/ 层级;非 attach 域原样返回(由调用方弃用)。"""
|
|
1470
|
+
s = (raw or "").strip()
|
|
1471
|
+
base = "https://attach.dknowc.cn/snapshot/"
|
|
1472
|
+
if s.startswith(base + "A/"):
|
|
1473
|
+
return s
|
|
1474
|
+
if s.startswith(base):
|
|
1475
|
+
return base + "A/" + s[len(base):]
|
|
1476
|
+
return s
|
|
1490
1477
|
|
|
1491
1478
|
|
|
1492
1479
|
def apply_snapshots(articles: List[Dict[str, Any]]) -> Tuple[int, int]:
|
|
@@ -1574,6 +1561,12 @@ a{color:var(--brand)}
|
|
|
1574
1561
|
box-shadow:0 2px 8px rgba(101,18,173,.22)}
|
|
1575
1562
|
.hero h1{margin:0 0 10px;font-size:24px;line-height:1.5;max-width:860px;margin-left:auto;margin-right:auto;color:var(--ink)}
|
|
1576
1563
|
.hero .meta{color:var(--muted);font-size:13px;letter-spacing:.5px}
|
|
1564
|
+
/* 「原问题」行:用户原始需求全文(不能独立使用时最容易被问"这是回答什么的") */
|
|
1565
|
+
.hero-q{display:flex;gap:9px;align-items:flex-start;max-width:860px;margin:2px auto 10px;
|
|
1566
|
+
padding:9px 14px;border:1px dashed var(--tint-bd-strong);border-radius:10px;background:#fff;text-align:left}
|
|
1567
|
+
.hero-q .q-tag{flex:none;font-size:11px;font-weight:800;color:#fff;background:var(--grad);
|
|
1568
|
+
border-radius:5px;padding:1px 8px;margin-top:3px;letter-spacing:1px}
|
|
1569
|
+
.hero-q .q-txt{font-size:13px;line-height:1.75;color:#4b4658;word-break:break-word}
|
|
1577
1570
|
.hero-switch{margin-top:16px;display:flex;justify-content:center}
|
|
1578
1571
|
.hero-switch .view-switch{border-color:#d9c9f4;background:#fff;box-shadow:0 1px 3px rgba(24,20,40,.04)}
|
|
1579
1572
|
.hero-switch .view-switch button{color:#70678a;padding:6px 22px;font-size:13px}
|
|
@@ -1726,13 +1719,13 @@ a.jb-quote{text-decoration:none}
|
|
|
1726
1719
|
.lib-tabs button{border:1px solid var(--line);border-radius:999px;background:#fff;color:var(--muted);
|
|
1727
1720
|
padding:4px 13px;font-size:12.3px;cursor:pointer}
|
|
1728
1721
|
.lib-tabs button.on{background:var(--grad);border-color:var(--brand);color:#fff;font-weight:700}
|
|
1729
|
-
.lib-list{max-width:860px;margin:0 auto;display:grid;grid-template-columns:1fr;gap:14px}
|
|
1722
|
+
.lib-list{max-width:860px;margin:0 auto;display:grid;grid-template-columns:minmax(0,1fr);gap:14px}
|
|
1730
1723
|
.lib-empty{max-width:860px;margin:30px auto;text-align:center;color:var(--muted);font-size:13.5px}
|
|
1731
1724
|
.lib-empty.hide{display:none}
|
|
1732
1725
|
.lib-foot{text-align:center;color:var(--muted);font-size:11.5px;padding:18px 0 0;line-height:1.8}
|
|
1733
1726
|
|
|
1734
1727
|
/* ===== 材料卡 ===== */
|
|
1735
|
-
.scard{border:1px solid var(--line);border-left-width:3px;border-radius:12px;padding:14px 18px;
|
|
1728
|
+
.scard{min-width:0;border:1px solid var(--line);border-left-width:3px;border-radius:12px;padding:14px 18px;
|
|
1736
1729
|
background:#fff;box-shadow:var(--shadow-1);transition:box-shadow .25s}
|
|
1737
1730
|
.scard:hover{box-shadow:var(--shadow-2)}
|
|
1738
1731
|
.scard.pol{border-left-color:var(--policy)}
|
|
@@ -1815,6 +1808,8 @@ body.reading .cite,body.reading .toc,body.reading .p-detail{display:none!importa
|
|
|
1815
1808
|
.jb-name{max-width:calc(100vw - 72px)}
|
|
1816
1809
|
.r-badge{font-size:13.5px;letter-spacing:6px;text-indent:6px;gap:10px}
|
|
1817
1810
|
.hero h1{font-size:18.5px}
|
|
1811
|
+
.hero-q{padding:8px 11px;gap:7px}
|
|
1812
|
+
.hero-q .q-txt{font-size:12.5px}
|
|
1818
1813
|
.hero .meta{font-size:11.5px;line-height:1.7}
|
|
1819
1814
|
.hero-switch .view-switch button{padding:6px 16px;font-size:12.5px}
|
|
1820
1815
|
.process{margin-top:-30px;padding:12px 12px 11px}
|
|
@@ -1836,7 +1831,7 @@ body.reading .cite,body.reading .toc,body.reading .p-detail{display:none!importa
|
|
|
1836
1831
|
-webkit-overflow-scrolling:touch;scrollbar-width:none}
|
|
1837
1832
|
.lib-tabs::-webkit-scrollbar{display:none}
|
|
1838
1833
|
.lib-tabs button{flex:none}
|
|
1839
|
-
.lib-list{grid-template-columns:1fr;gap:10px}
|
|
1834
|
+
.lib-list{grid-template-columns:minmax(0,1fr);gap:10px}
|
|
1840
1835
|
.scard{padding:10px 11px}
|
|
1841
1836
|
.crumb{font-size:11px}
|
|
1842
1837
|
.sc-excerpt{font-size:11.5px}
|
|
@@ -1876,6 +1871,7 @@ body.reading .cite,body.reading .toc,body.reading .p-detail{display:none!importa
|
|
|
1876
1871
|
#view-report{display:block!important}
|
|
1877
1872
|
.app[data-view="library"] #view-report{display:block!important}
|
|
1878
1873
|
.hero{background:none;border:0;color:var(--ink);padding:10px 0 4px}
|
|
1874
|
+
.hero-q{border-color:#bbb;break-inside:avoid}
|
|
1879
1875
|
.hero .meta{color:var(--muted)}
|
|
1880
1876
|
*{-webkit-print-color-adjust:exact;print-color-adjust:exact}
|
|
1881
1877
|
.process{box-shadow:none;margin:6px 0 12px}
|
|
@@ -1900,6 +1896,9 @@ body.reading .cite,body.reading .toc,body.reading .p-detail{display:none!importa
|
|
|
1900
1896
|
body.print-body-only .jb,body.print-body-only .foot{display:none!important}
|
|
1901
1897
|
.print-appendix h3{font-size:15px;color:var(--navy);border-bottom:1px solid #999;padding-bottom:6px;margin:0 0 12px}
|
|
1902
1898
|
.print-appendix .scard{margin-bottom:10px}
|
|
1899
|
+
/* 打印时宽表格贴合页宽(屏幕端靠 .sc-excerpt.rich 横向滚动,纸张上不能滚) */
|
|
1900
|
+
.print-appendix .sc-excerpt.rich,.sc-excerpt.rich{overflow-x:visible}
|
|
1901
|
+
.print-appendix .sc-excerpt.rich table,.sc-excerpt.rich table{width:100%!important;min-width:0}
|
|
1903
1902
|
}
|
|
1904
1903
|
"""
|
|
1905
1904
|
|
|
@@ -2020,8 +2019,12 @@ PAGE_JS = """
|
|
|
2020
2019
|
var cards = $$("#lib-list .scard");
|
|
2021
2020
|
var byId = {};
|
|
2022
2021
|
cards.forEach(function (c) {
|
|
2023
|
-
|
|
2024
|
-
|
|
2022
|
+
/* 同文异号的多编号都指向同一张卡(data-cite-ids),任一编号都能定位 */
|
|
2023
|
+
var ids = (c.getAttribute("data-cite-ids") || c.getAttribute("data-cite-id") || "").split(",");
|
|
2024
|
+
ids.forEach(function (id) {
|
|
2025
|
+
id = (id || "").trim();
|
|
2026
|
+
if (id) byId[id] = c;
|
|
2027
|
+
});
|
|
2025
2028
|
});
|
|
2026
2029
|
|
|
2027
2030
|
/* 移动端底部弹层:正文表述 ↔ 原文原段 对照 + 材料卡 */
|
|
@@ -2245,7 +2248,8 @@ def render_html(payload: Dict[str, Any], title: str, answer_override: str = "",
|
|
|
2245
2248
|
# 未引用判定双通道 = JSON 标记(recalled_materials)∪ 正文角标未引用:
|
|
2246
2249
|
# 进「未引用」分组,不占角标语义,不参与核验统计。
|
|
2247
2250
|
for s in sources:
|
|
2248
|
-
|
|
2251
|
+
# 一篇文章可能有多个编号(同文异号):正文引用任一编号即视为已引用
|
|
2252
|
+
if not any(i in used for i in collect_material_ids(s)):
|
|
2249
2253
|
s["used"] = False
|
|
2250
2254
|
# 3.7.2 起知识专库原始召回存档(kb_zone)移除:并行检索下接口返回的
|
|
2251
2255
|
# knowledgeBase 链接会错乱不可靠,且未引用召回材料已在专库全量展示,
|
|
@@ -2275,6 +2279,14 @@ def render_html(payload: Dict[str, Any], title: str, answer_override: str = "",
|
|
|
2275
2279
|
doc_title, sections = group_sections(blocks)
|
|
2276
2280
|
display_title = doc_title or title
|
|
2277
2281
|
report_label = f"{REPORT_NAME}({stage_label})"
|
|
2282
|
+
# 「原问题」行(2026-10-05 反馈:要加上完整的原问题,否则报告无法独立使用):
|
|
2283
|
+
# **只采信 --question 显式传入的用户原话**,不得用报告/演示标题冒充
|
|
2284
|
+
# (标题是正文首行或文件名的来源,不是用户问的话);未传入时整行不渲染。
|
|
2285
|
+
origin_question = (question_override or "").strip()
|
|
2286
|
+
origin_html = ""
|
|
2287
|
+
if origin_question:
|
|
2288
|
+
origin_html = (f'<div class="hero-q"><span class="q-tag">原问题</span>'
|
|
2289
|
+
f'<span class="q-txt">{esc(origin_question)}</span></div>')
|
|
2278
2290
|
|
|
2279
2291
|
jb_tables_json = json.dumps(jb_tables, ensure_ascii=False).replace("</", "<\\/")
|
|
2280
2292
|
jb_tables_script = (f'<script type="application/json" id="jb-tables">{jb_tables_json}</script>\n'
|
|
@@ -2328,6 +2340,7 @@ def render_html(payload: Dict[str, Any], title: str, answer_override: str = "",
|
|
|
2328
2340
|
<div class="hero">
|
|
2329
2341
|
<div class="r-badge">{esc(report_label)}</div>
|
|
2330
2342
|
<h1>{esc(display_title)}</h1>
|
|
2343
|
+
{origin_html}
|
|
2331
2344
|
<div class="meta">{esc(meta_line)} | 素材来源:深知可信搜索</div>
|
|
2332
2345
|
<div class="hero-switch">
|
|
2333
2346
|
<div class="view-switch" role="tablist" aria-label="视图切换">
|
|
@@ -2380,6 +2393,7 @@ def align_sources_to_answer(answer: str, sources: List[Dict[str, str]]) -> List[
|
|
|
2380
2393
|
if idx >= len(aligned):
|
|
2381
2394
|
break
|
|
2382
2395
|
aligned[idx]["id"] = citation
|
|
2396
|
+
aligned[idx]["all_ids"] = [str(citation)]
|
|
2383
2397
|
aligned[idx]["type_key"] = aligned[idx].get("type_key", "material")
|
|
2384
2398
|
aligned[idx]["type_label"] = aligned[idx].get("type_label", "材料")
|
|
2385
2399
|
aligned[idx]["type_css"] = aligned[idx].get("type_css", "mat")
|
|
@@ -2397,7 +2411,7 @@ def main() -> None:
|
|
|
2397
2411
|
parser.add_argument("--stage", choices=["outline", "final"], default="final",
|
|
2398
2412
|
help="报告版本:outline 提纲版(确认门前事前核验)/ final 成稿版(交付时事后溯源),默认 final。")
|
|
2399
2413
|
parser.add_argument("--skip-link-check", action="store_true",
|
|
2400
|
-
help="
|
|
2414
|
+
help="(已废弃,兼容保留)链接活性检测已于 2026-10-08 整体移除,本参数不再有任何作用")
|
|
2401
2415
|
parser.add_argument("--disable-snapshot", action="store_true",
|
|
2402
2416
|
help="关闭快照兜底展示(默认启用:原文失效时以存档快照回看)")
|
|
2403
2417
|
args = parser.parse_args()
|
|
@@ -2412,12 +2426,8 @@ def main() -> None:
|
|
|
2412
2426
|
question = args.question.strip() or extract_question(unwrap(payload))
|
|
2413
2427
|
unwrapped = unwrap(payload)
|
|
2414
2428
|
|
|
2415
|
-
#
|
|
2429
|
+
# 存档快照预处理(纯本地路径校验,不发网络请求);接口返回的链接原样进报告
|
|
2416
2430
|
raw_articles = collect_raw_articles(unwrapped)
|
|
2417
|
-
if not args.skip_link_check and raw_articles:
|
|
2418
|
-
dead = mark_dead_links(raw_articles)
|
|
2419
|
-
if dead:
|
|
2420
|
-
print(f"链接检测:{dead} 条原文链接已失效(404/410),将改用存档快照或如实标注")
|
|
2421
2431
|
if SNAPSHOT_ENABLED and raw_articles:
|
|
2422
2432
|
fixed, dropped = apply_snapshots(raw_articles)
|
|
2423
2433
|
total_snap = sum(1 for a in raw_articles if (a.get("快照链接") or "").strip())
|
|
@@ -146,8 +146,8 @@ def detect_quota_exhausted(status_code=None, errmsg=None, biz_status=None):
|
|
|
146
146
|
def user_message_for_error(status_code=None, quota_exhausted=False):
|
|
147
147
|
"""给用户的固定话术(Agent 必须原样转述),按错误类型区分。"""
|
|
148
148
|
if quota_exhausted:
|
|
149
|
-
return ("
|
|
150
|
-
"
|
|
149
|
+
return ("检索调不动,很可能是积分用完了:到 " + MAAS_PLATFORM_URL +
|
|
150
|
+
" 看一下积分,完成实名认证可以再领 10 万积分。")
|
|
151
151
|
if status_code == 401:
|
|
152
152
|
return ("访问密钥校验没通过(密钥可能已失效),我重新获取一下密钥;"
|
|
153
153
|
"还不行的话需要重新验证手机号。")
|
|
@@ -50,7 +50,7 @@ python3 {skillDir}/scripts/trusted_search.py "检索问题" --service-area 单
|
|
|
50
50
|
|
|
51
51
|
把提纲固化为**带角标的答案文件**并生成提纲版报告——与成稿版同一脚本(`render_trace_html.py`)、同一形式,让用户在确认结构方案的同时逐条核验事实依据。编制规范见 [`references/material_usage.md`](../references/material_usage.md) 第三节。
|
|
52
52
|
|
|
53
|
-
1. 编制提纲答案文件 `official-docs/search-results/<项目短名>_outline.md`,三部分:
|
|
53
|
+
1. 编制提纲答案文件 `dknowc-output/${DSH_SESSION_ID:0:8}/official-docs/search-results/<项目短名>_outline.md`,三部分:
|
|
54
54
|
- **演示元信息**:受众与场合、叙事模式、风格预设、画布、页数;
|
|
55
55
|
- **页面规划表**:页 | 类型 | 标题 | 事实要点(四列,不设单独「依据」列——依据由要点内 `[N]` 角标直接承载,单独罗列属冗余)。**每条事实性要点(政策名、数字、案例、时间点)后标 `[N]` 角标**,N 为素材清单检索编号;结构页/观点页要点写「无」;
|
|
56
56
|
- **口径事项清单**:需用户留意的问题(统计口径差异、外省材料定位、待补检索项),逐条带角标——这是提纲版的核心价值,把「待确认」变成可点击核验的书面记录。
|
|
@@ -58,17 +58,23 @@ python3 {skillDir}/scripts/trusted_search.py "检索问题" --service-area 单
|
|
|
58
58
|
|
|
59
59
|
```bash
|
|
60
60
|
python3 {skillDir}/scripts/render_trace_html.py dknowc-output/${DSH_SESSION_ID:0:8}/official-docs/search-results/NN_语义名.json \
|
|
61
|
+
--question "<用户原始需求全文>" \
|
|
61
62
|
--title "<演示标题>" \
|
|
62
63
|
--answer-file dknowc-output/${DSH_SESSION_ID:0:8}/official-docs/search-results/<项目短名>_outline.md \
|
|
63
64
|
--question "用户原始需求" \
|
|
64
65
|
--stage outline
|
|
65
66
|
```
|
|
66
67
|
|
|
67
|
-
报告首屏为**核验报告单**:依据溯源、引用绑定、时效检查、类型覆盖、提纲自检五项指标 +
|
|
68
|
+
报告首屏为**核验报告单**:依据溯源、引用绑定、时效检查、类型覆盖、提纲自检五项指标 + 建议人工复核项,全部由脚本真实计算(缺链接显示待补、未绑定标红、自检未记录不装通过);正文为连续文档流,句后引文胶囊点击原地展开溯源卡;接口返回的原文链接**原样给出**(不做连通性检测),接口提供存档快照时作为附加回看入口。**生成前硬校验**:答案正文没有任何 `[N]` 角标时脚本拒绝生成并报错——修正答案文件后重跑,不得绕过。
|
|
68
69
|
|
|
69
|
-
3. **多轮检索**(多个 NN JSON):先手工合并为一个 JSON 供本步与成稿版使用——**推荐顶层结构** `{"检索文章": [...], "self_check": {...}?, "verification_checks": [...]?}`(渲染器同时兼容原始接口的 `content.data.检索文章` 嵌套形态,两种都认)。把各 JSON 的 `检索文章` 数组按素材清单 `[M]` 编号顺序合并(数组合并顺序即角标顺序,答案文件角标按此顺序书写)、`角标` 字段重排为清单编号,并按素材清单给每条材料加 `类型` 字段(政策依据/数据支撑/参考案例/表述参考,供核验报告单「类型覆盖」指标与来源卡色系使用);可选在顶层写 `self_check`(提纲自检 5 项如实结果,键可用中文,值支持 `pass`/`通过:说明`/`✓`)与 `verification_checks
|
|
70
|
+
3. **多轮检索**(多个 NN JSON):先手工合并为一个 JSON 供本步与成稿版使用——**推荐顶层结构** `{"检索文章": [...], "self_check": {...}?, "verification_checks": [...]?}`(渲染器同时兼容原始接口的 `content.data.检索文章` 嵌套形态,两种都认)。把各 JSON 的 `检索文章` 数组按素材清单 `[M]` 编号顺序合并(数组合并顺序即角标顺序,答案文件角标按此顺序书写)、`角标` 字段重排为清单编号,并按素材清单给每条材料加 `类型` 字段(政策依据/数据支撑/参考案例/表述参考,供核验报告单「类型覆盖」指标与来源卡色系使用);可选在顶层写 `self_check`(提纲自检 5 项如实结果,键可用中文,值支持 `pass`/`通过:说明`/`✓`)与 `verification_checks`(需人工复核事项清单,逐条透传展示)。素材清单编号是角标唯一基准。**合并时同一篇文章只留一条**(按标题+源网址去重;多路召回常带重复片段,重复录入会让报告出现成批同名卡);渲染器侧也按归一化「标题+来源网址」去重兜底——同一篇文章只出一张卡,若它在清单里占多个编号(同文异号),卡上会并列显示全部编号(如 `[8][13]`),正文引用任一编号都能定位。渲染器兜底:若合并 JSON 未带 `角标` 字段,`render_trace_html.py` 按数组位置 1..N 自动编号,因此**合并顺序必须与素材清单编号顺序一致**。合并时逐条检查原文链接:接口偶有材料不带 `源网址`,**交付前必须先尝试人工补链**(经权威官方入口核实后把真实 URL 填入 `源网址` 或 `policyUrl` 字段);确实无法补到的(材料下线、无公开 URL)才保留提醒交付,**禁止伪造链接**。
|
|
70
71
|
4. **编制纪律**:提纲中每个数字、政策名、案例必须能通过角标回溯到来源原文;挂不上角标的事实要点删除表述、降为概括表述、或列入口径事项清单标注「待补检索」,不得裸写。**角标只能指向合并 JSON 中真实存在的素材编号**——用户提供的不可核验素材禁止挂角标(幽灵角标会被核验报告单判为「未绑定」红色警示,导致核验不通过),以文字标注「用户提供 · 未经权威核验」并写入口径事项清单即可。
|
|
71
72
|
5. **模式差异**:材料模式下,检索覆盖部分正常角标,纯用户材料要点在口径事项清单标注「用户提供 · 未经权威核验」;免检索模式不生成本报告,Step 5 确认门如实说明「提纲未经权威核验」。
|
|
73
|
+
6. **dsh 交付**:报告生成后落在会话工作区产物目录(脚本打印绝对路径),dsh 以工作区为文件视图、访达也可直达——直接向用户展示该路径,请用户点开确认提纲即可,无需交付复制。
|
|
74
|
+
|
|
75
|
+
## Step 5 结构方案确认门 ⛔
|
|
76
|
+
|
|
77
|
+
向用户展示(Markdown 分节,不塞长段落):
|
|
72
78
|
|
|
73
79
|
- 核心信息与叙事模式
|
|
74
80
|
- 页面规划总览(页序 + 每页标题 + 页类型)
|
|
@@ -90,32 +96,32 @@ dknowc-projects/<项目名>/ # 项目名用主题短名(拼音或
|
|
|
90
96
|
└── exports/ # 最终 .pptx 与两版溯源核验报告
|
|
91
97
|
```
|
|
92
98
|
|
|
93
|
-
项目创建后,把 Step 4 生成的提纲版报告从 `official-docs/output/` 复制归档到 `dknowc-projects/<项目名>/exports/<演示名>_提纲核验报告.html`。
|
|
99
|
+
项目创建后,把 Step 4 生成的提纲版报告从 `dknowc-output/${DSH_SESSION_ID:0:8}/official-docs/output/` 复制归档到 `dknowc-dknowc-projects/<项目名>/exports/<演示名>_提纲核验报告.html`。
|
|
94
100
|
|
|
95
101
|
SVG 创作严格遵循 [`references/svg-authoring.md`](../references/svg-authoring.md)(元素契约、排版纪律、图表画法、禁止清单)与已确认风格预设。
|
|
96
102
|
|
|
97
|
-
节奏:**P01
|
|
103
|
+
节奏:**P01 完成后即请用户确认首页**——需要给用户预览首页时,用预览脚本生成 HTML 预览页并直接展示路径(预览页落会话工作区产物目录,dsh 以工作区为文件视图):
|
|
98
104
|
|
|
99
105
|
```bash
|
|
100
106
|
python3 {skillDir}/scripts/preview_slide_html.py <项目名>
|
|
101
107
|
```
|
|
102
108
|
|
|
103
|
-
|
|
109
|
+
本地环境可让用户直接打开 SVG 或预览页;也可以先跑一次首页质检。确认后其余页不间断写完;全部页面完成后可用同一脚本重新生成全页预览(覆盖旧文件)供用户快速翻阅。写完顺手把页面引用的素材ID核对一遍。
|
|
104
110
|
|
|
105
111
|
## Step 7 质检与编译导出
|
|
106
112
|
|
|
107
113
|
```bash
|
|
108
114
|
# 质检(quick 无锁模式;--stage final --json 生成正式报告,导出的前置条件)
|
|
109
|
-
python3 {skillDir}/scripts/svg_quality_checker.py
|
|
115
|
+
python3 {skillDir}/scripts/svg_quality_checker.py projects/<项目名> --quick-generate --stage final --json
|
|
110
116
|
|
|
111
117
|
# 编译导出(原生 DrawingML)
|
|
112
|
-
uv run --with python-pptx --with XlsxWriter python3 {skillDir}/scripts/svg_to_pptx.py
|
|
118
|
+
uv run --with python-pptx --with XlsxWriter python3 {skillDir}/scripts/svg_to_pptx.py projects/<项目名> --quick-generate
|
|
113
119
|
```
|
|
114
120
|
|
|
115
121
|
注意:导出脚本要求先存在**通过的 final 质检报告**(`validation/svg_quality_report.json`),所以质检必须带 `--stage final --json` 且退出码为 0,再执行导出。首页确认阶段可用不带 `--stage final` 的快速检查。
|
|
116
122
|
|
|
117
123
|
- 质检 exit 1(errors):逐条修复 SVG 后重跑;warnings 评估后可放行。
|
|
118
|
-
- 导出成功后 `.pptx` 位于 `dknowc-projects/<项目名>/exports/`。
|
|
124
|
+
- 导出成功后 `.pptx` 位于 `dknowc-dknowc-dknowc-projects/<项目名>/exports/`。
|
|
119
125
|
- 可选转场:`-t fade` 等参数仅用户明确要求动效时使用;默认不传。
|
|
120
126
|
|
|
121
127
|
## Step 8 成稿版溯源核验报告(执行过检索时必做)
|
|
@@ -124,29 +130,26 @@ uv run --with python-pptx --with XlsxWriter python3 {skillDir}/scripts/svg_to_pp
|
|
|
124
130
|
|
|
125
131
|
```bash
|
|
126
132
|
python3 {skillDir}/scripts/render_trace_html.py dknowc-output/${DSH_SESSION_ID:0:8}/official-docs/search-results/NN_xxx.json \
|
|
133
|
+
--question "<用户原始需求全文>" \
|
|
127
134
|
--title "<演示标题>" \
|
|
128
135
|
--answer-file dknowc-output/${DSH_SESSION_ID:0:8}/official-docs/search-results/<项目短名>_answer.txt \
|
|
129
136
|
--question "用户原始需求" \
|
|
130
137
|
--stage final
|
|
131
138
|
```
|
|
132
139
|
|
|
133
|
-
输出 HTML 复制到 `dknowc-projects/<项目名>/exports/<演示名>_成稿核验报告.html`。规则见 [`references/material_usage.md`](../references/material_usage.md)。
|
|
140
|
+
输出 HTML 复制到 `dknowc-dknowc-projects/<项目名>/exports/<演示名>_成稿核验报告.html`。规则见 [`references/material_usage.md`](../references/material_usage.md)。
|
|
134
141
|
|
|
135
142
|
## Step 9 交付(三件套)
|
|
136
143
|
|
|
137
144
|
- **交付干净原则(先修后交)**:交付给用户的两份核验报告必须处于「核验完成」状态——可修复问题(角标未绑定、JSON 结构不符、可补的原文链接、`self_check` 未写入)一律先修复重渲再交付,不得带着可修复问题交给用户;只有不可抗力缺口(官方入口确实无法补链)允许保留提醒,且交付时说明原因。
|
|
138
|
-
- 主交付物:`dknowc-projects/<项目名>/exports/<演示名>.pptx` 路径 + 一句简短说明。
|
|
145
|
+
- 主交付物:`dknowc-dknowc-projects/<项目名>/exports/<演示名>.pptx` 路径 + 一句简短说明。
|
|
139
146
|
- 执行过检索时附两份报告路径并说明其为辅助核验文件、不是正文附件:
|
|
140
147
|
- `<演示名>_提纲核验报告.html`(提纲阶段事前核验);
|
|
141
148
|
- `<演示名>_成稿核验报告.html`(交付阶段事后溯源)。
|
|
142
|
-
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
按返回 JSON 处理:全部 `copied=true` → 向用户展示 `delivered` 路径;`need_dest=true` → 用 `--dest <宿主工作区目录>` 重跑后再交付。非宿主环境(本地直用)同样运行无害——探测不到宿主时如实用 `need_dest` 提示,直接展示 skill 内路径即可。
|
|
151
|
-
- 不发送 SVG 源文件、内容包草稿、质检报告等中间产物,除非用户明确要看。
|
|
149
|
+
- **交付清单只含上面这三件**(`dknowc-dknowc-dknowc-projects/<项目名>/exports/` 下;P01 预览页按需可选):
|
|
150
|
+
- **每个产物只交付一份**——不得把 `dknowc-output/${DSH_SESSION_ID:0:8}/official-docs/output/` 的中转报告与 `exports/` 归档件同时交付(同一份报告两个文件名=交付事故,实测发生过:渲染器先按标题/提示词名输出中转件、归档时又按规范名复制一份,两版同内容却都进了工作区,用户不知道该看哪份);
|
|
151
|
+
- **所有中间产物一律不交付**:检索 JSON、提纲/成稿答案文件、内容包、SVG 源文件、质检报告、`dknowc-output/${DSH_SESSION_ID:0:8}/official-docs/output/` 中转件(与公文写作、可信搜索同口径:「交付物只有最终产物」);
|
|
152
|
+
- 交付清单**逐个显式列出文件绝对路径**,不用通配符、不整目录交付;交付后核对工作区里就是这几件、无多余同名文件。
|
|
153
|
+
- **dsh 交付**:产物直接生成在会话工作区——`.pptx` 与两份核验报告在 `dknowc-projects/<项目名>/exports/`,渲染中转件在 `dknowc-output/<会话ID前8位>/dknowc-output/${DSH_SESSION_ID:0:8}/official-docs/output/`。dsh 以工作区为文件视图、访达也可直达,直接向用户展示上面三件的绝对路径即可,无需交付复制,也不存在 skill 内部路径打不开的问题;交付前核对交付清单这三件齐全、无多余同名文件。
|
|
154
|
+
- 不发送 SVG 源文件、内容包草稿、质检报告、`dknowc-output/${DSH_SESSION_ID:0:8}/official-docs/output/` 中转报告等中间产物,除非用户明确要看。
|
|
152
155
|
- 询问是否需要调整(改文字/换风格/调页序):调整走内容包 → SVG → 重导出的闭环,不直接改 .pptx。
|