dknowc-dsh 1.2.1 → 1.4.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 +4 -2
- package/package.json +3 -3
- package/skills/dknowc-official-doc-writer/README.md +15 -38
- package/skills/dknowc-official-doc-writer/SKILL.md +134 -221
- package/skills/dknowc-official-doc-writer/reference/local_memory_guide.md +53 -0
- package/skills/dknowc-official-doc-writer/reference/material_usage_guidance.md +3 -3
- package/skills/dknowc-official-doc-writer/reference/onboarding_scripts.md +132 -0
- package/skills/dknowc-official-doc-writer/reference/output_guide.md +4 -4
- package/skills/dknowc-official-doc-writer/reference/review_checklist.md +16 -16
- package/skills/dknowc-official-doc-writer/reference/revision_workflow.md +1 -1
- package/skills/dknowc-official-doc-writer/reference/sample_search_result.md +1 -1
- package/skills/dknowc-official-doc-writer/reference/sample_trace_report.html +1006 -224
- package/skills/dknowc-official-doc-writer/reference/search_guide.md +64 -33
- package/skills/dknowc-official-doc-writer/reference/search_intro.md +3 -3
- package/skills/dknowc-official-doc-writer/reference/search_policy.md +26 -13
- package/skills/dknowc-official-doc-writer/reference/standards/01_report.md +3 -2
- package/skills/dknowc-official-doc-writer/reference/standards/02_qingshi.md +3 -2
- package/skills/dknowc-official-doc-writer/reference/standards/03_pifu.md +2 -2
- package/skills/dknowc-official-doc-writer/reference/standards/04_tongzhi.md +3 -3
- package/skills/dknowc-official-doc-writer/reference/standards/05_yijian.md +2 -2
- package/skills/dknowc-official-doc-writer/reference/standards/06_han.md +3 -3
- package/skills/dknowc-official-doc-writer/reference/standards/08_tongbao.md +2 -2
- package/skills/dknowc-official-doc-writer/reference/standards/09_tonggao.md +2 -2
- package/skills/dknowc-official-doc-writer/reference/standards/10_gonggao.md +2 -2
- package/skills/dknowc-official-doc-writer/reference/standards/11_fuhan_approve.md +2 -2
- package/skills/dknowc-official-doc-writer/reference/standards/12_fuhan_objection.md +2 -2
- package/skills/dknowc-official-doc-writer/reference/standards/13_reminder.md +3 -3
- package/skills/dknowc-official-doc-writer/reference/standards/14_generic.md +2 -2
- package/skills/dknowc-official-doc-writer/reference/standards/16_decision.md +2 -2
- package/skills/dknowc-official-doc-writer/reference/standards/18_order.md +1 -1
- package/skills/dknowc-official-doc-writer/reference/standards/19_gazette.md +1 -1
- package/skills/dknowc-official-doc-writer/reference/standards/20_motion.md +2 -2
- package/skills/dknowc-official-doc-writer/reference/standards/22_application.md +2 -2
- package/skills/dknowc-official-doc-writer/reference/standards/23_publicity.md +1 -1
- package/skills/dknowc-official-doc-writer/reference/task_router.md +10 -10
- package/skills/dknowc-official-doc-writer/scripts/adapt_mcp_result.py +52 -2
- package/skills/dknowc-official-doc-writer/scripts/api_key.py +41 -0
- package/skills/dknowc-official-doc-writer/scripts/dkag_search.py +40 -7
- package/skills/dknowc-official-doc-writer/scripts/format_document.py +30 -26
- package/skills/dknowc-official-doc-writer/scripts/initialize.py +45 -23
- package/skills/dknowc-official-doc-writer/scripts/local_memory.py +1 -1
- package/skills/dknowc-official-doc-writer/scripts/mcp_direct.py +9 -1
- package/skills/dknowc-official-doc-writer/scripts/merge_search_results.py +1 -1
- package/skills/dknowc-official-doc-writer/scripts/outline_reference.py +7 -11
- package/skills/dknowc-official-doc-writer/scripts/register.mjs +51 -10
- package/skills/dknowc-official-doc-writer/scripts/render_trace_html.py +1400 -595
- package/skills/dknowc-official-doc-writer/scripts/review_document.py +1 -1
- package/skills/dknowc-official-doc-writer/scripts/source_note_html.py +174 -48
- package/skills/dknowc-official-doc-writer/scripts/template_generator.py +3 -3
- package/skills/dknowc-ppt-assistant/README.md +4 -4
- package/skills/dknowc-ppt-assistant/SKILL.md +16 -20
- package/skills/dknowc-ppt-assistant/references/content-pack.md +3 -3
- package/skills/dknowc-ppt-assistant/references/material_usage.md +9 -6
- package/skills/dknowc-ppt-assistant/references/onboarding_scripts.md +120 -0
- package/skills/dknowc-ppt-assistant/references/sample_search_result.md +1 -1
- package/skills/dknowc-ppt-assistant/references/sample_trace_report.html +1543 -0
- package/skills/dknowc-ppt-assistant/references/search_intro.md +1 -1
- package/skills/dknowc-ppt-assistant/references/svg-authoring.md +1 -1
- package/skills/dknowc-ppt-assistant/scripts/api_key.py +41 -0
- package/skills/dknowc-ppt-assistant/scripts/initialize.py +54 -23
- package/skills/dknowc-ppt-assistant/scripts/mcp_direct.py +8 -0
- package/skills/dknowc-ppt-assistant/scripts/register_key.mjs +112 -26
- package/skills/dknowc-ppt-assistant/scripts/render_trace_html.py +1556 -609
- package/skills/dknowc-ppt-assistant/scripts/trusted_search.py +65 -15
- package/skills/dknowc-ppt-assistant/workflows/generate-pptx.md +10 -10
- package/skills/dknowc-ppt-assistant/workflows/routing.md +1 -1
- package/skills/dknowc-trusted-consulting/README.md +8 -9
- package/skills/dknowc-trusted-consulting/SKILL.md +54 -34
- package/skills/dknowc-trusted-consulting/reference/consult_intro.md +3 -35
- package/skills/dknowc-trusted-consulting/reference/onboarding_scripts.md +132 -0
- package/skills/dknowc-trusted-consulting/reference/sample_trace_report.html +682 -272
- package/skills/dknowc-trusted-consulting/scripts/api_key.py +41 -0
- package/skills/dknowc-trusted-consulting/scripts/gov_chat.py +39 -19
- package/skills/dknowc-trusted-consulting/scripts/initialize.py +52 -18
- package/skills/dknowc-trusted-consulting/scripts/mcp_direct.py +8 -0
- package/skills/dknowc-trusted-consulting/scripts/register_key.mjs +122 -21
- package/skills/dknowc-trusted-consulting/scripts/render_trace_html.py +1665 -743
- package/skills/dknowc-trusted-search/README.md +2 -1
- package/skills/dknowc-trusted-search/SKILL.md +33 -33
- package/skills/dknowc-trusted-search/reference/onboarding_scripts.md +132 -0
- package/skills/dknowc-trusted-search/reference/sample_trace_report.html +1148 -233
- package/skills/dknowc-trusted-search/scripts/api_key.py +41 -0
- package/skills/dknowc-trusted-search/scripts/deep_query.py +81 -9
- package/skills/dknowc-trusted-search/scripts/initialize.py +64 -17
- package/skills/dknowc-trusted-search/scripts/mcp_direct.py +8 -0
- package/skills/dknowc-trusted-search/scripts/register_key.mjs +111 -24
- package/skills/dknowc-trusted-search/scripts/render_policy_visualization.py +2 -3
- package/skills/dknowc-trusted-search/scripts/render_trace_html.py +1688 -718
- package/skills/dknowc-trusted-search/scripts/trusted_search.py +86 -14
- package/src/index.js +3 -3
- package/skills/dknowc-official-doc-writer/official-docs/input/mcp_intro_content.md +0 -61
- package/skills/dknowc-official-doc-writer/scripts/check_release.py +0 -93
- package/skills/dknowc-ppt-assistant/scripts/check_release.py +0 -106
- package/skills/dknowc-trusted-consulting/scripts/check_release.py +0 -66
- package/skills/dknowc-trusted-search/reference/search_intro.md +0 -79
- package/skills/dknowc-trusted-search/scripts/check_release.py +0 -79
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
"""可信溯源核验报告渲染器:把结构化正文/素材 JSON 渲染为单文件可核验 HTML。
|
|
3
3
|
|
|
4
4
|
报告定位:不止展示"材料从哪来"(溯源),更要传达"我们查过了,可以交付"(核验)。
|
|
5
|
-
|
|
6
|
-
-
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
3.7.0 架构(参考深知晓交互原型,数据口径保持自有与真实):
|
|
6
|
+
- 顶栏:身份章 + 标题 + 工具组(只看正文 / 复制全文 / 打印归档)+ 阅读进度条
|
|
7
|
+
- Hero:大标题 + 真实统计(N 次检索 · M 条材料 · K 处引用)+ 双视图切换
|
|
8
|
+
- 过程回顾条:检索 → 入库 → 逐条比对 → 核验完成(静态回放,数字全部真实计算;
|
|
9
|
+
无思考流数据就不展示"思考"步骤——硬造即违背核验诚实性)
|
|
10
|
+
- 核验报告视图(默认):核验报告单 + 正文分节卡;角标点击跳材料专库定位
|
|
11
|
+
- 材料专库视图(全屏):大搜索 + 热词(标题/正文高频词真实计算)+ 检索分组 tabs + 材料卡
|
|
12
|
+
三个核验层次:报告级(核验报告单)/材料级(来源卡核验链标记)/引用级(角标一一绑定)。
|
|
13
|
+
诚实原则:脚本真实计算的结果才打勾;政策现行效力等无法自动判定项归入"建议人工复核"。
|
|
14
|
+
布局为单文件静态 HTML;打印归档模式单栏全展开并附材料附录。
|
|
15
15
|
"""
|
|
16
16
|
|
|
17
17
|
from __future__ import annotations
|
|
@@ -97,7 +97,7 @@ KIND_CATALOG = {
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
|
|
100
|
-
def normalize_kind(raw: str) -> Tuple[str, str
|
|
100
|
+
def normalize_kind(raw: str) -> Tuple[str, str]:
|
|
101
101
|
"""把来源类型文本归一化为(类型键, 中文标签, css 类名)。"""
|
|
102
102
|
text = str(raw or "")
|
|
103
103
|
if "政策" in text or "法规" in text or "依据" in text or "policy" in text.lower():
|
|
@@ -132,19 +132,37 @@ def parse_year_month(raw: str) -> Optional[Tuple[int, int]]:
|
|
|
132
132
|
# 素材提取(沿用原数据层)
|
|
133
133
|
# ============================================================
|
|
134
134
|
|
|
135
|
+
def clean_paragraph_noise(text: str) -> str:
|
|
136
|
+
"""清洗接口段落文本中的附件链接噪音。
|
|
137
|
+
|
|
138
|
+
接口段落内容格式为「段落标题 https://attach.dknowc.cn/file/<正文>」——
|
|
139
|
+
URL 前是段落标题(已由标题链单独展示),URL 本身是附件地址(卡片有"查看原文"入口)。
|
|
140
|
+
摘录只保留 URL 之后的正文;无该前缀时兜底剔除文本中的裸 URL。
|
|
141
|
+
"""
|
|
142
|
+
value = str(text or "")
|
|
143
|
+
m = re.search(r"https?://\S*attach\.dknowc\.cn/file/", value)
|
|
144
|
+
if m:
|
|
145
|
+
return value[m.end():].strip()
|
|
146
|
+
value = re.sub(r"https?://\S+", " ", value)
|
|
147
|
+
return re.sub(r"[ \t]{2,}", " ", value).strip()
|
|
148
|
+
|
|
149
|
+
|
|
135
150
|
def paragraph_text(item: Dict[str, Any]) -> str:
|
|
136
151
|
paragraphs = item.get("content") or item.get("段落") or item.get("paragraphs") or item.get("paragraphList")
|
|
137
152
|
if isinstance(paragraphs, list):
|
|
138
153
|
chunks = []
|
|
139
154
|
for para in paragraphs:
|
|
140
155
|
if isinstance(para, dict):
|
|
141
|
-
|
|
156
|
+
chunk = first_str(para.get("text"), para.get("内容"), para.get("content"), para.get("summary"), para.get("标题"), para.get("title"))
|
|
142
157
|
else:
|
|
143
|
-
|
|
144
|
-
|
|
158
|
+
chunk = str(para)
|
|
159
|
+
chunk = clean_paragraph_noise(chunk)
|
|
160
|
+
if chunk:
|
|
161
|
+
chunks.append(chunk)
|
|
162
|
+
text = "\n".join(chunks)
|
|
145
163
|
if text:
|
|
146
164
|
return text
|
|
147
|
-
return first_str(
|
|
165
|
+
return clean_paragraph_noise(first_str(
|
|
148
166
|
item.get("摘录"),
|
|
149
167
|
item.get("摘要"),
|
|
150
168
|
item.get("相关段落"),
|
|
@@ -154,7 +172,7 @@ def paragraph_text(item: Dict[str, Any]) -> str:
|
|
|
154
172
|
item.get("content"),
|
|
155
173
|
item.get("text"),
|
|
156
174
|
item.get("snippet"),
|
|
157
|
-
)
|
|
175
|
+
))
|
|
158
176
|
|
|
159
177
|
|
|
160
178
|
def content_segments(item: Dict[str, Any]) -> List[Dict[str, str]]:
|
|
@@ -179,8 +197,9 @@ def content_segments(item: Dict[str, Any]) -> List[Dict[str, str]]:
|
|
|
179
197
|
def source_from_article(item: Dict[str, Any], index: int, segment: Optional[Dict[str, str]] = None) -> Dict[str, str]:
|
|
180
198
|
vo = item.get("vo") if isinstance(item.get("vo"), dict) else {}
|
|
181
199
|
segment = segment or {}
|
|
200
|
+
# segment 的 id 是文章内段落序号(每篇各自从 1 起),不是材料角标号,不得用作材料 id,
|
|
201
|
+
# 否则多篇材料的段落 id 同为 "1" 会互相冲突,导致角标绑定错乱。
|
|
182
202
|
explicit_id = first_str(
|
|
183
|
-
segment.get("id"),
|
|
184
203
|
item.get("角标"),
|
|
185
204
|
item.get("编号"),
|
|
186
205
|
item.get("index"),
|
|
@@ -223,17 +242,48 @@ def source_from_article(item: Dict[str, Any], index: int, segment: Optional[Dict
|
|
|
223
242
|
"url": first_str(item.get("sourceUrl"), item.get("source_url"), item.get("源网址"), item.get("原文链接"), item.get("url"), item.get("原文"), vo.get("sourceUrl"), vo.get("url")),
|
|
224
243
|
"policy_url": first_str(item.get("policyUrl"), item.get("policy_url"), item.get("知识专库原文"), vo.get("policyUrl")),
|
|
225
244
|
"excerpt": segment.get("text") or paragraph_text(item),
|
|
226
|
-
"section": first_str(
|
|
245
|
+
"section": first_str(item.get("正文对应"), item.get("section"), item.get("支撑")),
|
|
227
246
|
"kind": first_str(item.get("类型"), item.get("type"), item.get("素材类型"), vo.get("typeName"), "材料"),
|
|
228
247
|
"verify_note": first_str(item.get("核验"), item.get("verification"), item.get("核验说明")),
|
|
229
248
|
"area": first_str(item.get("intentionArea"), item.get("area"), item.get("地域")),
|
|
230
249
|
}
|
|
250
|
+
# 段落级数据(多段分块展示用):每段 {chain:[文章,章节,子节...], text}
|
|
251
|
+
# 段落标题自带 > 层级,拆级成面包屑;段落标题与文章标题相同或缺失时链只含文章一级。
|
|
252
|
+
segments = []
|
|
253
|
+
for seg in content_segments(item):
|
|
254
|
+
seg_title = first_str(seg.get("title"))
|
|
255
|
+
levels = [lvl.strip() for lvl in re.split(r"\s*>\s*", seg_title) if lvl.strip()] if seg_title else []
|
|
256
|
+
if levels and levels[0] == source["title"]:
|
|
257
|
+
levels = levels[1:]
|
|
258
|
+
seg_text = clean_paragraph_noise(seg.get("text"))
|
|
259
|
+
chain_lvls = [source["title"]] + levels
|
|
260
|
+
segments.append({"chain": chain_lvls, "text": strip_leading_chain(seg_text, chain_lvls)})
|
|
261
|
+
source["segments"] = segments
|
|
262
|
+
# 首段章节位置(兼容旧单行引用处)
|
|
263
|
+
first_chain = segments[0]["chain"][1:] if segments else []
|
|
264
|
+
source["doc_section"] = " › ".join(first_chain)
|
|
265
|
+
source["chain_full"] = " › ".join(segments[0]["chain"]) if segments else ""
|
|
266
|
+
# 发文字号(接口 policyFiles.writtenText,本地标题匹配)
|
|
267
|
+
source["doc_number"] = first_str(item.get("文号"), item.get("doc_number"))
|
|
268
|
+
# 所属搜索条件(多路检索分组)与引用状态(未引用=接口召回但正文未采用)
|
|
269
|
+
source["search_key"] = first_str(item.get("搜索条件"), item.get("search_key"))
|
|
270
|
+
source["used"] = item.get("已引用", item.get("used", True))
|
|
271
|
+
if not isinstance(source["used"], bool):
|
|
272
|
+
source["used"] = True
|
|
273
|
+
# 快照兜底:原文链接 404/410(生成时真实检测)或接口未返回源网址时,
|
|
274
|
+
# 改用接口提供的存档快照链接回看——快照是原文的存档副本,按钮文案如实区分。
|
|
275
|
+
source["snapshot"] = first_str(item.get("快照链接"), item.get("snapshot"), item.get("screenShotPath"))
|
|
276
|
+
source["link_dead"] = item.get("链接失效") is True or item.get("link_dead") is True
|
|
277
|
+
# 发布日期可信度(实测:「高」=模型治理入库、标题模型精抽;「较高」=门户抓取、标题规则提取)
|
|
278
|
+
source["conf"] = first_str(item.get("发布日期可信度"), item.get("可信度"), item.get("confidence"))
|
|
231
279
|
key, label, css = normalize_kind(source["kind"])
|
|
232
280
|
source["type_key"] = key
|
|
233
281
|
source["type_label"] = label
|
|
234
282
|
source["type_css"] = css
|
|
235
|
-
|
|
236
|
-
source["
|
|
283
|
+
live_url = bool(source["url"] and source["url"] != "接口未返回") and not source["link_dead"]
|
|
284
|
+
source["has_link"] = live_url or bool(source["policy_url"]) or bool(source["snapshot"])
|
|
285
|
+
# 核验状态只看摘录可比对;原文链接死活与快照有无是回看通道问题,不影响核验结论
|
|
286
|
+
source["verified"] = bool(source["excerpt"])
|
|
237
287
|
return source
|
|
238
288
|
|
|
239
289
|
|
|
@@ -283,17 +333,16 @@ def extract_sources(payload: Dict[str, Any]) -> List[Dict[str, str]]:
|
|
|
283
333
|
sources: List[Dict[str, str]] = []
|
|
284
334
|
seen = set()
|
|
285
335
|
for item in raw_sources:
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
sources.append(source)
|
|
336
|
+
# 一篇材料一张卡:段落合并为摘录(paragraph_text 拼接全部段落),不按段落拆卡——
|
|
337
|
+
# 溯源 JSON 的 materials 与正文角标按"材料"粒度一一对应,拆段会使编号错位。
|
|
338
|
+
source = source_from_article(item, len(sources) + 1)
|
|
339
|
+
key = (source["id"], source["title"], source["url"], source["excerpt"][:80])
|
|
340
|
+
if key in seen:
|
|
341
|
+
continue
|
|
342
|
+
seen.add(key)
|
|
343
|
+
if not source["id"]:
|
|
344
|
+
source["id"] = str(len(sources) + 1)
|
|
345
|
+
sources.append(source)
|
|
297
346
|
return sources
|
|
298
347
|
|
|
299
348
|
|
|
@@ -319,7 +368,7 @@ def extract_answer(payload: Dict[str, Any]) -> str:
|
|
|
319
368
|
vo = item.get("vo") if isinstance(item.get("vo"), dict) else {}
|
|
320
369
|
rows.append(f"[{idx}] {first_str(vo.get('showTitle'), vo.get('title'), item.get('title'), '未命名材料')}")
|
|
321
370
|
return "\n".join(rows)
|
|
322
|
-
return "
|
|
371
|
+
return "接口返回中未识别到正文内容;请查看材料专库或原始 JSON。"
|
|
323
372
|
|
|
324
373
|
|
|
325
374
|
def extract_question(payload: Dict[str, Any]) -> str:
|
|
@@ -335,28 +384,6 @@ def extract_question(payload: Dict[str, Any]) -> str:
|
|
|
335
384
|
)
|
|
336
385
|
|
|
337
386
|
|
|
338
|
-
def extract_knowledge_base(payload: Dict[str, Any]) -> str:
|
|
339
|
-
content = payload.get("content") if isinstance(payload.get("content"), dict) else payload
|
|
340
|
-
data = content.get("data") if isinstance(content.get("data"), dict) else {}
|
|
341
|
-
return first_str(
|
|
342
|
-
content.get("knowledgeBase"),
|
|
343
|
-
payload.get("knowledgeBase"),
|
|
344
|
-
data.get("knowledgeBase"),
|
|
345
|
-
payload.get("knowledgeBaseUrl"),
|
|
346
|
-
)
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
def extract_knowledge_bases(payload: Dict[str, Any]) -> List[str]:
|
|
350
|
-
content = payload.get("content") if isinstance(payload.get("content"), dict) else payload
|
|
351
|
-
values: List[str] = []
|
|
352
|
-
for value in (payload.get("knowledgeBases"), content.get("knowledgeBases"), payload.get("knowledgeBase"), content.get("knowledgeBase")):
|
|
353
|
-
if isinstance(value, list):
|
|
354
|
-
values.extend(str(item).strip() for item in value if str(item).strip())
|
|
355
|
-
elif isinstance(value, str) and value.strip():
|
|
356
|
-
values.append(value.strip())
|
|
357
|
-
return list(dict.fromkeys(values))
|
|
358
|
-
|
|
359
|
-
|
|
360
387
|
def citation_ids(answer: str) -> List[str]:
|
|
361
388
|
ids: List[str] = []
|
|
362
389
|
for match in re.finditer(r"\[(\d+)\]", answer):
|
|
@@ -419,10 +446,16 @@ def compute_verification(answer: str, sources: List[Dict[str, str]], payload: Di
|
|
|
419
446
|
"""核验报告单数据。只计算脚本真实可得的结果,不虚构通过。"""
|
|
420
447
|
generated_at = generated_at or datetime.now()
|
|
421
448
|
|
|
422
|
-
# ① 依据溯源:摘录可比对 +
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
449
|
+
# ① 依据溯源:摘录可比对 + 原文链接可回看。
|
|
450
|
+
# 只统计被正文引用的材料——未引用召回材料未进入正文核验流程,其缺链在自身卡片上如实标注,
|
|
451
|
+
# 不应拖累"正文依据可交付"的报告级结论。
|
|
452
|
+
# 缺原文链接(接口对部分治理库文章不返回源网址,属数据源覆盖问题而非核验工作缺失)
|
|
453
|
+
# 不再拖垮整体结论——报告的正常结论即为"核验完成",缺链在指标行黄色提醒并在卡片标注;
|
|
454
|
+
# 缺摘录(正文依据无可比对的原文)仍视为核验问题计入未通过。
|
|
455
|
+
cited_sources = [s for s in sources if s.get("used", True)]
|
|
456
|
+
missing_links = [s["title"] for s in cited_sources if not s.get("has_link")]
|
|
457
|
+
missing_excerpts = [s["title"] for s in cited_sources if not (s.get("excerpt") or "").strip()]
|
|
458
|
+
trace_passed = len(cited_sources) - len(missing_excerpts)
|
|
426
459
|
|
|
427
460
|
# ② 引用绑定:正文角标与来源卡一一对应(按角标出现次数计,与用户在正文中数到的一致)
|
|
428
461
|
cited = citation_ids(answer)
|
|
@@ -465,29 +498,27 @@ def compute_verification(answer: str, sources: List[Dict[str, str]], payload: Di
|
|
|
465
498
|
# 政策效力:无法自动判定现行效力,列出建议人工复核
|
|
466
499
|
policy_count = coverage.get("policy", 0)
|
|
467
500
|
|
|
468
|
-
trace_ok =
|
|
501
|
+
trace_ok = cited_sources and not missing_excerpts
|
|
469
502
|
binding_ok = (not unbound) and not no_citation
|
|
470
503
|
overall_passed = trace_ok and binding_ok
|
|
471
504
|
|
|
472
505
|
reasons = []
|
|
473
506
|
if not sources:
|
|
474
|
-
reasons.append("
|
|
507
|
+
reasons.append("没有找到来源材料")
|
|
475
508
|
if no_citation:
|
|
476
|
-
reasons.append("
|
|
477
|
-
if missing_links:
|
|
478
|
-
reasons.append(f"{len(missing_links)} 条素材待补原文链接")
|
|
509
|
+
reasons.append("正文里没有来源角标,对不上材料")
|
|
479
510
|
if unbound:
|
|
480
|
-
reasons.append(f"{len(unbound)}
|
|
511
|
+
reasons.append(f"有 {len(unbound)} 处角标找不到对应材料")
|
|
481
512
|
if self_check["status"] == "fail":
|
|
482
|
-
reasons.append("
|
|
513
|
+
reasons.append("交付前检查有没过的项")
|
|
483
514
|
|
|
484
515
|
return {
|
|
485
516
|
"overall": {
|
|
486
517
|
"passed": overall_passed,
|
|
487
|
-
"label": "
|
|
518
|
+
"label": "核验完成,正文依据逐条对过原文" if overall_passed else "核验未完全通过",
|
|
488
519
|
"reasons": reasons,
|
|
489
520
|
},
|
|
490
|
-
"traceability": {"total": len(
|
|
521
|
+
"traceability": {"total": len(cited_sources), "passed": trace_passed,
|
|
491
522
|
"missing_links": missing_links, "missing_excerpts": missing_excerpts},
|
|
492
523
|
"binding": {"total": len(all_marks), "bound": len(all_marks) - len(unbound), "unbound": unbound_ids, "no_citation": no_citation},
|
|
493
524
|
"freshness": freshness,
|
|
@@ -498,6 +529,100 @@ def compute_verification(answer: str, sources: List[Dict[str, str]], payload: Di
|
|
|
498
529
|
}
|
|
499
530
|
|
|
500
531
|
|
|
532
|
+
# ============================================================
|
|
533
|
+
# 过程回顾 / 热词(真实计算,不虚构流程)
|
|
534
|
+
# ============================================================
|
|
535
|
+
|
|
536
|
+
def compute_process_stats(sources: List[Dict[str, str]], answer: str) -> Dict[str, Any]:
|
|
537
|
+
"""过程回顾条数据:检索次数、每组检索的召回/采用数、入库与引用计数。
|
|
538
|
+
|
|
539
|
+
全部来自素材自带的真实字段(search_key 分组、used 引用状态、正文角标计数),
|
|
540
|
+
不虚构任何流程步骤。
|
|
541
|
+
"""
|
|
542
|
+
order: List[str] = []
|
|
543
|
+
for s in sources:
|
|
544
|
+
key = (s.get("search_key") or "").strip()
|
|
545
|
+
if key and key not in order:
|
|
546
|
+
order.append(key)
|
|
547
|
+
cond_rows = []
|
|
548
|
+
for key in order:
|
|
549
|
+
group = [s for s in sources if (s.get("search_key") or "").strip() == key]
|
|
550
|
+
cond_rows.append({
|
|
551
|
+
"key": key,
|
|
552
|
+
"total": len(group),
|
|
553
|
+
"used": sum(1 for s in group if s.get("used", True)),
|
|
554
|
+
})
|
|
555
|
+
n_searches = len(cond_rows) or (1 if sources else 0)
|
|
556
|
+
used_count = sum(1 for s in sources if s.get("used", True))
|
|
557
|
+
unused_count = len(sources) - used_count
|
|
558
|
+
n_cite_marks = len(re.findall(r"\[(\d+)\]", answer))
|
|
559
|
+
return {
|
|
560
|
+
"conds": cond_rows,
|
|
561
|
+
"n_searches": n_searches,
|
|
562
|
+
"has_cond_detail": bool(cond_rows),
|
|
563
|
+
"n_materials": len(sources),
|
|
564
|
+
"used_count": used_count,
|
|
565
|
+
"unused_count": unused_count,
|
|
566
|
+
"n_cite_marks": n_cite_marks,
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
|
|
570
|
+
HOT_STOP = {
|
|
571
|
+
"关于", "通知", "工作", "意见", "方案", "实施", "有关", "问题", "情况", "报告", "总结",
|
|
572
|
+
"制度", "体系", "机制", "指导", "贯彻", "落实", "进一步", "以及", "其他", "相关", "以下",
|
|
573
|
+
"以上", "共和国", "人民", "中华", "国务院", "人民政府", "办公厅", "印发", "试行",
|
|
574
|
+
"办法", "条例", "若干", "的重点", "有所", "一个", "方面", "方式", "内容", "基本",
|
|
575
|
+
"发展", "建设", "政策", "产业", "企业", "应用", "改革", "目标", "任务", "规划",
|
|
576
|
+
"领域", "措施", "支持", "行动", "服务", "管理", "政府",
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
|
|
580
|
+
def extract_hot_terms(answer: str, sources: List[Dict[str, str]], top: int = 8) -> List[str]:
|
|
581
|
+
"""材料专库热词:材料标题(加权)+ 检索条件 + 正文的高频 2-4 字词,真实统计。
|
|
582
|
+
|
|
583
|
+
泛词过滤:出现在超过 60% 材料标题中的词(如库内全部材料共有的主题词)
|
|
584
|
+
无法筛出子集,没有筛选价值,剔除。
|
|
585
|
+
"""
|
|
586
|
+
corpus_parts: List[str] = []
|
|
587
|
+
for s in sources:
|
|
588
|
+
if s.get("title"):
|
|
589
|
+
corpus_parts.extend([s["title"]] * 3)
|
|
590
|
+
if s.get("search_key"):
|
|
591
|
+
corpus_parts.extend([s["search_key"]] * 2)
|
|
592
|
+
clean_answer = re.sub(r"\[\d+\]", "", answer or "")
|
|
593
|
+
corpus_parts.append(clean_answer)
|
|
594
|
+
corpus = "\n".join(corpus_parts)
|
|
595
|
+
|
|
596
|
+
counts: Dict[str, int] = {}
|
|
597
|
+
for run in re.findall(r"[一-鿿]{2,}", corpus):
|
|
598
|
+
for n in (2, 3, 4):
|
|
599
|
+
for i in range(len(run) - n + 1):
|
|
600
|
+
gram = run[i:i + n]
|
|
601
|
+
counts[gram] = counts.get(gram, 0) + 1
|
|
602
|
+
|
|
603
|
+
titles = [s.get("title") or "" for s in sources]
|
|
604
|
+
n_titles = max(1, len(titles))
|
|
605
|
+
df_limit = max(1, int(n_titles * 0.6))
|
|
606
|
+
|
|
607
|
+
cands = [(g, c) for g, c in counts.items()
|
|
608
|
+
if c >= 2 and g not in HOT_STOP and "的" not in g and not any(ch.isdigit() for ch in g)
|
|
609
|
+
and sum(1 for t in titles if g in t) <= df_limit]
|
|
610
|
+
cands.sort(key=lambda x: (-x[1], -len(x[0])))
|
|
611
|
+
kept: List[Tuple[str, int]] = []
|
|
612
|
+
for gram, count in cands:
|
|
613
|
+
redundant = False
|
|
614
|
+
for kgram, kcount in kept:
|
|
615
|
+
# 短词是已入选高频长词的子串且计数接近 → 被长词覆盖,剔除
|
|
616
|
+
if gram in kgram and kcount >= count * 0.6:
|
|
617
|
+
redundant = True
|
|
618
|
+
break
|
|
619
|
+
if not redundant:
|
|
620
|
+
kept.append((gram, count))
|
|
621
|
+
if len(kept) >= top:
|
|
622
|
+
break
|
|
623
|
+
return [g for g, _ in kept]
|
|
624
|
+
|
|
625
|
+
|
|
501
626
|
# ============================================================
|
|
502
627
|
# 正文解析与分节
|
|
503
628
|
# ============================================================
|
|
@@ -536,12 +661,10 @@ def render_markdown_table(lines: List[str], citation_repl) -> str:
|
|
|
536
661
|
return f'<div class="tbl-wrap"><table class="data-tbl"><thead><tr>{head_html}</tr></thead><tbody>{"".join(rows)}</tbody></table></div>'
|
|
537
662
|
|
|
538
663
|
|
|
539
|
-
def
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
cleaned = re.sub(r"(?is)<script.*?</script>", "", value)
|
|
544
|
-
cleaned = re.sub(r"(?is)<style.*?</style>", "", value)
|
|
664
|
+
def sanitize_table_html(text: str) -> str:
|
|
665
|
+
"""清洗接口表格 HTML:仅保留 table/thead/tbody/tr/td/th/br,去脚本样式与属性。"""
|
|
666
|
+
cleaned = re.sub(r"(?is)<script.*?</script>", "", text)
|
|
667
|
+
cleaned = re.sub(r"(?is)<style.*?</style>", "", cleaned)
|
|
545
668
|
cleaned = re.sub(r"\s+on\w+\s*=\s*(['\"]).*?\1", "", cleaned)
|
|
546
669
|
cleaned = re.sub(r"\s+(href|src)\s*=\s*(['\"]).*?\2", "", cleaned)
|
|
547
670
|
allowed = {"table", "thead", "tbody", "tr", "td", "th", "br"}
|
|
@@ -552,17 +675,89 @@ def render_excerpt_html(text: str) -> str:
|
|
|
552
675
|
return ""
|
|
553
676
|
return f"<{closing}{name}>"
|
|
554
677
|
|
|
555
|
-
|
|
556
|
-
|
|
678
|
+
return re.sub(r"<\s*(/?)\s*([a-zA-Z0-9]+)(?:\s+[^>]*)?>", tag_repl, cleaned)
|
|
679
|
+
|
|
557
680
|
|
|
681
|
+
def render_excerpt_html(text: str) -> str:
|
|
682
|
+
value = str(text or "")
|
|
683
|
+
if "<table" not in value.lower():
|
|
684
|
+
return f'<div class="sc-excerpt plain">{esc(value)}</div>'
|
|
685
|
+
return f'<div class="sc-excerpt rich">{sanitize_table_html(value)}</div>'
|
|
558
686
|
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
687
|
+
|
|
688
|
+
def parse_answer_blocks(answer: str, valid_ids: set, chip_map: Optional[Dict[str, str]] = None) -> Tuple[List[Dict[str, Any]], set]:
|
|
689
|
+
"""把正文 Markdown 解析为结构化块;同时收集全部角标。
|
|
690
|
+
|
|
691
|
+
角标渲染为原型式 sup.cite 上标胶囊;段落对应的溯源卡(src-card)由
|
|
692
|
+
render_section_cards 在段后输出。
|
|
693
|
+
"""
|
|
694
|
+
|
|
695
|
+
def jb_html(cid: str) -> str:
|
|
696
|
+
jb = chip_map.get(cid)
|
|
697
|
+
if not jb:
|
|
698
|
+
return ""
|
|
699
|
+
if jb.get("url"):
|
|
700
|
+
btn_txt = "查看存档全文" if jb.get("dead") else "查看全文"
|
|
701
|
+
link = (f'<a class="jb-src" href="{esc(jb["url"])}" target="_blank" rel="noopener noreferrer">'
|
|
702
|
+
f'{ARROW_SVG}<span>{btn_txt}</span></a>')
|
|
703
|
+
else:
|
|
704
|
+
link = ""
|
|
705
|
+
# 原文直达区展示标题链(多段分块,各段带链——快速人工核验的核心抓手)
|
|
706
|
+
segs = jb.get("segments") or []
|
|
707
|
+
if segs:
|
|
708
|
+
quote = ""
|
|
709
|
+
seg_idx = -1
|
|
710
|
+
for seg in segs:
|
|
711
|
+
text = (seg.get("text") or "").strip()
|
|
712
|
+
if not text:
|
|
713
|
+
continue
|
|
714
|
+
seg_idx += 1
|
|
715
|
+
if "<table" in text.lower():
|
|
716
|
+
# 表格不能静态写进 span(解析器会拆散):此处留占位,
|
|
717
|
+
# 表格数据由 render_html 汇总注入页尾 JSON,展开时 JS 填充
|
|
718
|
+
tbl_key = f"{cid}-{seg_idx}"
|
|
719
|
+
jb.setdefault("_tables", {})[tbl_key] = sanitize_table_html(text)
|
|
720
|
+
body_txt = f'<span class="sc-excerpt rich tbl-holder" data-tbl="{esc(tbl_key)}"></span>'
|
|
721
|
+
else:
|
|
722
|
+
body_txt = f'<span class="sc-excerpt">{esc(text)}</span>'
|
|
723
|
+
inner = f'<i class="jb-no">{esc(cid)}</i>{body_txt}'
|
|
724
|
+
item = f'<span class="jb-quote" role="button" tabindex="0">{inner}</span>'
|
|
725
|
+
quote += render_crumb(seg.get("chain") or []) + item
|
|
726
|
+
elif jb["excerpt"]:
|
|
727
|
+
inner = f'<i class="jb-no">{esc(cid)}</i><span>{esc(jb["excerpt"])}</span>'
|
|
728
|
+
quote = f'<span class="jb-quote" role="button" tabindex="0">{inner}</span>'
|
|
729
|
+
else:
|
|
730
|
+
quote = ""
|
|
731
|
+
site_html = (f'<span class="jb-site"><span class="dot"></span>{esc(jb.get("site") or "")}</span>'
|
|
732
|
+
if (jb.get("site") or "").strip() else "")
|
|
733
|
+
return (
|
|
734
|
+
f'<span class="jb" data-cite="{esc(cid)}">'
|
|
735
|
+
f'<button class="jb-name" type="button" aria-expanded="false">{CARET_SVG}'
|
|
736
|
+
f'<i class="jb-id">{esc(cid)}</i>'
|
|
737
|
+
f'<span class="jb-txt">{esc(jb["title"])}</span></button>'
|
|
738
|
+
f'<span class="jb-body"><span class="jb-head"><span class="jb-label">{SRC_ICO_SVG}溯源原文:</span>{link}</span>'
|
|
739
|
+
f'{site_html}'
|
|
740
|
+
f'{quote}</span></span>'
|
|
741
|
+
)
|
|
742
|
+
|
|
743
|
+
def make_block_repl(block_text: str):
|
|
744
|
+
"""按块构造角标替换器:同段同材料只保留最后一次出现的角标(前处整体删除),
|
|
745
|
+
最后一处挂数字角标 + 引文胶囊——一段中同一材料只出现一次。"""
|
|
746
|
+
remaining: Dict[str, int] = {}
|
|
747
|
+
for cid in re.findall(r"\[(\d+)\]", block_text):
|
|
748
|
+
remaining[cid] = remaining.get(cid, 0) + 1
|
|
749
|
+
|
|
750
|
+
def repl(match: re.Match[str]) -> str:
|
|
751
|
+
cid = match.group(1)
|
|
752
|
+
remaining[cid] = max(0, remaining.get(cid, 1) - 1)
|
|
753
|
+
if remaining[cid] > 0:
|
|
754
|
+
return ""
|
|
755
|
+
if cid in chip_map:
|
|
756
|
+
return jb_html(cid)
|
|
757
|
+
# 未绑定角标(无对应材料):红色数字警示,绝不按位置猜测
|
|
758
|
+
return f'<sup class="cite unresolved" data-cite="{esc(cid)}" title="核验依据 [{esc(cid)}?]">{esc(cid)}?</sup>'
|
|
759
|
+
|
|
760
|
+
return repl
|
|
566
761
|
|
|
567
762
|
blocks: List[Dict[str, Any]] = []
|
|
568
763
|
lines = answer.split("\n")
|
|
@@ -572,7 +767,11 @@ def parse_answer_blocks(answer: str, valid_ids: set) -> Tuple[List[Dict[str, Any
|
|
|
572
767
|
if not block:
|
|
573
768
|
idx += 1
|
|
574
769
|
continue
|
|
770
|
+
# 引文胶囊位置规范:角标与后随标点换位——标点紧跟文字,胶囊放标点之后
|
|
771
|
+
# (避免胶囊把句号挤到下一行孤悬,对齐深知晓原型"…内容。~出处"形态)
|
|
772
|
+
block = re.sub(r"\[(\d+)\]([。;,、!?:;,.])", r"\2[\1]", block)
|
|
575
773
|
ids = citation_ids(block)
|
|
774
|
+
repl = make_block_repl(block)
|
|
576
775
|
heading_match = re.match(r"^(#{1,4})\s+(.+)$", block)
|
|
577
776
|
if heading_match:
|
|
578
777
|
blocks.append({"kind": "heading", "level": len(heading_match.group(1)),
|
|
@@ -584,6 +783,7 @@ def parse_answer_blocks(answer: str, valid_ids: set) -> Tuple[List[Dict[str, Any
|
|
|
584
783
|
while idx < len(lines) and "|" in lines[idx].strip() and lines[idx].strip():
|
|
585
784
|
table_lines.append(lines[idx].strip())
|
|
586
785
|
idx += 1
|
|
786
|
+
repl = make_block_repl("\n".join(table_lines))
|
|
587
787
|
blocks.append({"kind": "table", "html": render_markdown_table(table_lines, repl), "cites": citation_ids("\n".join(table_lines))})
|
|
588
788
|
elif block in {"---", "***"}:
|
|
589
789
|
blocks.append({"kind": "hr", "html": '<hr class="doc-divider">', "cites": []})
|
|
@@ -652,38 +852,43 @@ def group_sections(blocks: List[Dict[str, Any]]) -> Tuple[Optional[str], List[Di
|
|
|
652
852
|
# 各部分渲染
|
|
653
853
|
# ============================================================
|
|
654
854
|
|
|
655
|
-
def
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
855
|
+
def build_chip_data(sources: List[Dict[str, str]]) -> Dict[str, Dict[str, str]]:
|
|
856
|
+
"""行内引文胶囊数据:id → {title, site, url, excerpt}。
|
|
857
|
+
|
|
858
|
+
角标后渲染原型式 jb(行内小胶囊,点击展开块级卡)。摘录展示完整
|
|
859
|
+
原文原段、不截断——段内去重后重复量可控,核对场景下就地读全文。
|
|
860
|
+
"""
|
|
861
|
+
chip_map: Dict[str, Dict[str, str]] = {}
|
|
862
|
+
for source in sources:
|
|
863
|
+
cid = source["id"]
|
|
864
|
+
if cid in chip_map:
|
|
661
865
|
continue
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
)
|
|
678
|
-
if not chips:
|
|
679
|
-
return ""
|
|
680
|
-
return f'<div class="ev-row">{"".join(chips)}</div>'
|
|
866
|
+
meta_bits = [v for v in [source.get("agency"), source.get("date")] if v and v != "未知来源"]
|
|
867
|
+
url = source.get("url") if (source.get("url") and source["url"] != "接口未返回") else (source.get("policy_url") or "")
|
|
868
|
+
if source.get("link_dead"):
|
|
869
|
+
url = source.get("snapshot") or ""
|
|
870
|
+
site_bits = ([source["doc_number"]] if source.get("doc_number") else []) + meta_bits
|
|
871
|
+
chip_map[cid] = {
|
|
872
|
+
"title": short(source.get("title") or "未命名材料", 30),
|
|
873
|
+
"site": " · ".join(site_bits) or "来源站点",
|
|
874
|
+
"url": url,
|
|
875
|
+
"snapshot": source.get("snapshot") or "",
|
|
876
|
+
"dead": bool(source.get("link_dead")),
|
|
877
|
+
"excerpt": (source.get("excerpt") or "").strip(),
|
|
878
|
+
"segments": source.get("segments") or [],
|
|
879
|
+
}
|
|
880
|
+
return chip_map
|
|
681
881
|
|
|
682
882
|
|
|
683
|
-
def render_source_links(url: str, policy_url: str = "") -> str:
|
|
883
|
+
def render_source_links(url: str, policy_url: str = "", snapshot: str = "", link_dead: bool = False) -> str:
|
|
884
|
+
"""链接区四态:原文可回看 / 原文失效改快照 / 原文失效无快照 / 无源网址有快照。
|
|
885
|
+
快照是接口对原文的存档副本,文案如实标注,不冒充原文链接。"""
|
|
684
886
|
links = []
|
|
685
|
-
if url and url != "接口未返回":
|
|
686
|
-
links.append(f'<a href="{esc(url)}" target="_blank" rel="noopener"
|
|
887
|
+
if url and url != "接口未返回" and not link_dead:
|
|
888
|
+
links.append(f'<a href="{esc(url)}" target="_blank" rel="noopener">查看全文 ↗</a>')
|
|
889
|
+
if snapshot:
|
|
890
|
+
# 有哪个显示哪个:快照统一展示"查看存档全文",不做原文失效的状态解释
|
|
891
|
+
links.append(f'<a class="snap" href="{esc(snapshot)}" target="_blank" rel="noopener">查看存档全文 ↗</a>')
|
|
687
892
|
if policy_url:
|
|
688
893
|
links.append(f'<a href="{esc(policy_url)}" target="_blank" rel="noopener">知识专库原文 ↗</a>')
|
|
689
894
|
if not links:
|
|
@@ -707,60 +912,61 @@ def render_verify_panel(v: Dict[str, Any]) -> str:
|
|
|
707
912
|
'<span class="d">未识别到来源材料</span></div>')
|
|
708
913
|
elif tr["passed"] == tr["total"]:
|
|
709
914
|
tr_html = (f'<div class="vi"><span class="s ok">✓ 依据溯源 {tr["passed"]}/{tr["total"]}</span>'
|
|
710
|
-
f'<span class="d"
|
|
915
|
+
f'<span class="d">每条素材摘录可比对,原文或存档快照可回看</span></div>')
|
|
711
916
|
else:
|
|
712
917
|
tr_html = (f'<div class="vi"><span class="s warn">◐ 依据溯源 {tr["passed"]}/{tr["total"]}</span>'
|
|
713
|
-
f'<span class="d"
|
|
918
|
+
f'<span class="d">待补摘录 {len(tr.get("missing_excerpts") or [])} 条</span></div>')
|
|
714
919
|
|
|
715
920
|
bd = v["binding"]
|
|
716
921
|
if bd.get("no_citation"):
|
|
717
|
-
bd_html = (f'<div class="vi"><span class="s fail">✗
|
|
718
|
-
f'<span class="d"
|
|
922
|
+
bd_html = (f'<div class="vi"><span class="s fail">✗ 引用对应 0/0</span>'
|
|
923
|
+
f'<span class="d">正文里没有来源角标,{v["traceability"]["total"]} 条材料对不上正文</span></div>')
|
|
719
924
|
elif not bd["total"]:
|
|
720
|
-
bd_html = '<div class="vi"><span class="s none">—
|
|
925
|
+
bd_html = '<div class="vi"><span class="s none">— 引用对应 0/0</span><span class="d">正文里没有来源角标</span></div>'
|
|
721
926
|
elif not bd["unbound"]:
|
|
722
|
-
bd_html = (f'<div class="vi"><span class="s ok">✓
|
|
723
|
-
f'<span class="d"
|
|
927
|
+
bd_html = (f'<div class="vi"><span class="s ok">✓ 引用对应 {bd["bound"]}/{bd["total"]}</span>'
|
|
928
|
+
f'<span class="d">正文每处 [n] 都能找到对应材料</span></div>')
|
|
724
929
|
else:
|
|
725
930
|
unbound_text = "、".join(f"[{esc(x)}]" for x in bd["unbound"][:8])
|
|
726
|
-
bd_html = (f'<div class="vi"><span class="s fail">✗
|
|
727
|
-
f'<span class="d"
|
|
931
|
+
bd_html = (f'<div class="vi"><span class="s fail">✗ 引用对应 {bd["bound"]}/{bd["total"]}</span>'
|
|
932
|
+
f'<span class="d">对不上的角标 {unbound_text}</span></div>')
|
|
728
933
|
|
|
729
934
|
fr = v["freshness"]
|
|
730
935
|
if fr:
|
|
731
936
|
rng = f"{fr['min'][0]}-{fr['min'][1]:02d}~{fr['max'][0]}-{fr['max'][1]:02d}"
|
|
732
|
-
old = f"({fr['old_count']}
|
|
733
|
-
fr_html = f'<div class="vi"><span class="s ok">✓
|
|
937
|
+
old = f"({fr['old_count']} 条年头较久,按参考口径使用)" if fr["old_count"] else ""
|
|
938
|
+
fr_html = f'<div class="vi"><span class="s ok">✓ 材料新旧 已核</span><span class="d">材料日期 {esc(rng)}{esc(old)}</span></div>'
|
|
734
939
|
else:
|
|
735
|
-
fr_html = '<div class="vi"><span class="s none">—
|
|
940
|
+
fr_html = '<div class="vi"><span class="s none">— 材料新旧 未记录</span><span class="d">材料没标发布日期</span></div>'
|
|
736
941
|
|
|
737
942
|
cov = v["coverage"]
|
|
738
943
|
parts = [f"{KIND_CATALOG[k][0]} {cov[k]}" for k in ("policy", "data", "case", "reference") if cov.get(k)]
|
|
739
944
|
cov_state = "ok" if cov.get("policy") or cov.get("data") or cov.get("case") else "none"
|
|
740
|
-
cov_html = (f'<div class="vi"><span class="s {cov_state}">{"✓" if cov_state == "ok" else "—"}
|
|
741
|
-
f'<span class="d">{esc(" · ".join(parts)) if parts else "
|
|
945
|
+
cov_html = (f'<div class="vi"><span class="s {cov_state}">{"✓" if cov_state == "ok" else "—"} 材料构成</span>'
|
|
946
|
+
f'<span class="d">{esc(" · ".join(parts)) if parts else "材料没标类型"}</span></div>')
|
|
742
947
|
|
|
743
948
|
sc = v["self_check"]
|
|
744
949
|
if sc["status"] == "pass":
|
|
745
950
|
notes = ";".join(note for _, note in sc["items"].values() if note)
|
|
746
951
|
title_attr = f' title="{esc(notes)}"' if notes else ""
|
|
747
|
-
|
|
748
|
-
|
|
952
|
+
item_names = "、".join(sc["items"].keys()) if sc["items"] else "、".join(label for _, label in SELF_CHECK_ITEMS)
|
|
953
|
+
sc_html = (f'<div class="vi"><span class="s ok"{title_attr}>✓ 交付前检查 {sc["passed"]}/{sc["total"]}</span>'
|
|
954
|
+
f'<span class="d">{esc(item_names)}{esc(" · 悬停查看说明" if notes else "")}</span></div>')
|
|
749
955
|
elif sc["status"] == "fail":
|
|
750
956
|
failed_parts = []
|
|
751
957
|
for label, (status, note) in sc["items"].items():
|
|
752
958
|
if status != "pass":
|
|
753
959
|
suffix = f"({note[:40]}…)" if len(note) > 40 else (f"({note})" if note else "")
|
|
754
960
|
failed_parts.append(label + suffix)
|
|
755
|
-
sc_html = (f'<div class="vi"><span class="s fail">✗
|
|
756
|
-
f'<span class="d"
|
|
961
|
+
sc_html = (f'<div class="vi"><span class="s fail">✗ 交付前检查 {sc["passed"]}/{sc["total"]}</span>'
|
|
962
|
+
f'<span class="d">没过的项:{esc("、".join(failed_parts))}</span></div>')
|
|
757
963
|
else:
|
|
758
|
-
sc_html = '<div class="vi"><span class="s none">—
|
|
964
|
+
sc_html = '<div class="vi"><span class="s none">— 交付前检查 未记录</span><span class="d">本次溯源 JSON 没写入检查结果</span></div>'
|
|
759
965
|
|
|
760
966
|
manual = ""
|
|
761
967
|
if v["policy_count"]:
|
|
762
|
-
manual = (f'<div class="vi"><span class="s man">◐
|
|
763
|
-
f'<span class="d">{v["policy_count"]}
|
|
968
|
+
manual = (f'<div class="vi"><span class="s man">◐ 现行效力</span>'
|
|
969
|
+
f'<span class="d">{v["policy_count"]} 份政策文件建议按官方发布确认是否现行有效</span></div>')
|
|
764
970
|
|
|
765
971
|
return f"""
|
|
766
972
|
<div class="verify {state}">
|
|
@@ -769,50 +975,142 @@ def render_verify_panel(v: Dict[str, Any]) -> str:
|
|
|
769
975
|
<div class="v-grid">
|
|
770
976
|
{tr_html}{bd_html}{fr_html}{cov_html}{sc_html}{manual}
|
|
771
977
|
</div>
|
|
772
|
-
<div class="v-note"
|
|
978
|
+
<div class="v-note">核验方式:先用深知可信搜索找权威来源,再把正文每处依据和原文逐条比对(都能点开原文回看),最后做了交付前五项检查。政策是否现行有效,以官方发布为准。{manual_checks_html}</div>
|
|
773
979
|
</div>"""
|
|
774
980
|
|
|
775
981
|
|
|
982
|
+
SRC_ICO_SVG = ('<svg viewBox="0 0 24 24" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.8" '
|
|
983
|
+
'stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">'
|
|
984
|
+
'<path d="M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z"/><path d="M14 3v5h5"/>'
|
|
985
|
+
'<path d="M9 13h6M9 17h4"/></svg>')
|
|
986
|
+
ARROW_SVG = ('<svg viewBox="0 0 24 24" width="11" height="11" fill="none" stroke="currentColor" stroke-width="2.2" '
|
|
987
|
+
'stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M7 17 17 7M9 7h8v8"/></svg>')
|
|
988
|
+
CARET_SVG = ('<svg viewBox="0 0 24 24" width="12" height="12" fill="none" stroke="currentColor" stroke-width="2.4" '
|
|
989
|
+
'stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg>')
|
|
990
|
+
|
|
991
|
+
|
|
992
|
+
def render_src_card(jb: Dict[str, str], cid: str, dup: bool = False) -> str:
|
|
993
|
+
"""句后溯源卡(原型 cardHTML 的 Python 移植):标题 + 来源 + 查看原文 + 摘录展开。"""
|
|
994
|
+
src = jb.get("source") or "来源站点"
|
|
995
|
+
url = jb.get("url") or ""
|
|
996
|
+
title = re.sub(r"<br\s*/?>", " ", str(jb.get("title") or ""), flags=re.I)
|
|
997
|
+
excerpt = (jb.get("excerpt") or "").strip()
|
|
998
|
+
dup_cls = " dup-card" if dup else ""
|
|
999
|
+
link_html = (f'<a class="src-link" href="{esc(url)}" target="_blank" rel="noopener noreferrer">查看全文{ARROW_SVG}</a>' if url else "")
|
|
1000
|
+
toggle_html = (f'<button class="src-toggle" type="button"><span class="more">展开</span>'
|
|
1001
|
+
f'<span class="less">收起</span>{CARET_SVG}</button>' if excerpt else "")
|
|
1002
|
+
body_html = f'<div class="src-body"><p>{esc(excerpt)}</p></div>' if excerpt else ""
|
|
1003
|
+
return (
|
|
1004
|
+
f'<figure class="src-card{dup_cls}" data-cite="{esc(cid)}">'
|
|
1005
|
+
f'<div class="src-head"><span class="src-ico" aria-hidden="true">{SRC_ICO_SVG}</span>'
|
|
1006
|
+
f'<figcaption class="src-title">{esc(title)}</figcaption></div>'
|
|
1007
|
+
f'<div class="src-meta"><span class="src-site" title="{esc(src)}"><span class="dot"></span>{esc(src)}</span>'
|
|
1008
|
+
f'{link_html}{toggle_html}</div>{body_html}</figure>'
|
|
1009
|
+
)
|
|
1010
|
+
|
|
1011
|
+
|
|
776
1012
|
def render_section_cards(sections: List[Dict[str, Any]], sources: List[Dict[str, str]]) -> str:
|
|
1013
|
+
"""正文渲染(原型复刻):chapter(h2)+ lead/para 段落 + 段后 src-card 溯源卡。
|
|
1014
|
+
|
|
1015
|
+
溯源卡按段内角标顺序输出;同一材料在同段只出一张,跨段重复出现标记 dup-card(灰化)。
|
|
1016
|
+
"""
|
|
1017
|
+
parts: List[str] = []
|
|
1018
|
+
first_para = True
|
|
777
1019
|
source_ids = {s["id"] for s in sources}
|
|
778
|
-
|
|
779
|
-
|
|
1020
|
+
for sec_idx, sec in enumerate(sections, 1):
|
|
1021
|
+
number, title_text = split_heading_number(sec["title"] or "")
|
|
1022
|
+
chapter_title = f"{number}、{title_text}" if (number and title_text) else (title_text or "")
|
|
780
1023
|
sec_cites: List[str] = []
|
|
781
1024
|
for b in sec["blocks"]:
|
|
782
1025
|
for cid in b.get("cites", []):
|
|
783
1026
|
if cid not in sec_cites:
|
|
784
1027
|
sec_cites.append(cid)
|
|
785
|
-
|
|
786
|
-
number, title_text = split_heading_number(sec["title"] or "")
|
|
787
|
-
no_html = f'<span class="sec-no">{esc(number)}</span>' if number else ""
|
|
788
|
-
title_html = f"<h3>{esc(title_text)}</h3>" if title_text else ""
|
|
789
|
-
if sec_cites:
|
|
790
|
-
badge_state = "bad" if unbound_count else ""
|
|
791
|
-
badge_text = f"本章引用 {len(sec_cites)} 处" + (f" · {unbound_count} 处未绑定" if unbound_count else " · 已核验")
|
|
792
|
-
badge_html = f'<span class="sec-badge {badge_state}">{esc(badge_text)}</span>'
|
|
793
|
-
else:
|
|
1028
|
+
if chapter_title:
|
|
794
1029
|
badge_html = ""
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
1030
|
+
if sec_cites:
|
|
1031
|
+
unbound = sum(1 for cid in sec_cites if cid not in source_ids)
|
|
1032
|
+
state = "bad" if unbound else ""
|
|
1033
|
+
text = f"本章引用 {len(sec_cites)} 处" + (f" · {unbound} 处未绑定" if unbound else " · 已核验")
|
|
1034
|
+
badge_html = f'<span class="sec-badge {state}">{esc(text)}</span>'
|
|
1035
|
+
parts.append(f'<section class="chapter" id="sec-{sec_idx}">'
|
|
1036
|
+
f'<header class="ch-head"><h2>{esc(chapter_title)}</h2>{badge_html}</header>')
|
|
798
1037
|
for b in sec["blocks"]:
|
|
799
1038
|
if b["kind"] == "heading":
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
1039
|
+
parts.append(f'<p class="para"><b class="kw">{esc(b["text"])}</b></p>')
|
|
1040
|
+
first_para = False
|
|
1041
|
+
continue
|
|
1042
|
+
cls = "lead" if first_para else "para"
|
|
1043
|
+
first_para = False
|
|
1044
|
+
if b["kind"] == "list_item":
|
|
803
1045
|
marker = f'{esc(b.get("number", "•"))}.' if b.get("numbered") else "•"
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
)
|
|
1046
|
+
parts.append(f'<p class="{cls}"><b class="kw">{marker}</b> {b["html"]}</p>')
|
|
1047
|
+
elif b["kind"] == "hr":
|
|
1048
|
+
parts.append('<hr class="doc-divider">')
|
|
808
1049
|
else:
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
1050
|
+
parts.append(f'<p class="{cls}">{b["html"]}</p>')
|
|
1051
|
+
if chapter_title:
|
|
1052
|
+
parts.append("</section>")
|
|
1053
|
+
return "\n".join(parts)
|
|
1054
|
+
|
|
1055
|
+
|
|
1056
|
+
def strip_leading_chain(text: str, chain: List[str]) -> str:
|
|
1057
|
+
"""剥掉段落文本开头与标题链各级重复的前缀。
|
|
1058
|
+
|
|
1059
|
+
接口部分材料的"内容"字段自带段落标题前缀(个别还重复两遍),标题链已承载
|
|
1060
|
+
位置信息,摘录开头再出现同级文本即冗余;逐级最长匹配剥离,无重复则原样返回。
|
|
1061
|
+
"""
|
|
1062
|
+
t = (text or "").strip()
|
|
1063
|
+
cands = set()
|
|
1064
|
+
for lvl in chain:
|
|
1065
|
+
lvl = (lvl or "").strip()
|
|
1066
|
+
if lvl:
|
|
1067
|
+
cands.add(lvl)
|
|
1068
|
+
# 粘连标题(接口未给分隔符,如"建设交通强省5.民航和低空")拆出编号尾部子串
|
|
1069
|
+
parts = re.split(r"(?<=[\u4e00-\u9fff])(?=\d+[.、])", lvl)
|
|
1070
|
+
if len(parts) > 1 and parts[-1].strip():
|
|
1071
|
+
cands.add(parts[-1].strip())
|
|
1072
|
+
levels = sorted(cands, key=len, reverse=True)
|
|
1073
|
+
changed = True
|
|
1074
|
+
while changed and t:
|
|
1075
|
+
changed = False
|
|
1076
|
+
for lvl in levels:
|
|
1077
|
+
if t.startswith(lvl):
|
|
1078
|
+
t = t[len(lvl):].lstrip(" \n\r\t、。;;,,").strip()
|
|
1079
|
+
changed = True
|
|
1080
|
+
break
|
|
1081
|
+
return t
|
|
1082
|
+
|
|
1083
|
+
|
|
1084
|
+
def render_crumb(chain: List[str]) -> str:
|
|
1085
|
+
"""面包屑标题链:文章 › 章 › 节(标题链是模型生成的结构化位置,核验核心抓手)。"""
|
|
1086
|
+
parts = [esc(level) for level in chain if level]
|
|
1087
|
+
if not parts:
|
|
1088
|
+
return ""
|
|
1089
|
+
return '<span class="crumb">' + ' <i>›</i> '.join(parts) + "</span>"
|
|
1090
|
+
|
|
1091
|
+
|
|
1092
|
+
def render_segments(source: Dict[str, Any]) -> str:
|
|
1093
|
+
"""多段分块摘录:每段独立区块,各带自己的标题链——段落结构与位置直接可见。"""
|
|
1094
|
+
segments = source.get("segments") or []
|
|
1095
|
+
if not segments:
|
|
1096
|
+
return render_excerpt_html(source.get("excerpt") or "接口返回中未识别到可展示的摘录。")
|
|
1097
|
+
blocks = []
|
|
1098
|
+
for seg in segments:
|
|
1099
|
+
text = (seg.get("text") or "").strip()
|
|
1100
|
+
if not text:
|
|
1101
|
+
continue
|
|
1102
|
+
blocks.append(f'<div class="seg-block">{render_crumb(seg.get("chain") or [])}'
|
|
1103
|
+
f'{render_excerpt_html(text)}</div>')
|
|
1104
|
+
return "".join(blocks) if blocks else render_excerpt_html(source.get("excerpt") or "接口返回中未识别到可展示的摘录。")
|
|
812
1105
|
|
|
813
1106
|
|
|
814
|
-
def render_source_card(source: Dict[str, str]) -> str:
|
|
815
|
-
if source.get("
|
|
1107
|
+
def render_source_card(source: Dict[str, str], for_print: bool = False) -> str:
|
|
1108
|
+
if not source.get("used", True):
|
|
1109
|
+
# 未引用召回材料:不标"已核验"(未进入正文核验流程),只标可否查看
|
|
1110
|
+
vk = ('<span class="sc-vk" style="color:var(--muted)">可查看全文</span>' if source.get("has_link")
|
|
1111
|
+
else '<span class="sc-vk warn">待补链接</span>')
|
|
1112
|
+
note_html = ""
|
|
1113
|
+
elif source.get("verified"):
|
|
816
1114
|
note = source.get("verify_note") or "摘录可比对,原文链接与知识专库可回看"
|
|
817
1115
|
vk = f'<span class="sc-vk ok" title="{esc(note)}">✓ 已核验</span>'
|
|
818
1116
|
note_html = f'<div class="sc-vnote">{esc(short(note, 90))}</div>' if source.get("verify_note") else ""
|
|
@@ -820,77 +1118,158 @@ def render_source_card(source: Dict[str, str]) -> str:
|
|
|
820
1118
|
reason = "待补原文链接" if not source.get("has_link") else "待补摘录"
|
|
821
1119
|
vk = f'<span class="sc-vk warn">◐ {reason}</span>'
|
|
822
1120
|
note_html = ""
|
|
823
|
-
links = render_source_links(source.get("url"), source.get("policy_url", ""))
|
|
824
|
-
|
|
825
|
-
|
|
1121
|
+
links = render_source_links(source.get("url"), source.get("policy_url", ""), source.get("snapshot", ""), source.get("link_dead", False))
|
|
1122
|
+
# 关键性行:有文号(接口 policyFiles 匹配)时"文号 · 数据源 · 日期",否则"数据源 · 日期"
|
|
1123
|
+
meta_parts = [v for v in [source.get("doc_number"), source.get("agency"), source.get("date"), source.get("area")]
|
|
1124
|
+
if v and v != "未知来源"]
|
|
1125
|
+
meta = " | ".join(meta_parts)
|
|
1126
|
+
# 高可信徽标:仅"发布日期可信度=高"(模型治理入库、标题模型精抽)的材料;"较高"(门户抓取)不标。
|
|
1127
|
+
conf_badge = ""
|
|
1128
|
+
if source.get("conf") == "高":
|
|
1129
|
+
conf_badge = ('<span class="sc-conf" title="发布日期可信度:高。内容经模型治理入库,'
|
|
1130
|
+
'标题为模型从原文动态抽取,非规则提取">高可信</span>')
|
|
1131
|
+
# 已引用材料显示角标编号;未引用召回材料显示"未引用"灰标(不占正文角标号)
|
|
1132
|
+
id_html = f'<span class="sc-id">[{esc(source["id"])}]</span>' if source.get("used", True) else '<span class="sc-unused">未引用</span>'
|
|
1133
|
+
body_html = (f'<div class="sc-head">{id_html}'
|
|
1134
|
+
f'<span class="sc-type">{esc(source["type_label"])}</span>{conf_badge}{vk}</div>'
|
|
1135
|
+
f'<h4>{esc(source.get("title"))}</h4>'
|
|
1136
|
+
f'<div class="sc-meta">{esc(meta)}</div>'
|
|
1137
|
+
f'{note_html}'
|
|
1138
|
+
f'{render_segments(source)}'
|
|
1139
|
+
f'{links}')
|
|
1140
|
+
if for_print:
|
|
1141
|
+
# 打印附录版:无交互属性,避免与专库卡片 id 冲突
|
|
1142
|
+
return f'<article class="scard print-only {source["type_css"]}">{body_html}</article>'
|
|
1143
|
+
unused_attr = "" if source.get("used", True) else ' data-unused="1"'
|
|
826
1144
|
return (
|
|
827
|
-
f'<article class="scard {source["type_css"]}" id="src-{esc(source["id"])}" data-type="{esc(source["type_key"])}"
|
|
828
|
-
f'
|
|
829
|
-
f'<span class="sc-type">{esc(source["type_label"])}</span>{vk}</div>'
|
|
830
|
-
f'<h4>{esc(source.get("title"))}</h4>'
|
|
831
|
-
f'<div class="sc-meta">{esc(meta)}</div>'
|
|
832
|
-
f'{section_html}{note_html}'
|
|
833
|
-
f'{render_excerpt_html(source.get("excerpt") or "接口返回中未识别到可展示的摘录。")}'
|
|
834
|
-
f'{links}</article>'
|
|
1145
|
+
f'<article class="scard {source["type_css"]}" id="src-{esc(source["id"])}" data-type="{esc(source["type_key"])}" '
|
|
1146
|
+
f'data-cite-id="{esc(source["id"])}" data-search="{esc(source.get("search_key", ""))}"{unused_attr}>{body_html}</article>'
|
|
835
1147
|
)
|
|
836
1148
|
|
|
837
1149
|
|
|
838
|
-
def
|
|
1150
|
+
def render_process_bar(stats: Dict[str, Any], verification: Dict[str, Any]) -> str:
|
|
1151
|
+
"""过程回顾条:静态回放真实流程。无思考流数据,不做"深度思考"步骤。"""
|
|
1152
|
+
ov = verification["overall"]
|
|
1153
|
+
tr = verification["traceability"]
|
|
1154
|
+
first_query = stats["conds"][0]["key"] if stats["conds"] else ""
|
|
1155
|
+
detail_rows = "".join(
|
|
1156
|
+
f'<div class="pd-row"><b>{esc(row["key"])}</b>'
|
|
1157
|
+
f'<span>召回 {row["total"]} 条 · 正文采用 {row["used"]} 条</span></div>'
|
|
1158
|
+
for row in stats["conds"]
|
|
1159
|
+
) or '<div class="pd-row"><span>本次溯源 JSON 未记录各次检索条件</span></div>'
|
|
1160
|
+
detail_hint = f'{esc(short(first_query, 26))}…' if (stats["n_searches"] > 1 and first_query) else "查看检索明细"
|
|
1161
|
+
if stats["n_searches"] > 1:
|
|
1162
|
+
step1_sub = f"共 {stats['n_searches']} 路检索 · {detail_hint}"
|
|
1163
|
+
elif first_query:
|
|
1164
|
+
step1_sub = esc(short(first_query, 26))
|
|
1165
|
+
else:
|
|
1166
|
+
step1_sub = "深知可信搜索"
|
|
1167
|
+
step4_state = "done" if ov["passed"] else "bad"
|
|
1168
|
+
step4_icon = "✓" if ov["passed"] else "!"
|
|
1169
|
+
step4_label = "核验完成" if ov["passed"] else "核验未完全通过"
|
|
1170
|
+
step4_sub = "结论:正文依据逐条对过原文" if ov["passed"] else esc(short(";".join(ov["reasons"]) or "见核验报告单", 30))
|
|
1171
|
+
return f"""
|
|
1172
|
+
<section class="process" aria-label="生成过程回顾">
|
|
1173
|
+
<div class="p-head"><b>过程回顾</b><span>数字来自本次任务的真实记录</span></div>
|
|
1174
|
+
<ol class="p-steps">
|
|
1175
|
+
<li class="p-step expandable" id="p-step-search" role="button" tabindex="0" title="展开各路检索明细">
|
|
1176
|
+
<span class="p-no">1</span>
|
|
1177
|
+
<div class="p-txt"><b>深知检索 {stats['n_searches']} 次</b><i>{step1_sub}</i></div>
|
|
1178
|
+
</li>
|
|
1179
|
+
<li class="p-arrow" aria-hidden="true">›</li>
|
|
1180
|
+
<li class="p-step">
|
|
1181
|
+
<span class="p-no">2</span>
|
|
1182
|
+
<div class="p-txt"><b>材料入库 {stats['n_materials']} 条</b><i>正文采用 {stats['used_count']} · 召回未采用 {stats['unused_count']}</i></div>
|
|
1183
|
+
</li>
|
|
1184
|
+
<li class="p-arrow" aria-hidden="true">›</li>
|
|
1185
|
+
<li class="p-step">
|
|
1186
|
+
<span class="p-no">3</span>
|
|
1187
|
+
<div class="p-txt"><b>逐条比对原文</b><i>依据溯源 {tr['passed']}/{tr['total']} · 摘录可比对</i></div>
|
|
1188
|
+
</li>
|
|
1189
|
+
<li class="p-arrow" aria-hidden="true">›</li>
|
|
1190
|
+
<li class="p-step {step4_state}">
|
|
1191
|
+
<span class="p-no">{step4_icon}</span>
|
|
1192
|
+
<div class="p-txt"><b>{esc(step4_label)}</b><i>{step4_sub}</i></div>
|
|
1193
|
+
</li>
|
|
1194
|
+
</ol>
|
|
1195
|
+
<div class="p-detail" id="p-detail">{detail_rows}</div>
|
|
1196
|
+
</section>"""
|
|
1197
|
+
|
|
1198
|
+
|
|
1199
|
+
def render_library_view(sources: List[Dict[str, str]], hot_terms: List[str]) -> str:
|
|
1200
|
+
"""材料专库全屏视图:大搜索 + 热词 + 检索分组 tabs + 材料卡列表。"""
|
|
839
1201
|
if not sources:
|
|
840
|
-
return '<
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
'<
|
|
866
|
-
f'<
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
1202
|
+
return ('<section class="view" id="view-library" aria-label="材料专库">'
|
|
1203
|
+
'<div class="lib-empty">接口返回中未识别到可展示的材料。</div></section>')
|
|
1204
|
+
used_sources = [s for s in sources if s.get("used", True)]
|
|
1205
|
+
unused_sources = [s for s in sources if not s.get("used", True)]
|
|
1206
|
+
|
|
1207
|
+
# tabs = 检索分组(全部 / 各路检索 / 未引用),数字真实统计
|
|
1208
|
+
conds: List[Tuple[str, int]] = []
|
|
1209
|
+
for s in sources:
|
|
1210
|
+
key = (s.get("search_key") or "").strip()
|
|
1211
|
+
if not key:
|
|
1212
|
+
continue
|
|
1213
|
+
for i, (name, count) in enumerate(conds):
|
|
1214
|
+
if name == key:
|
|
1215
|
+
conds[i] = (name, count + 1)
|
|
1216
|
+
break
|
|
1217
|
+
else:
|
|
1218
|
+
conds.append((key, 1))
|
|
1219
|
+
tabs = [f'<button class="on" data-cond="" type="button">全部({len(sources)})</button>']
|
|
1220
|
+
for name, count in conds:
|
|
1221
|
+
tabs.append(f'<button data-cond="{esc(name)}" type="button">{esc(name)}({count})</button>')
|
|
1222
|
+
if unused_sources:
|
|
1223
|
+
tabs.append(f'<button data-cond="__unused__" type="button">未引用({len(unused_sources)})</button>')
|
|
1224
|
+
|
|
1225
|
+
hot_html = ""
|
|
1226
|
+
if hot_terms:
|
|
1227
|
+
hot_items = "".join(f'<button class="hot-term" type="button">{esc(term)}</button>' for term in hot_terms)
|
|
1228
|
+
hot_html = f'<div class="hot-terms" aria-label="热门搜索词"><span class="hot-label">大家都在搜</span>{hot_items}</div>'
|
|
1229
|
+
|
|
1230
|
+
cards_html = "".join(render_source_card(s) for s in used_sources)
|
|
1231
|
+
cards_html += "".join(render_source_card(s) for s in unused_sources)
|
|
1232
|
+
|
|
1233
|
+
cited_verified = sum(1 for s in used_sources if s.get("verified"))
|
|
1234
|
+
badge = "全部已核验" if used_sources and cited_verified == len(used_sources) else f"{cited_verified}/{len(used_sources)} 已核验"
|
|
1235
|
+
return f"""
|
|
1236
|
+
<section class="view" id="view-library" aria-label="材料专库">
|
|
1237
|
+
<div class="lib-head">
|
|
1238
|
+
<div class="lib-title"><b>材料专库</b>
|
|
1239
|
+
<span>共 {len(sources)} 条 · 已引用 {len(used_sources)} · {esc(badge)}</span>
|
|
1240
|
+
</div>
|
|
1241
|
+
<div class="lib-searchWrap">
|
|
1242
|
+
<span class="lib-searchIcon" aria-hidden="true">⌕</span>
|
|
1243
|
+
<input class="lib-search" type="search" placeholder="搜索标题 / 来源 / 摘录…" aria-label="搜索材料">
|
|
1244
|
+
</div>
|
|
1245
|
+
{hot_html}
|
|
1246
|
+
<div class="lib-tabs" role="tablist" aria-label="按检索分组筛选">{"".join(tabs)}</div>
|
|
1247
|
+
</div>
|
|
1248
|
+
<div class="lib-list" id="lib-list">{cards_html}</div>
|
|
1249
|
+
<div class="lib-empty hide" id="lib-empty">没有符合当前筛选的材料。</div>
|
|
1250
|
+
<div class="lib-foot">材料来源:深知可信搜索 · 每条摘录均取自原文原段</div>
|
|
1251
|
+
</section>"""
|
|
874
1252
|
|
|
875
1253
|
|
|
876
|
-
def
|
|
877
|
-
|
|
1254
|
+
def render_toc(sections: List[Dict[str, Any]]) -> str:
|
|
1255
|
+
"""章节目录(滚动 spy):长报告(≥6 节)显示,桌面端左侧浮动。"""
|
|
1256
|
+
if len(sections) < 6:
|
|
878
1257
|
return ""
|
|
879
|
-
|
|
880
|
-
for
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
1258
|
+
items = []
|
|
1259
|
+
for i, sec in enumerate(sections, 1):
|
|
1260
|
+
number, title_text = split_heading_number(sec["title"] or "")
|
|
1261
|
+
label = f"{number} {title_text}" if (number and title_text) else (title_text or f"第 {i} 节")
|
|
1262
|
+
items.append(f'<a href="#sec-{i}">{esc(short(label, 16))}</a>')
|
|
1263
|
+
return f'<nav class="toc" aria-label="章节目录">{"".join(items)}</nav>'
|
|
1264
|
+
|
|
1265
|
+
|
|
1266
|
+
def render_print_appendix(sources: List[Dict[str, str]]) -> str:
|
|
1267
|
+
"""打印归档附录:全部材料卡全展开(屏幕不显示,仅打印)。"""
|
|
1268
|
+
if not sources:
|
|
1269
|
+
return ""
|
|
1270
|
+
cards = "".join(render_source_card(s, for_print=True) for s in sources)
|
|
1271
|
+
return (f'<section class="print-appendix" aria-label="核验材料附录(打印归档)">'
|
|
1272
|
+
f'<h3>核验材料(全 {len(sources)} 条)</h3>{cards}</section>')
|
|
894
1273
|
|
|
895
1274
|
|
|
896
1275
|
def safe_output_filename(question: str, timestamp: datetime, fallback: str = "dknowc_search_trace", suffix_ext: str = ".html") -> str:
|
|
@@ -905,18 +1284,741 @@ def safe_output_filename(question: str, timestamp: datetime, fallback: str = "dk
|
|
|
905
1284
|
return f"{stem}_{suffix}{suffix_ext}"
|
|
906
1285
|
|
|
907
1286
|
|
|
1287
|
+
# ============================================================
|
|
1288
|
+
# 样式与脚本(独立常量,避免模板转义)
|
|
1289
|
+
# ============================================================
|
|
1290
|
+
|
|
1291
|
+
PAGE_CSS = """
|
|
1292
|
+
:root{
|
|
1293
|
+
--navy:#20242c; --navy-2:#3a4152;
|
|
1294
|
+
--ink:#1f2328; --muted:#6b7280; --line:#e5e7eb; --line-strong:#cbd2dd;
|
|
1295
|
+
--brand:#6512ad; --brand-2:#8b5cf6; --brand-soft:#ede9fe;
|
|
1296
|
+
--grad:linear-gradient(135deg,#6512ad,#8b5cf6);
|
|
1297
|
+
--policy:#0f9d6e; --policy-soft:#e3f5ee;
|
|
1298
|
+
--case:#9a6700; --case-soft:#fdf3dc;
|
|
1299
|
+
--ref:#4b5563; --ref-soft:#f0f1f4;
|
|
1300
|
+
--warn:#9a6700; --danger:#e5484d; --ok:#0f9d6e;
|
|
1301
|
+
--shadow-1:0 1px 3px rgba(24,20,40,.04),0 8px 30px rgba(24,20,40,.08);
|
|
1302
|
+
--shadow-2:0 3px 9px rgba(101,18,173,.22),0 14px 36px rgba(24,20,40,.14);
|
|
1303
|
+
--primary-bright:#8b5cf6; --tint:#f3edfc; --tint-2:#faf7ff; --tint-bd:#e9dff9;
|
|
1304
|
+
--tint-strong:#e6d9f9; --tint-bd-strong:#d3bef0; --body-c:#3b4152; --card-bd:#e8e6f0;
|
|
1305
|
+
}
|
|
1306
|
+
*{box-sizing:border-box}
|
|
1307
|
+
html{scroll-behavior:smooth}
|
|
1308
|
+
body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text","Segoe UI",Roboto,"PingFang SC","HarmonyOS Sans SC","Microsoft YaHei",sans-serif;
|
|
1309
|
+
color:var(--ink);background:#f4f5f7;line-height:1.75;font-size:14.5px}
|
|
1310
|
+
a{color:var(--brand)}
|
|
1311
|
+
|
|
1312
|
+
/* ===== 顶栏 ===== */
|
|
1313
|
+
.topbar{position:sticky;top:0;z-index:50;display:flex;justify-content:space-between;align-items:center;gap:10px;
|
|
1314
|
+
padding:9px 22px;background:rgba(255,255,255,.92);backdrop-filter:blur(10px);
|
|
1315
|
+
border-bottom:1px solid var(--line)}
|
|
1316
|
+
.tb-left{display:flex;align-items:center;gap:10px;min-width:0}
|
|
1317
|
+
.tb-stamp{flex:none;font-size:12.5px;font-weight:800;color:var(--navy);letter-spacing:4px;text-indent:4px}
|
|
1318
|
+
.tb-stamp::before,.tb-stamp::after{content:"";display:inline-block;width:22px;border-top:1px solid var(--line-strong);
|
|
1319
|
+
vertical-align:middle;margin:0 6px}
|
|
1320
|
+
.tb-title{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--muted);font-size:13px}
|
|
1321
|
+
.tb-right{display:flex;align-items:center;gap:8px;flex:none}
|
|
1322
|
+
.view-switch{display:inline-flex;border:1px solid var(--line);border-radius:999px;overflow:hidden;background:#fff}
|
|
1323
|
+
.view-switch button{border:0;background:transparent;color:var(--muted);font-size:12.5px;font-weight:700;
|
|
1324
|
+
padding:5px 14px;cursor:pointer}
|
|
1325
|
+
.view-switch button.on{background:var(--grad);color:#fff}
|
|
1326
|
+
.tb-tools{display:flex;gap:6px}
|
|
1327
|
+
.tb-tools button{border:1px solid var(--line);border-radius:8px;background:#fff;color:#3b3550;
|
|
1328
|
+
font-size:12.5px;font-weight:700;padding:5px 11px;cursor:pointer}
|
|
1329
|
+
.tb-tools button:hover{border-color:var(--brand-2);color:var(--brand)}
|
|
1330
|
+
.tb-tools button[aria-pressed="true"]{background:var(--grad);border-color:var(--brand);color:#fff}
|
|
1331
|
+
.print-menu{position:relative;display:inline-flex}
|
|
1332
|
+
.print-drop{position:absolute;top:calc(100% + 6px);right:0;z-index:70;display:flex;flex-direction:column;gap:4px;
|
|
1333
|
+
min-width:190px;padding:6px;background:#fff;border:1px solid var(--tint-bd);border-radius:10px;
|
|
1334
|
+
box-shadow:var(--shadow-2);text-align:left}
|
|
1335
|
+
.print-drop[hidden]{display:none}
|
|
1336
|
+
.print-drop button{border:0;background:none;border-radius:7px;color:var(--ink);font-size:12.5px;font-weight:600;
|
|
1337
|
+
padding:8px 12px;cursor:pointer;text-align:left;font-family:inherit;white-space:nowrap}
|
|
1338
|
+
.print-drop button:hover{background:var(--tint);color:var(--brand)}
|
|
1339
|
+
.progress{position:absolute;left:0;right:0;bottom:-1px;height:2px;background:transparent}
|
|
1340
|
+
.progress i{display:block;height:100%;width:0;background:linear-gradient(90deg,#6512ad,#8b5cf6)}
|
|
1341
|
+
|
|
1342
|
+
/* ===== Hero ===== */
|
|
1343
|
+
.hero{position:relative;background:linear-gradient(180deg,#fbfaff 0%,#f7f4fd 100%);
|
|
1344
|
+
color:var(--ink);padding:32px 22px 58px;text-align:center;border-bottom:1px solid var(--line)}
|
|
1345
|
+
.r-badge{display:inline-flex;align-items:center;gap:14px;margin:0 0 8px;
|
|
1346
|
+
background:var(--grad);color:#fff;border-radius:999px;padding:4px 22px;
|
|
1347
|
+
font-size:15px;font-weight:800;letter-spacing:7px;text-indent:7px;line-height:1.6;
|
|
1348
|
+
box-shadow:0 2px 8px rgba(101,18,173,.22)}
|
|
1349
|
+
.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)}
|
|
1350
|
+
.hero .meta{color:var(--muted);font-size:13px;letter-spacing:.5px}
|
|
1351
|
+
.hero-switch{margin-top:16px;display:flex;justify-content:center}
|
|
1352
|
+
.hero-switch .view-switch{border-color:#d9c9f4;background:#fff;box-shadow:0 1px 3px rgba(24,20,40,.04)}
|
|
1353
|
+
.hero-switch .view-switch button{color:#70678a;padding:6px 22px;font-size:13px}
|
|
1354
|
+
.hero-switch .view-switch button.on{background:var(--grad);color:#fff}
|
|
1355
|
+
|
|
1356
|
+
/* ===== 容器与视图 ===== */
|
|
1357
|
+
.container{max-width:1080px;margin:0 auto;padding:0 18px}
|
|
1358
|
+
.app[data-view="library"] #view-report{display:none}
|
|
1359
|
+
#view-library{display:none}
|
|
1360
|
+
.app[data-view="library"] #view-library{display:block}
|
|
1361
|
+
|
|
1362
|
+
/* ===== 过程回顾条 ===== */
|
|
1363
|
+
.process{background:#fff;border:1px solid var(--line);border-radius:14px;box-shadow:var(--shadow-1);
|
|
1364
|
+
padding:15px 20px 13px;margin:-36px auto 16px;position:relative}
|
|
1365
|
+
.p-head{display:flex;align-items:baseline;gap:10px;margin-bottom:10px}
|
|
1366
|
+
.p-head b{font-size:14.5px;color:var(--navy);letter-spacing:1px}
|
|
1367
|
+
.p-head span{font-size:11.5px;color:var(--muted)}
|
|
1368
|
+
.p-steps{list-style:none;display:flex;align-items:stretch;gap:8px;margin:0;padding:0;flex-wrap:wrap}
|
|
1369
|
+
.p-step{display:flex;gap:9px;align-items:center;min-width:0;flex:1 1 150px;
|
|
1370
|
+
border:1px solid var(--line);border-radius:10px;padding:8px 11px;background:#fafbfc}
|
|
1371
|
+
.p-no{flex:none;width:24px;height:24px;border-radius:50%;background:var(--grad);color:#fff;
|
|
1372
|
+
display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:800}
|
|
1373
|
+
.p-txt{min-width:0}
|
|
1374
|
+
.p-txt b{display:block;font-size:12.8px;color:var(--navy);line-height:1.5}
|
|
1375
|
+
.p-txt i{display:block;font-style:normal;font-size:11px;color:var(--muted);line-height:1.5;
|
|
1376
|
+
overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
1377
|
+
.p-step.done{border-color:#bfe8da;background:#f2faf7}
|
|
1378
|
+
.p-step.done .p-no{background:var(--ok)}
|
|
1379
|
+
.p-step.bad{border-color:#f6c9cb;background:#fffafa}
|
|
1380
|
+
.p-step.bad .p-no{background:var(--danger)}
|
|
1381
|
+
.p-step.expandable{cursor:pointer}
|
|
1382
|
+
.p-step.expandable:hover{border-color:var(--brand)}
|
|
1383
|
+
.p-arrow{align-self:center;color:#b9c6d9;font-size:16px;font-weight:700;flex:none}
|
|
1384
|
+
.p-detail{display:none;margin-top:10px;border-top:1px dashed var(--line-strong);padding-top:9px}
|
|
1385
|
+
.p-detail.show{display:block}
|
|
1386
|
+
.pd-row{display:flex;justify-content:space-between;gap:14px;padding:3px 2px;font-size:12.3px;flex-wrap:wrap}
|
|
1387
|
+
.pd-row b{color:var(--navy);font-weight:700;min-width:0}
|
|
1388
|
+
.pd-row span{color:var(--muted)}
|
|
1389
|
+
|
|
1390
|
+
/* ===== 核验报告视图 ===== */
|
|
1391
|
+
#view-report{padding-bottom:26px}
|
|
1392
|
+
.warn-box{margin:0 0 16px;padding:13px 16px;border:1.5px solid var(--danger);border-radius:10px;
|
|
1393
|
+
background:#fdf3f3;color:#8f2626;font-size:13.5px;line-height:1.7}
|
|
1394
|
+
.verify{margin:0 0 16px;background:#fff;border:1px solid #bfe8da;border-left:4px solid var(--ok);
|
|
1395
|
+
border-radius:14px;padding:16px 20px;box-shadow:var(--shadow-1)}
|
|
1396
|
+
.verify.fail{border-color:#f6c9cb;border-left-color:var(--danger);background:#fffafa}
|
|
1397
|
+
.v-head{display:flex;align-items:center;gap:9px;font-size:15px;font-weight:800;color:var(--ok)}
|
|
1398
|
+
.verify.fail .v-head{color:var(--danger)}
|
|
1399
|
+
.v-shield{display:inline-flex;width:22px;height:22px;border-radius:50%;background:var(--ok);color:#fff;
|
|
1400
|
+
align-items:center;justify-content:center;font-size:12px;flex:none}
|
|
1401
|
+
.verify.fail .v-shield{background:var(--danger)}
|
|
1402
|
+
.v-stamp{margin-left:auto;font-size:11px;border:1.5px solid var(--ok);color:var(--ok);border-radius:5px;
|
|
1403
|
+
padding:1px 8px;letter-spacing:2px;flex:none}
|
|
1404
|
+
.v-stamp.bad{border-color:var(--danger);color:var(--danger)}
|
|
1405
|
+
.v-reasons{margin-top:6px;font-size:12.5px;color:var(--danger)}
|
|
1406
|
+
.v-grid{display:grid;grid-template-columns:1fr 1fr;gap:4px 20px;margin-top:10px}
|
|
1407
|
+
.vi{display:flex;gap:7px;align-items:baseline;font-size:12.5px;color:#3b3550;line-height:1.7;min-width:0}
|
|
1408
|
+
.vi .s{font-weight:800;flex:none}
|
|
1409
|
+
.vi .s.ok{color:var(--ok)}
|
|
1410
|
+
.vi .s.warn{color:var(--warn)}
|
|
1411
|
+
.vi .s.fail{color:var(--danger)}
|
|
1412
|
+
.vi .s.man{color:var(--case)}
|
|
1413
|
+
.vi .s.none{color:var(--muted)}
|
|
1414
|
+
.vi .d{color:var(--muted);min-width:0}
|
|
1415
|
+
.v-note{margin-top:11px;padding-top:9px;border-top:1px dashed var(--line);font-size:11.5px;color:var(--muted);line-height:1.7}
|
|
1416
|
+
|
|
1417
|
+
/* 正文(原型复刻):章节 / 段落 / 角标 / 句后溯源卡 */
|
|
1418
|
+
.doc-paper{background:#fff;border-radius:14px;box-shadow:var(--shadow-1);padding:26px 34px 22px;margin:0 0 16px}
|
|
1419
|
+
.chapter{margin:40px 0 0}
|
|
1420
|
+
.chapter:first-child{margin-top:6px}
|
|
1421
|
+
.ch-head{display:flex;align-items:center;gap:14px;margin-bottom:18px;scroll-margin-top:86px}
|
|
1422
|
+
.ch-head h2{font-size:19.5px;font-weight:700;color:var(--ink);letter-spacing:.2px;line-height:1.4;flex:1;min-width:0}
|
|
1423
|
+
.ch-head::after{content:"";flex-basis:110px;height:1px;background:linear-gradient(90deg,#e9dff9,transparent);order:3;flex-grow:0;flex-shrink:0}
|
|
1424
|
+
.ch-head .sec-badge{order:4;flex:none;font-size:11.5px;color:var(--ok);background:var(--policy-soft);border-radius:6px;padding:2px 9px;font-weight:700}
|
|
1425
|
+
.ch-head .sec-badge.bad{color:var(--danger);background:#fdecec}
|
|
1426
|
+
@media(min-width:1000px){.ch-head::after{flex-basis:200px}}
|
|
1427
|
+
.lead{font-size:15.5px;line-height:1.95;color:var(--body-c);margin:14px 0;padding:0 2px;word-break:break-word}
|
|
1428
|
+
.para{font-size:15.5px;line-height:1.95;color:var(--body-c);margin:14px 0;padding:0 2px;word-break:break-word}
|
|
1429
|
+
.para b.kw,.lead b.kw{font-weight:600;color:var(--ink)}
|
|
1430
|
+
.doc-divider{border:0;border-top:1px solid var(--line);margin:18px 0}
|
|
1431
|
+
code{padding:1px 5px;border-radius:4px;background:#f3f4f6;color:#3f3d52;
|
|
1432
|
+
font-family:ui-monospace,Menlo,Consolas,monospace;font-size:12px}
|
|
1433
|
+
.tbl-wrap{max-width:100%;overflow-x:auto;margin:8px 0}
|
|
1434
|
+
.data-tbl{width:100%;border-collapse:collapse;border:1px solid var(--line);font-size:13px}
|
|
1435
|
+
.data-tbl th,.data-tbl td{border:1px solid var(--line);padding:8px 10px;text-align:left;vertical-align:top;line-height:1.65}
|
|
1436
|
+
.data-tbl th{background:#f5f6f8;font-weight:700;color:#3f3d52}
|
|
1437
|
+
|
|
1438
|
+
/* 角标 */
|
|
1439
|
+
.cite{display:inline-flex;align-items:center;justify-content:center;min-width:19px;height:18px;padding:0 5px;margin:0 2px 2px 3px;font-size:10.5px;font-weight:700;font-variant-numeric:tabular-nums;color:var(--brand);background:var(--tint);border:1px solid var(--tint-bd);border-radius:5px;cursor:pointer;vertical-align:super;line-height:1;transition:.14s;position:relative;top:-1px;user-select:none;font-family:inherit}
|
|
1440
|
+
.cite:hover{background:var(--brand);border-color:var(--brand);color:#fff}
|
|
1441
|
+
.cite.flash{background:var(--primary-bright);border-color:var(--primary-bright);color:#fff}
|
|
1442
|
+
.cite.unresolved{color:var(--danger);border-color:#f6c9cb;background:#fdf7f7}
|
|
1443
|
+
|
|
1444
|
+
/* 段落级证据 chips(引文卡) */
|
|
1445
|
+
/* 行内引文 jb(原型复刻):角标后小胶囊,点击展开块级卡(溯源原文+引文摘录) */
|
|
1446
|
+
.jb{display:inline-block;vertical-align:top;max-width:100%;margin:2px 4px 2px 0;position:relative}
|
|
1447
|
+
.jb.active{display:block;margin:12px 0 2px;max-width:none}
|
|
1448
|
+
.jb-name{display:inline-flex;align-items:center;gap:6px;max-width:380px;min-height:26px;padding:4px 13px;border-radius:13px;border:1px solid var(--tint-bd);background:var(--tint);color:#540e8f;font-family:inherit;font-size:12px;font-weight:600;line-height:18px;cursor:pointer;transition:.16s;white-space:nowrap}
|
|
1449
|
+
.jb-name:hover{background:#fff;border-color:var(--brand)}
|
|
1450
|
+
.jb-name .jb-id{flex:none;width:18px;height:18px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-style:normal;font-size:10.5px;font-weight:800;font-variant-numeric:tabular-nums;color:#fff;background:linear-gradient(135deg,#6512ad,#8b5cf6);box-shadow:0 1px 3px rgba(101,18,173,.28)}
|
|
1451
|
+
.jb-name .jb-txt{overflow:hidden;text-overflow:ellipsis}
|
|
1452
|
+
.jb-name svg{flex:none;transition:transform .2s}
|
|
1453
|
+
.jb.active .jb-name{max-width:100%;white-space:normal;line-height:20px;color:var(--ink);background:#fff;font-size:13.5px;font-weight:700;text-align:left}
|
|
1454
|
+
.jb.active .jb-name svg{transform:rotate(180deg)}
|
|
1455
|
+
.jb-src{display:inline-flex;align-items:center;gap:5px;min-height:26px;padding:4px 13px;border-radius:13px;background:linear-gradient(135deg,#6512ad,#8b5cf6);color:#fff;font-size:11px;font-weight:600;text-decoration:none;box-shadow:0 2px 8px rgba(101,18,173,.22);transition:.15s;flex-shrink:0}
|
|
1456
|
+
.jb-src:hover{filter:brightness(1.1)}
|
|
1457
|
+
.jb-src span{max-width:210px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
1458
|
+
.jb-body{display:none}
|
|
1459
|
+
.jb.active .jb-body{position:relative;display:block;margin-top:13px;background:#fff;border:1px solid var(--card-bd);border-radius:12px;padding:13px 15px;box-shadow:var(--shadow-1)}
|
|
1460
|
+
.jb-head{display:flex;align-items:center;gap:9px;flex-wrap:wrap}
|
|
1461
|
+
.jb-label{display:inline-flex;align-items:center;gap:6px;font-size:12.5px;font-weight:700;color:var(--brand);letter-spacing:.5px}
|
|
1462
|
+
.jb-label svg{flex:none}
|
|
1463
|
+
.jb-site{display:inline-flex;align-items:center;gap:6px;font-size:11.5px;color:#70678a;background:#f6f4fa;
|
|
1464
|
+
border:1px solid var(--line);border-radius:999px;padding:3.5px 10px;max-width:100%;overflow:hidden;
|
|
1465
|
+
text-overflow:ellipsis;white-space:nowrap;margin:0 0 2px}
|
|
1466
|
+
.jb-site .dot{width:6px;height:6px;border-radius:50%;background:linear-gradient(135deg,#6512ad,#8b5cf6);flex-shrink:0}
|
|
1467
|
+
.jb-quote{display:flex;gap:9px;align-items:flex-start;margin-top:9px;padding:10px 12px;background:#faf9fd;border:1px solid var(--line);border-radius:9px;text-decoration:none;transition:.15s;cursor:pointer}
|
|
1468
|
+
.jb-quote{cursor:pointer}
|
|
1469
|
+
.jb-quote:hover{border-color:var(--brand);background:#f7f4fc}
|
|
1470
|
+
.jb-no{flex:none;width:17px;height:17px;margin-top:4px;border-radius:4px;background:var(--tint);border:1px solid var(--tint-bd);color:var(--brand);font-size:10px;font-weight:700;font-style:normal;display:flex;align-items:center;justify-content:center}
|
|
1471
|
+
.jb-quote span{font-size:12.5px;line-height:1.95;color:#4b4658;word-break:break-word;text-align:justify}
|
|
1472
|
+
.jb-quote .sc-excerpt{flex:1;min-width:0;display:block}
|
|
1473
|
+
a.jb-quote{text-decoration:none}
|
|
1474
|
+
.jb.flash{animation:cardFlash 1.6s ease}
|
|
1475
|
+
.ev-title{font-weight:700;font-size:13.5px;margin-bottom:4px;color:var(--ink)}
|
|
1476
|
+
.ev-meta{color:var(--muted);font-size:12px;margin-bottom:6px}
|
|
1477
|
+
.ev-chip summary{display:inline-flex;align-items:center;gap:5px;max-width:100%;min-height:26px;padding:4px 13px;
|
|
1478
|
+
border-radius:13px;color:#fff;background:var(--grad);cursor:pointer;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
|
|
1479
|
+
list-style:none;font-size:11px;font-weight:600;box-shadow:0 2px 8px rgba(101,18,173,.22);transition:.15s}
|
|
1480
|
+
.ev-chip summary:hover{filter:brightness(1.12)}
|
|
1481
|
+
.ev-chip summary::-webkit-details-marker{display:none}
|
|
1482
|
+
.ev-chip summary b{color:#fff;margin-right:2px;font-weight:700}
|
|
1483
|
+
|
|
1484
|
+
.ev-title{font-weight:700;font-size:13.5px;margin-bottom:4px;color:var(--navy)}
|
|
1485
|
+
.ev-meta{color:var(--muted);font-size:12px;margin-bottom:6px}
|
|
1486
|
+
.ev-panel p{margin:0 0 8px;color:#3f3d52;font-size:12.8px;line-height:1.7}
|
|
1487
|
+
.sc-links{display:flex;flex-wrap:wrap;gap:8px;margin-top:6px}
|
|
1488
|
+
.sc-links span{display:inline-flex}
|
|
1489
|
+
.sc-links a{display:inline-flex;align-items:center;min-height:24px;padding:3px 9px;border-radius:6px;
|
|
1490
|
+
background:var(--brand-soft);color:var(--brand);font-weight:700;text-decoration:none;font-size:12px}
|
|
1491
|
+
|
|
1492
|
+
/* ===== 材料专库视图 ===== */
|
|
1493
|
+
#view-library{padding:26px 0 30px}
|
|
1494
|
+
.lib-head{max-width:860px;margin:0 auto 16px;text-align:center}
|
|
1495
|
+
.lib-title{margin-bottom:14px}
|
|
1496
|
+
.lib-title b{font-size:17px;color:var(--navy);letter-spacing:2px}
|
|
1497
|
+
.lib-title span{display:block;font-size:12px;color:var(--muted);margin-top:2px}
|
|
1498
|
+
.lib-searchWrap{position:relative;max-width:620px;margin:0 auto}
|
|
1499
|
+
.lib-searchIcon{position:absolute;left:14px;top:50%;transform:translateY(-50%);color:#a6adbd;font-size:16px;font-weight:700}
|
|
1500
|
+
.lib-search{width:100%;padding:11px 16px 11px 38px;border:1.5px solid var(--line-strong);border-radius:999px;
|
|
1501
|
+
font-size:14px;background:#fff;box-shadow:var(--shadow-1);outline:none}
|
|
1502
|
+
.lib-search:focus{border-color:var(--brand-2);box-shadow:0 0 0 3px rgba(139,92,246,.18)}
|
|
1503
|
+
.hot-terms{display:flex;flex-wrap:wrap;justify-content:center;gap:7px;margin-top:12px;align-items:center}
|
|
1504
|
+
.hot-label{font-size:12px;color:var(--muted)}
|
|
1505
|
+
.hot-term{border:0;border-radius:999px;background:var(--brand-soft);color:var(--brand);
|
|
1506
|
+
font-size:12.3px;font-weight:700;padding:3px 13px;cursor:pointer}
|
|
1507
|
+
.hot-term:hover{background:var(--grad);color:#fff}
|
|
1508
|
+
.lib-tabs{display:flex;flex-wrap:wrap;justify-content:center;gap:6px;margin-top:14px}
|
|
1509
|
+
.lib-tabs button{border:1px solid var(--line);border-radius:999px;background:#fff;color:var(--muted);
|
|
1510
|
+
padding:4px 13px;font-size:12.3px;cursor:pointer}
|
|
1511
|
+
.lib-tabs button.on{background:var(--grad);border-color:var(--brand);color:#fff;font-weight:700}
|
|
1512
|
+
.lib-list{max-width:860px;margin:0 auto;display:grid;grid-template-columns:1fr;gap:14px}
|
|
1513
|
+
.lib-empty{max-width:860px;margin:30px auto;text-align:center;color:var(--muted);font-size:13.5px}
|
|
1514
|
+
.lib-empty.hide{display:none}
|
|
1515
|
+
.lib-foot{text-align:center;color:var(--muted);font-size:11.5px;padding:18px 0 0;line-height:1.8}
|
|
1516
|
+
|
|
1517
|
+
/* ===== 材料卡 ===== */
|
|
1518
|
+
.scard{border:1px solid var(--line);border-left-width:3px;border-radius:12px;padding:14px 18px;
|
|
1519
|
+
background:#fff;box-shadow:var(--shadow-1);transition:box-shadow .25s}
|
|
1520
|
+
.scard:hover{box-shadow:var(--shadow-2)}
|
|
1521
|
+
.scard.pol{border-left-color:var(--policy)}
|
|
1522
|
+
.scard.dat{border-left-color:var(--brand-2)}
|
|
1523
|
+
.scard.cas{border-left-color:var(--case)}
|
|
1524
|
+
.scard.ref,.scard.mat{border-left-color:var(--ref)}
|
|
1525
|
+
.scard.hl{box-shadow:0 0 0 3px rgba(139,92,246,.35),var(--shadow-2)}
|
|
1526
|
+
.scard.hide{display:none}
|
|
1527
|
+
.sc-head{display:flex;align-items:center;gap:7px;margin-bottom:6px}
|
|
1528
|
+
.sc-id{font-family:monospace;font-weight:800;font-size:11px;color:#fff;background:var(--grad);
|
|
1529
|
+
border-radius:5px;padding:1px 8px}
|
|
1530
|
+
.sc-type{font-size:11px;font-weight:700;border-radius:4px;padding:1px 8px;background:var(--ref-soft);color:var(--ref)}
|
|
1531
|
+
.scard.pol .sc-type{background:var(--policy-soft);color:var(--policy)}
|
|
1532
|
+
.scard.dat .sc-type{background:var(--brand-soft);color:var(--brand)}
|
|
1533
|
+
.scard.cas .sc-type{background:var(--case-soft);color:var(--case)}
|
|
1534
|
+
.sc-vk{margin-left:auto;font-size:11px;font-weight:800;color:var(--ok)}
|
|
1535
|
+
.sc-vk.warn{color:var(--warn)}
|
|
1536
|
+
.sc-unused{font-size:10.5px;font-weight:800;color:var(--muted);background:#efedf4;border-radius:4px;
|
|
1537
|
+
padding:1px 7px;flex:none}
|
|
1538
|
+
.sc-conf{font-size:10.5px;font-weight:800;color:#8a5a00;background:var(--case-soft);border:1px solid #e6cf8f;
|
|
1539
|
+
border-radius:4px;padding:0 7px;flex:none}
|
|
1540
|
+
.scard h4{margin:0 0 5px;font-size:14.5px;color:var(--ink);line-height:1.55}
|
|
1541
|
+
.sc-meta{font-size:11.5px;color:var(--muted)}
|
|
1542
|
+
/* 标题链面包屑(模型生成的结构化位置,核验核心抓手)与多段分块 */
|
|
1543
|
+
.crumb{font-size:11.5px;color:var(--brand);margin:10px 0 4px;font-weight:600;line-height:1.6;
|
|
1544
|
+
padding:3px 9px;background:var(--tint);border-radius:7px;display:inline-block;max-width:100%;
|
|
1545
|
+
overflow-wrap:break-word}
|
|
1546
|
+
.crumb i{font-style:normal;color:#c9b3ec;margin:0 2px;font-weight:400}
|
|
1547
|
+
.seg-block{margin-top:8px}
|
|
1548
|
+
.seg-block:first-child{margin-top:2px}
|
|
1549
|
+
.seg-block .sc-excerpt{margin-top:5px}
|
|
1550
|
+
.sc-vnote{margin-top:5px;font-size:11.3px;color:var(--ok);line-height:1.6}
|
|
1551
|
+
.sc-excerpt{margin:8px 0 0;padding:10px 12px;border:1px solid #eceaf2;border-radius:9px;
|
|
1552
|
+
background:#faf9fd;color:#4a4260;font-size:12.3px;line-height:1.75}
|
|
1553
|
+
.sc-excerpt.rich{overflow-x:auto}
|
|
1554
|
+
.sc-excerpt.rich table{width:max-content;min-width:100%;border-collapse:collapse;background:#fff;font-size:12px}
|
|
1555
|
+
.sc-excerpt.rich td,.sc-excerpt.rich th{min-width:92px;max-width:220px;padding:7px 8px;border:1px solid var(--line);
|
|
1556
|
+
vertical-align:top;word-break:break-word}
|
|
1557
|
+
.sc-excerpt.rich thead td,.sc-excerpt.rich th{background:#f3f4f6;color:#3f3d52;font-weight:700}
|
|
1558
|
+
.scard .sc-links a{font-size:12px}
|
|
1559
|
+
.scard .sc-links{margin-top:4px}
|
|
1560
|
+
.no-link{font-size:11.5px;color:var(--muted)}
|
|
1561
|
+
.sc-links a.snap{background:#faf5ff;border-color:#d9c9f4;color:#5b21b6}
|
|
1562
|
+
.dead-link{font-size:11.5px;color:var(--warn)}
|
|
1563
|
+
|
|
1564
|
+
/* ===== 章节目录(spy,长报告) ===== */
|
|
1565
|
+
.toc{position:fixed;left:calc((100vw - 1080px)/2 - 168px);top:120px;width:140px;max-height:60vh;overflow:auto;
|
|
1566
|
+
display:flex;flex-direction:column;gap:2px;font-size:12px}
|
|
1567
|
+
.toc a{color:var(--muted);text-decoration:none;padding:4px 10px;border-left:2px solid var(--line);
|
|
1568
|
+
line-height:1.5;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
1569
|
+
.toc a.on{color:var(--brand);border-left-color:var(--brand);font-weight:700}
|
|
1570
|
+
@media (max-width:1460px){.toc{display:none}}
|
|
1571
|
+
|
|
1572
|
+
.foot{text-align:center;color:var(--muted);font-size:11.5px;padding:16px 0 4px;line-height:1.8}
|
|
1573
|
+
|
|
1574
|
+
/* ===== 只看正文(纯净阅读态) ===== */
|
|
1575
|
+
body.reading .process,body.reading .verify,body.reading .jb,body.reading .sec-badge,
|
|
1576
|
+
body.reading .cite,body.reading .toc,body.reading .p-detail{display:none!important}
|
|
1577
|
+
|
|
1578
|
+
/* ===== 打印附录 ===== */
|
|
1579
|
+
.print-appendix{display:none}
|
|
1580
|
+
|
|
1581
|
+
/* ===== 移动端 ===== */
|
|
1582
|
+
.sheet-mask{display:none}
|
|
1583
|
+
.sheet{display:none}
|
|
1584
|
+
@media (max-width:680px){
|
|
1585
|
+
body{font-size:14px;line-height:1.8}
|
|
1586
|
+
.topbar{padding:7px 10px;gap:6px}
|
|
1587
|
+
.tb-stamp{font-size:11px;letter-spacing:2px;text-indent:2px}
|
|
1588
|
+
.tb-stamp::before,.tb-stamp::after{width:12px;margin:0 4px}
|
|
1589
|
+
.tb-title{display:none}
|
|
1590
|
+
.topbar .view-switch{display:none}
|
|
1591
|
+
.tb-tools button{font-size:11.5px;padding:4px 8px}
|
|
1592
|
+
.hero{padding:24px 14px 50px}
|
|
1593
|
+
.ch-head{gap:8px;margin-bottom:14px;flex-wrap:nowrap}
|
|
1594
|
+
.ch-head h2{font-size:17px;line-height:1.45}
|
|
1595
|
+
.ch-head::after{display:none}
|
|
1596
|
+
.ch-head .sec-badge{font-size:10.5px;padding:2px 7px;white-space:nowrap}
|
|
1597
|
+
.jb-name{max-width:calc(100vw - 72px)}
|
|
1598
|
+
.r-badge{font-size:13.5px;letter-spacing:6px;text-indent:6px;gap:10px}
|
|
1599
|
+
.hero h1{font-size:18.5px}
|
|
1600
|
+
.hero .meta{font-size:11.5px;line-height:1.7}
|
|
1601
|
+
.hero-switch .view-switch button{padding:6px 16px;font-size:12.5px}
|
|
1602
|
+
.process{margin-top:-30px;padding:12px 12px 11px}
|
|
1603
|
+
.p-step{flex:1 1 100%}
|
|
1604
|
+
.p-arrow{display:none}
|
|
1605
|
+
.verify{padding:13px 14px}
|
|
1606
|
+
.v-head{font-size:14px}
|
|
1607
|
+
.v-grid{grid-template-columns:1fr;gap:2px 0}
|
|
1608
|
+
.vi{flex-wrap:wrap;gap:4px 8px}
|
|
1609
|
+
.vi .d{min-width:0}
|
|
1610
|
+
.warn-box{font-size:12.5px;padding:11px 12px}
|
|
1611
|
+
.doc-paper{padding:16px 14px 10px;border-radius:10px}
|
|
1612
|
+
.sec-head{gap:7px;padding-bottom:8px;margin-bottom:8px}
|
|
1613
|
+
.sec-head h3{font-size:15px}
|
|
1614
|
+
.sec-badge{margin-left:0;font-size:11px}
|
|
1615
|
+
.doc-block p,.doc-item p{font-size:15px;line-height:1.95}
|
|
1616
|
+
.doc-sub{font-size:14px;margin:12px 0 6px}
|
|
1617
|
+
.data-tbl{font-size:12px}
|
|
1618
|
+
.data-tbl th,.data-tbl td{padding:6px 7px;line-height:1.55}
|
|
1619
|
+
.cite{font-size:11px;padding:0 4px}
|
|
1620
|
+
.ev-chip summary{font-size:11px}
|
|
1621
|
+
#view-library{padding:18px 0 24px}
|
|
1622
|
+
.lib-search{padding:10px 14px 10px 34px;font-size:13.5px}
|
|
1623
|
+
.lib-tabs{justify-content:flex-start;flex-wrap:nowrap;overflow-x:auto;padding-bottom:4px;
|
|
1624
|
+
-webkit-overflow-scrolling:touch;scrollbar-width:none}
|
|
1625
|
+
.lib-tabs::-webkit-scrollbar{display:none}
|
|
1626
|
+
.lib-tabs button{flex:none}
|
|
1627
|
+
.lib-list{grid-template-columns:1fr;gap:10px}
|
|
1628
|
+
.scard{padding:10px 11px}
|
|
1629
|
+
.crumb{font-size:11px}
|
|
1630
|
+
.sc-excerpt{font-size:11.5px}
|
|
1631
|
+
/* 移动端材料底部弹层:点角标就地弹出材料卡,不跳转打断阅读 */
|
|
1632
|
+
.sheet-mask{display:block;position:fixed;inset:0;background:rgba(11,31,58,.45);z-index:99;opacity:0;
|
|
1633
|
+
pointer-events:none;transition:opacity .2s}
|
|
1634
|
+
.sheet-mask.show{opacity:1;pointer-events:auto}
|
|
1635
|
+
.sheet{display:block;position:fixed;left:0;right:0;bottom:0;z-index:100;background:#fff;
|
|
1636
|
+
border-radius:14px 14px 0 0;box-shadow:0 -8px 30px rgba(11,31,58,.25);
|
|
1637
|
+
max-height:68vh;overflow-y:auto;-webkit-overflow-scrolling:touch;
|
|
1638
|
+
padding:10px 16px 22px;transform:translateY(105%);transition:transform .25s ease}
|
|
1639
|
+
.sheet.show{transform:translateY(0)}
|
|
1640
|
+
.sheet-grab{width:38px;height:4px;border-radius:2px;background:#c9d4e2;margin:2px auto 8px}
|
|
1641
|
+
.sheet-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px}
|
|
1642
|
+
.sheet-head b{font-size:13.5px;color:var(--navy)}
|
|
1643
|
+
.sheet-close{border:1px solid var(--line);background:#f5f3fa;border-radius:8px;color:#3b4a61;
|
|
1644
|
+
font-size:12.5px;font-weight:700;padding:5px 14px;cursor:pointer}
|
|
1645
|
+
.sheet .scard{box-shadow:none;margin-bottom:0}
|
|
1646
|
+
.sheet .sc-excerpt{display:block;-webkit-line-clamp:unset;cursor:auto}
|
|
1647
|
+
/* 正文表述 ↔ 原文原段 对照区(弹层顶部) */
|
|
1648
|
+
.cmp{margin:0 0 10px;border:1px solid var(--line);border-radius:10px;overflow:hidden}
|
|
1649
|
+
.cmp-tag{font-size:11px;font-weight:800;padding:3px 10px}
|
|
1650
|
+
.cmp-side{padding:9px 12px;font-size:12.8px;line-height:1.7}
|
|
1651
|
+
.cmp-side p{margin:0}
|
|
1652
|
+
.cmp-ai{background:#fbfaff;color:#3f3d52}
|
|
1653
|
+
.cmp-ai .cmp-tag{background:#eef1f6;color:var(--ref)}
|
|
1654
|
+
.cmp-src{background:#f4faf7;color:#2f4a3e;border-top:1px dashed var(--line-strong)}
|
|
1655
|
+
.cmp-src .cmp-tag{background:var(--policy-soft);color:#0b6e4f}
|
|
1656
|
+
.cmp-src .sc-excerpt{display:block;-webkit-line-clamp:unset;background:#fff;cursor:auto;font-size:12px;padding:8px 10px;margin:0}
|
|
1657
|
+
}
|
|
1658
|
+
|
|
1659
|
+
/* ===== 打印归档 ===== */
|
|
1660
|
+
@media print{
|
|
1661
|
+
.topbar,.process .p-detail,.hero-switch,.tb-tools,.view-switch,.lib-head,.toc,.sheet,.sheet-mask,
|
|
1662
|
+
.progress{display:none!important}
|
|
1663
|
+
#view-library{display:none!important}
|
|
1664
|
+
#view-report{display:block!important}
|
|
1665
|
+
.app[data-view="library"] #view-report{display:block!important}
|
|
1666
|
+
.hero{background:none;border:0;color:var(--ink);padding:10px 0 4px}
|
|
1667
|
+
.hero .meta{color:var(--muted)}
|
|
1668
|
+
*{-webkit-print-color-adjust:exact;print-color-adjust:exact}
|
|
1669
|
+
.process{box-shadow:none;margin:6px 0 12px}
|
|
1670
|
+
.verify{border-color:#bbb;box-shadow:none;break-inside:avoid}
|
|
1671
|
+
.doc-paper{box-shadow:none;border-radius:0;padding:0}
|
|
1672
|
+
body{background:#fff;font-size:12.5px}
|
|
1673
|
+
.sc-excerpt{display:block;-webkit-line-clamp:unset;cursor:auto}
|
|
1674
|
+
.scard{break-inside:avoid}
|
|
1675
|
+
.cite{background:none!important;color:#333!important;text-decoration:none!important}
|
|
1676
|
+
.cite::before{content:"["}.cite::after{content:"]"}
|
|
1677
|
+
.jb{display:inline!important}
|
|
1678
|
+
.jb .jb-name{border:0;background:none;padding:0;color:#333;font-weight:600}
|
|
1679
|
+
.jb .jb-name .jb-id{color:#333;background:none;border:1px solid #999;border-radius:3px}
|
|
1680
|
+
.jb .jb-body{display:none!important}
|
|
1681
|
+
.jb.active{break-inside:avoid}
|
|
1682
|
+
.jb.active .jb-body{display:block!important}
|
|
1683
|
+
.jb.active .jb-body .jb-quote{break-inside:avoid}
|
|
1684
|
+
body.reading .verify,body.reading .process,body.reading .ev-row,body.reading .sec-badge,
|
|
1685
|
+
body.reading .cite{display:none!important}
|
|
1686
|
+
.print-appendix{display:block;break-before:page}
|
|
1687
|
+
body.print-body-only .verify,body.print-body-only .process,body.print-body-only .print-appendix,
|
|
1688
|
+
body.print-body-only .jb,body.print-body-only .foot{display:none!important}
|
|
1689
|
+
.print-appendix h3{font-size:15px;color:var(--navy);border-bottom:1px solid #999;padding-bottom:6px;margin:0 0 12px}
|
|
1690
|
+
.print-appendix .scard{margin-bottom:10px}
|
|
1691
|
+
}
|
|
1692
|
+
"""
|
|
1693
|
+
|
|
1694
|
+
PAGE_JS = """
|
|
1695
|
+
(function () {
|
|
1696
|
+
"use strict";
|
|
1697
|
+
function $(sel, root) { return (root || document).querySelector(sel); }
|
|
1698
|
+
function $$(sel, root) { return Array.prototype.slice.call((root || document).querySelectorAll(sel)); }
|
|
1699
|
+
|
|
1700
|
+
var app = $(".app");
|
|
1701
|
+
var isMobile = function () { return window.matchMedia("(max-width:680px)").matches; };
|
|
1702
|
+
|
|
1703
|
+
/* ===== 1. 双视图切换(保存/恢复各自滚动位置) ===== */
|
|
1704
|
+
var savedScroll = { report: 0, library: 0 };
|
|
1705
|
+
function setView(view) {
|
|
1706
|
+
if (!app || app.getAttribute("data-view") === view) return;
|
|
1707
|
+
savedScroll[app.getAttribute("data-view") || "report"] = window.scrollY;
|
|
1708
|
+
app.setAttribute("data-view", view);
|
|
1709
|
+
$$(".view-switch button").forEach(function (b) {
|
|
1710
|
+
b.classList.toggle("on", b.getAttribute("data-view") === view);
|
|
1711
|
+
});
|
|
1712
|
+
window.scrollTo(0, Math.max(0, savedScroll[view] || 0));
|
|
1713
|
+
}
|
|
1714
|
+
$$(".view-switch button").forEach(function (b) {
|
|
1715
|
+
b.addEventListener("click", function () { setView(b.getAttribute("data-view")); });
|
|
1716
|
+
});
|
|
1717
|
+
|
|
1718
|
+
/* ===== 2. 阅读进度条 ===== */
|
|
1719
|
+
var progress = $(".progress i");
|
|
1720
|
+
function updateProgress() {
|
|
1721
|
+
if (!progress) return;
|
|
1722
|
+
var h = document.documentElement;
|
|
1723
|
+
var max = h.scrollHeight - h.clientHeight;
|
|
1724
|
+
progress.style.width = (max > 0 ? Math.min(100, (h.scrollTop / max) * 100) : 0) + "%";
|
|
1725
|
+
}
|
|
1726
|
+
window.addEventListener("scroll", updateProgress, { passive: true });
|
|
1727
|
+
updateProgress();
|
|
1728
|
+
|
|
1729
|
+
/* ===== 3. 只看正文(纯净阅读态切换) ===== */
|
|
1730
|
+
var readBtn = $("#btn-reading");
|
|
1731
|
+
if (readBtn) {
|
|
1732
|
+
readBtn.addEventListener("click", function () {
|
|
1733
|
+
var on = document.body.classList.toggle("reading");
|
|
1734
|
+
readBtn.setAttribute("aria-pressed", on ? "true" : "false");
|
|
1735
|
+
readBtn.textContent = on ? "显示核验" : "只看正文";
|
|
1736
|
+
/* 只看正文只作用于核验报告视图:正在材料专库时切回报告,专库不受影响 */
|
|
1737
|
+
if (on && app && app.getAttribute("data-view") !== "report") setView("report");
|
|
1738
|
+
});
|
|
1739
|
+
}
|
|
1740
|
+
|
|
1741
|
+
/* ===== 4. 复制全文(章节标题 + 段落 + 表格,去角标) ===== */
|
|
1742
|
+
var copyBtn = $("#btn-copy");
|
|
1743
|
+
if (copyBtn) {
|
|
1744
|
+
copyBtn.addEventListener("click", function () {
|
|
1745
|
+
var parts = [];
|
|
1746
|
+
/* 按文档流顺序收集章节标题/段落/表格;克隆后剔除引文胶囊与角标,
|
|
1747
|
+
只复制正文本身(胶囊标题/展开摘录/编号数字均不带出) */
|
|
1748
|
+
var nodes = $$("#view-report .ch-head h2, #view-report .lead, #view-report .para, #view-report .tbl-wrap");
|
|
1749
|
+
nodes.sort(function (a, b) { return (a.compareDocumentPosition(b) & 4) ? -1 : 1; });
|
|
1750
|
+
nodes.forEach(function (el) {
|
|
1751
|
+
var clone = el.cloneNode(true);
|
|
1752
|
+
clone.querySelectorAll(".jb, sup.cite").forEach(function (x) { x.remove(); });
|
|
1753
|
+
var t = clone.textContent.replace(/[ \t]+/g, " ").trim();
|
|
1754
|
+
if (t) parts.push(t);
|
|
1755
|
+
});
|
|
1756
|
+
var text = parts.filter(Boolean).join("\\n\\n");
|
|
1757
|
+
function done(ok) {
|
|
1758
|
+
var old = copyBtn.textContent;
|
|
1759
|
+
copyBtn.textContent = ok ? "已复制 ✓" : "复制失败";
|
|
1760
|
+
setTimeout(function () { copyBtn.textContent = old; }, 1600);
|
|
1761
|
+
}
|
|
1762
|
+
if (navigator.clipboard && navigator.clipboard.writeText) {
|
|
1763
|
+
navigator.clipboard.writeText(text).then(function () { done(true); }, function () { done(fallback(text)); });
|
|
1764
|
+
} else {
|
|
1765
|
+
done(fallback(text));
|
|
1766
|
+
}
|
|
1767
|
+
function fallback(value) {
|
|
1768
|
+
try {
|
|
1769
|
+
var ta = document.createElement("textarea");
|
|
1770
|
+
ta.value = value;
|
|
1771
|
+
ta.style.position = "fixed";
|
|
1772
|
+
ta.style.opacity = "0";
|
|
1773
|
+
document.body.appendChild(ta);
|
|
1774
|
+
ta.select();
|
|
1775
|
+
var ok = document.execCommand("copy");
|
|
1776
|
+
document.body.removeChild(ta);
|
|
1777
|
+
return ok;
|
|
1778
|
+
} catch (e) { return false; }
|
|
1779
|
+
}
|
|
1780
|
+
});
|
|
1781
|
+
}
|
|
1782
|
+
|
|
1783
|
+
/* ===== 5. 打印归档(PDF):下拉双选项——只打印正文 / 完整归档 ===== */
|
|
1784
|
+
var printBtn = $("#btn-print");
|
|
1785
|
+
var printDrop = $("#print-drop");
|
|
1786
|
+
function printBy(mode) {
|
|
1787
|
+
if (mode === "body") document.body.classList.add("print-body-only");
|
|
1788
|
+
if (printDrop) printDrop.hidden = true;
|
|
1789
|
+
window.print();
|
|
1790
|
+
}
|
|
1791
|
+
if (printBtn && printDrop) {
|
|
1792
|
+
printBtn.addEventListener("click", function (e) {
|
|
1793
|
+
e.stopPropagation();
|
|
1794
|
+
printDrop.hidden = !printDrop.hidden;
|
|
1795
|
+
});
|
|
1796
|
+
printDrop.addEventListener("click", function (e) {
|
|
1797
|
+
e.stopPropagation();
|
|
1798
|
+
var t = e.target.closest("button");
|
|
1799
|
+
if (!t) return;
|
|
1800
|
+
printBy(t.id === "print-body" ? "body" : "full");
|
|
1801
|
+
});
|
|
1802
|
+
document.addEventListener("click", function () { printDrop.hidden = true; });
|
|
1803
|
+
/* 打印结束移除临时模式(浏览器打印窗口关闭后触发) */
|
|
1804
|
+
window.addEventListener("afterprint", function () { document.body.classList.remove("print-body-only"); });
|
|
1805
|
+
}
|
|
1806
|
+
|
|
1807
|
+
/* ===== 6. 材料卡索引(专库列表内,不含打印附录) ===== */
|
|
1808
|
+
var cards = $$("#lib-list .scard");
|
|
1809
|
+
var byId = {};
|
|
1810
|
+
cards.forEach(function (c) {
|
|
1811
|
+
var id = c.getAttribute("data-cite-id");
|
|
1812
|
+
if (id) byId[id] = c;
|
|
1813
|
+
});
|
|
1814
|
+
|
|
1815
|
+
/* 移动端底部弹层:正文表述 ↔ 原文原段 对照 + 材料卡 */
|
|
1816
|
+
var sheet = $(".sheet");
|
|
1817
|
+
var mask = $(".sheet-mask");
|
|
1818
|
+
function escHtml(s) {
|
|
1819
|
+
var d = document.createElement("div");
|
|
1820
|
+
d.textContent = s;
|
|
1821
|
+
return d.innerHTML;
|
|
1822
|
+
}
|
|
1823
|
+
function sentenceOf(el) {
|
|
1824
|
+
var para = el && el.closest ? el.closest(".doc-block,.doc-item") : null;
|
|
1825
|
+
return para && para.querySelector("p") ? para.querySelector("p").innerText.trim() : "";
|
|
1826
|
+
}
|
|
1827
|
+
function openSheet(card, sentence) {
|
|
1828
|
+
if (!sheet) return;
|
|
1829
|
+
var body = sheet.querySelector(".sheet-body");
|
|
1830
|
+
body.innerHTML = "";
|
|
1831
|
+
if (sentence) {
|
|
1832
|
+
var excerpt = card.querySelector(".sc-excerpt");
|
|
1833
|
+
var cmp = document.createElement("div");
|
|
1834
|
+
cmp.className = "cmp";
|
|
1835
|
+
cmp.innerHTML =
|
|
1836
|
+
'<div class="cmp-side cmp-ai"><div class="cmp-tag">正文表述</div><p>' + escHtml(sentence) + '</p></div>' +
|
|
1837
|
+
'<div class="cmp-side cmp-src"><div class="cmp-tag">原文原段</div>' +
|
|
1838
|
+
'<div class="sc-excerpt">' + (excerpt ? excerpt.innerHTML : "") + '</div></div>';
|
|
1839
|
+
body.appendChild(cmp);
|
|
1840
|
+
}
|
|
1841
|
+
var clone = card.cloneNode(true);
|
|
1842
|
+
clone.removeAttribute("id");
|
|
1843
|
+
clone.classList.remove("hide");
|
|
1844
|
+
clone.classList.add("open");
|
|
1845
|
+
body.appendChild(clone);
|
|
1846
|
+
sheet.classList.add("show");
|
|
1847
|
+
mask.classList.add("show");
|
|
1848
|
+
document.body.style.overflow = "hidden";
|
|
1849
|
+
sheet.scrollTop = 0;
|
|
1850
|
+
}
|
|
1851
|
+
function closeSheet() {
|
|
1852
|
+
if (!sheet) return;
|
|
1853
|
+
sheet.classList.remove("show");
|
|
1854
|
+
mask.classList.remove("show");
|
|
1855
|
+
document.body.style.overflow = "";
|
|
1856
|
+
}
|
|
1857
|
+
if (sheet && mask) {
|
|
1858
|
+
mask.addEventListener("click", closeSheet);
|
|
1859
|
+
var closeBtn = sheet.querySelector(".sheet-close");
|
|
1860
|
+
if (closeBtn) closeBtn.addEventListener("click", closeSheet);
|
|
1861
|
+
}
|
|
1862
|
+
|
|
1863
|
+
/* 行内引文 jb(原型行为):点小胶囊 toggle 展开卡;点角标展开对应 jb 并 flash。
|
|
1864
|
+
未绑定角标红色警示,绝不按位置猜测。 */
|
|
1865
|
+
var JB_TABLES = {};
|
|
1866
|
+
try {
|
|
1867
|
+
var jbTablesEl = document.getElementById("jb-tables");
|
|
1868
|
+
if (jbTablesEl) JB_TABLES = JSON.parse(jbTablesEl.textContent || "{}");
|
|
1869
|
+
} catch (e) { JB_TABLES = {}; }
|
|
1870
|
+
function fillTableHolders(jb) {
|
|
1871
|
+
jb.querySelectorAll(".tbl-holder[data-tbl]").forEach(function (h) {
|
|
1872
|
+
if (h.getAttribute("data-filled")) return;
|
|
1873
|
+
var html = JB_TABLES[h.getAttribute("data-tbl")];
|
|
1874
|
+
if (html) h.innerHTML = html;
|
|
1875
|
+
h.setAttribute("data-filled", "1");
|
|
1876
|
+
});
|
|
1877
|
+
}
|
|
1878
|
+
function toggleJb(jb, forceOpen) {
|
|
1879
|
+
var open = forceOpen === true ? true : !jb.classList.contains("active");
|
|
1880
|
+
document.querySelectorAll(".jb.active").forEach(function (x) { if (x !== jb) x.classList.remove("active"); });
|
|
1881
|
+
jb.classList.toggle("active", open);
|
|
1882
|
+
if (open) fillTableHolders(jb);
|
|
1883
|
+
var name = jb.querySelector(".jb-name");
|
|
1884
|
+
if (name) name.setAttribute("aria-expanded", open ? "true" : "false");
|
|
1885
|
+
return open;
|
|
1886
|
+
}
|
|
1887
|
+
document.querySelectorAll(".jb-name").forEach(function (name) {
|
|
1888
|
+
name.addEventListener("click", function () { toggleJb(name.closest(".jb")); });
|
|
1889
|
+
});
|
|
1890
|
+
|
|
1891
|
+
/* 引文条目点击 → 材料专库定位对应卡:库内导航看完整材料;
|
|
1892
|
+
外部原文跳转只保留 jb-head 的"查看全文"按钮,动线分离 */
|
|
1893
|
+
function jumpToLibrary(id) {
|
|
1894
|
+
var card = byId[id];
|
|
1895
|
+
if (!card) return;
|
|
1896
|
+
setView("library");
|
|
1897
|
+
card.classList.remove("hide", "open");
|
|
1898
|
+
card.classList.add("hl", "open");
|
|
1899
|
+
requestAnimationFrame(function () {
|
|
1900
|
+
requestAnimationFrame(function () { card.scrollIntoView({ block: "center", behavior: "smooth" }); });
|
|
1901
|
+
});
|
|
1902
|
+
setTimeout(function () { card.classList.remove("hl"); }, 2200);
|
|
1903
|
+
}
|
|
1904
|
+
document.querySelectorAll(".jb-quote").forEach(function (q) {
|
|
1905
|
+
function go() {
|
|
1906
|
+
var jbEl = q.closest(".jb");
|
|
1907
|
+
var id = jbEl && jbEl.getAttribute("data-cite");
|
|
1908
|
+
if (id) jumpToLibrary(id);
|
|
1909
|
+
}
|
|
1910
|
+
q.addEventListener("click", go);
|
|
1911
|
+
q.addEventListener("keydown", function (e) {
|
|
1912
|
+
if (e.key === "Enter" || e.key === " ") { e.preventDefault(); go(); }
|
|
1913
|
+
});
|
|
1914
|
+
});
|
|
1915
|
+
document.querySelectorAll("sup.cite").forEach(function (btn) {
|
|
1916
|
+
/* 仅剩未绑定角标(红色数字)走到这里:点击控制台留痕 */
|
|
1917
|
+
btn.addEventListener("click", function () {
|
|
1918
|
+
if (console.error) console.error("[核验] 未绑定角标:", btn.getAttribute("data-cite"));
|
|
1919
|
+
});
|
|
1920
|
+
});
|
|
1921
|
+
|
|
1922
|
+
/* 材料卡摘录直接全文展开(句后胶囊已承载即点即看,专库不再折叠) */
|
|
1923
|
+
|
|
1924
|
+
/* 胶囊点击:桌面开关对照气泡(同一气泡再点收起);手机端弹出底部材料弹层 */
|
|
1925
|
+
document.querySelectorAll(".ev-chip").forEach(function (chip) {
|
|
1926
|
+
chip.addEventListener("click", function () {
|
|
1927
|
+
var id = chip.getAttribute("data-cite");
|
|
1928
|
+
if (isMobile()) {
|
|
1929
|
+
var card = byId[id];
|
|
1930
|
+
if (card) openSheet(card, sentenceOf(chip));
|
|
1931
|
+
return;
|
|
1932
|
+
}
|
|
1933
|
+
togglePop(chip, id);
|
|
1934
|
+
});
|
|
1935
|
+
});
|
|
1936
|
+
|
|
1937
|
+
/* ===== 7. 材料专库:tabs + 搜索 + 热词 ===== */
|
|
1938
|
+
var cond = "";
|
|
1939
|
+
var kw = "";
|
|
1940
|
+
function applyFilter() {
|
|
1941
|
+
var visible = 0;
|
|
1942
|
+
cards.forEach(function (c) {
|
|
1943
|
+
var okCond = !cond;
|
|
1944
|
+
if (cond === "__unused__") okCond = c.getAttribute("data-unused") === "1";
|
|
1945
|
+
else if (cond) okCond = c.getAttribute("data-search") === cond;
|
|
1946
|
+
var okKw = !kw || (c.textContent || "").toLowerCase().indexOf(kw) !== -1;
|
|
1947
|
+
var show = okCond && okKw;
|
|
1948
|
+
c.classList.toggle("hide", !show);
|
|
1949
|
+
if (show) visible++;
|
|
1950
|
+
});
|
|
1951
|
+
var empty = $("#lib-empty");
|
|
1952
|
+
if (empty) empty.classList.toggle("hide", visible !== 0);
|
|
1953
|
+
}
|
|
1954
|
+
$$(".lib-tabs button").forEach(function (b) {
|
|
1955
|
+
b.addEventListener("click", function () {
|
|
1956
|
+
$$(".lib-tabs button").forEach(function (x) { x.classList.remove("on"); });
|
|
1957
|
+
b.classList.add("on");
|
|
1958
|
+
cond = b.getAttribute("data-cond") || "";
|
|
1959
|
+
applyFilter();
|
|
1960
|
+
});
|
|
1961
|
+
});
|
|
1962
|
+
var search = $(".lib-search");
|
|
1963
|
+
if (search) search.addEventListener("input", function () { kw = search.value.trim().toLowerCase(); applyFilter(); });
|
|
1964
|
+
$$(".hot-term").forEach(function (t) {
|
|
1965
|
+
t.addEventListener("click", function () {
|
|
1966
|
+
if (!search) return;
|
|
1967
|
+
search.value = t.textContent.trim();
|
|
1968
|
+
kw = search.value.toLowerCase();
|
|
1969
|
+
applyFilter();
|
|
1970
|
+
if (search.focus) search.focus();
|
|
1971
|
+
});
|
|
1972
|
+
});
|
|
1973
|
+
|
|
1974
|
+
/* ===== 8. 过程回顾条:检索步骤展开 ===== */
|
|
1975
|
+
var pStep = $("#p-step-search");
|
|
1976
|
+
var pDetail = $("#p-detail");
|
|
1977
|
+
if (pStep && pDetail) {
|
|
1978
|
+
function toggleDetail() { pDetail.classList.toggle("show"); }
|
|
1979
|
+
pStep.addEventListener("click", toggleDetail);
|
|
1980
|
+
pStep.addEventListener("keydown", function (e) {
|
|
1981
|
+
if (e.key === "Enter" || e.key === " ") { e.preventDefault(); toggleDetail(); }
|
|
1982
|
+
});
|
|
1983
|
+
}
|
|
1984
|
+
|
|
1985
|
+
/* ===== 9. 章节目录(spy) ===== */
|
|
1986
|
+
var toc = $(".toc");
|
|
1987
|
+
if (toc) {
|
|
1988
|
+
var links = $$("a", toc);
|
|
1989
|
+
var secs = links.map(function (a) { return document.querySelector(a.getAttribute("href")); });
|
|
1990
|
+
links.forEach(function (a) {
|
|
1991
|
+
a.addEventListener("click", function (e) {
|
|
1992
|
+
e.preventDefault();
|
|
1993
|
+
var target = document.querySelector(a.getAttribute("href"));
|
|
1994
|
+
if (target) target.scrollIntoView({ block: "start", behavior: "smooth" });
|
|
1995
|
+
});
|
|
1996
|
+
});
|
|
1997
|
+
function spy() {
|
|
1998
|
+
var pos = window.scrollY + 130;
|
|
1999
|
+
var current = -1;
|
|
2000
|
+
secs.forEach(function (s, i) { if (s && s.offsetTop <= pos) current = i; });
|
|
2001
|
+
links.forEach(function (a, i) { a.classList.toggle("on", i === current); });
|
|
2002
|
+
}
|
|
2003
|
+
window.addEventListener("scroll", spy, { passive: true });
|
|
2004
|
+
spy();
|
|
2005
|
+
}
|
|
2006
|
+
})();
|
|
2007
|
+
"""
|
|
2008
|
+
|
|
2009
|
+
|
|
908
2010
|
def render_html(payload: Dict[str, Any], title: str, answer_override: str = "", question_override: str = "",
|
|
909
2011
|
generated_at: Optional[datetime] = None) -> str:
|
|
910
2012
|
payload = unwrap(payload)
|
|
911
2013
|
answer = normalize_citations(answer_override) if answer_override.strip() else extract_answer(payload)
|
|
912
2014
|
sources = align_sources_to_answer(answer, extract_sources(payload))
|
|
913
2015
|
used = citation_ids(answer)
|
|
914
|
-
kb_urls = extract_knowledge_bases(payload)
|
|
915
|
-
kb_labels = payload.get("knowledgeBaseLabels") if isinstance(payload.get("knowledgeBaseLabels"), list) else []
|
|
916
2016
|
generated_at = generated_at or datetime.now()
|
|
917
2017
|
generated = generated_at.strftime("%Y-%m-%d %H:%M")
|
|
918
2018
|
|
|
919
2019
|
verification = compute_verification(answer, sources, payload, generated_at)
|
|
2020
|
+
process_stats = compute_process_stats(sources, answer)
|
|
2021
|
+
hot_terms = extract_hot_terms(answer, sources)
|
|
920
2022
|
citation_warning = ""
|
|
921
2023
|
if sources and not used:
|
|
922
2024
|
citation_warning = (
|
|
@@ -925,404 +2027,104 @@ def render_html(payload: Dict[str, Any], title: str, answer_override: str = "",
|
|
|
925
2027
|
'请修正溯源 JSON:在 document_content 的关键结论后标注 [1]、[2] 等角标并逐条对应 materials,'
|
|
926
2028
|
'然后重新运行 source_note_html.py 生成核验报告。</div>'
|
|
927
2029
|
)
|
|
928
|
-
|
|
2030
|
+
chip_map = build_chip_data(sources)
|
|
2031
|
+
blocks, _ = parse_answer_blocks(answer, {s["id"] for s in sources}, chip_map)
|
|
2032
|
+
# 胶囊内表格数据汇总(span 内静态表格会被解析器拆散,改为页尾 JSON + 展开时 JS 注入)
|
|
2033
|
+
jb_tables: Dict[str, str] = {}
|
|
2034
|
+
for cid, jb in chip_map.items():
|
|
2035
|
+
for key, html in (jb.pop("_tables", {}) or {}).items():
|
|
2036
|
+
jb_tables[key] = html
|
|
929
2037
|
doc_title, sections = group_sections(blocks)
|
|
930
2038
|
display_title = doc_title or title
|
|
931
|
-
kb_zone = render_kb_zone(kb_urls, kb_labels, len(sources))
|
|
932
2039
|
|
|
933
|
-
|
|
2040
|
+
jb_tables_json = json.dumps(jb_tables, ensure_ascii=False).replace("</", "<\\/")
|
|
2041
|
+
jb_tables_script = (f'<script type="application/json" id="jb-tables">{jb_tables_json}</script>\n'
|
|
2042
|
+
if jb_tables else "")
|
|
2043
|
+
|
|
934
2044
|
meta_bits = []
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
meta_bits.append("素材:" + " · ".join(cov_bits))
|
|
2045
|
+
if process_stats["n_searches"]:
|
|
2046
|
+
meta_bits.append(f"深知检索 {process_stats['n_searches']} 次")
|
|
938
2047
|
if sources:
|
|
939
|
-
meta_bits.append(f"
|
|
940
|
-
|
|
941
|
-
|
|
2048
|
+
meta_bits.append(f"召回材料 {len(sources)} 条")
|
|
2049
|
+
if process_stats["n_cite_marks"]:
|
|
2050
|
+
meta_bits.append(f"正文引用 {process_stats['n_cite_marks']} 处")
|
|
2051
|
+
meta_bits.append(f"生成于 {generated}")
|
|
2052
|
+
meta_line = " · ".join(meta_bits)
|
|
942
2053
|
|
|
943
2054
|
return f"""<!doctype html>
|
|
944
2055
|
<html lang="zh-CN">
|
|
945
2056
|
<head>
|
|
946
2057
|
<meta charset="utf-8">
|
|
947
2058
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
948
|
-
<title>{esc(display_title)} ·
|
|
949
|
-
<style>
|
|
950
|
-
:root{{
|
|
951
|
-
--navy:#0b1f3a; --ink:#172236; --muted:#667085; --line:#dce4ef; --line-strong:#b9c6d9;
|
|
952
|
-
--brand:#1559c7; --brand-soft:#e8f0ff;
|
|
953
|
-
--policy:#0c9b78; --policy-soft:#e2f6ef;
|
|
954
|
-
--case:#b26a00; --case-soft:#fff4e0;
|
|
955
|
-
--ref:#4b5563; --ref-soft:#eef1f6;
|
|
956
|
-
--warn:#b26a00; --danger:#b93939; --ok:#0c9b78;
|
|
957
|
-
}}
|
|
958
|
-
*{{box-sizing:border-box}}
|
|
959
|
-
body{{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;
|
|
960
|
-
color:var(--ink);background:#f4f7fb;line-height:1.75;font-size:14.5px}}
|
|
961
|
-
a{{color:var(--brand)}}
|
|
962
|
-
.topbar{{position:sticky;top:0;z-index:10;display:flex;justify-content:space-between;align-items:center;gap:10px;
|
|
963
|
-
padding:10px 22px;background:var(--navy);color:#fff;font-size:13px}}
|
|
964
|
-
.topbar .tb-title{{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}}
|
|
965
|
-
.topbar .tags{{display:flex;align-items:center;gap:6px;flex:none}}
|
|
966
|
-
.topbar .tags span{{padding:2px 10px;border:1px solid rgba(255,255,255,.3);border-radius:999px;font-size:11.5px}}
|
|
967
|
-
.layout{{display:grid;grid-template-columns:minmax(0,760px) minmax(340px,420px);gap:26px;
|
|
968
|
-
max-width:1240px;margin:0 auto;padding:26px 18px 60px}}
|
|
969
|
-
/* 左栏 */
|
|
970
|
-
.report{{min-width:0}}
|
|
971
|
-
.r-head{{padding:22px 26px;background:#fff;border:1px solid var(--line);border-radius:12px;margin-bottom:16px;text-align:center}}
|
|
972
|
-
.r-head h1{{margin:0 0 8px;font-size:22px;color:var(--navy);line-height:1.5}}
|
|
973
|
-
.r-head .sub{{color:var(--muted);font-size:12.5px}}
|
|
974
|
-
.warn-box{{margin:0 0 16px;padding:13px 16px;border:1.5px solid var(--danger);border-radius:10px;
|
|
975
|
-
background:#fdf3f3;color:#8f2626;font-size:13.5px;line-height:1.7}}
|
|
976
|
-
.verify{{margin:0 0 16px;background:#fff;border:1px solid #bfe5d6;border-radius:12px;padding:16px 20px}}
|
|
977
|
-
.verify.fail{{border-color:#f2c4c4;background:#fffafa}}
|
|
978
|
-
.v-head{{display:flex;align-items:center;gap:9px;font-size:15px;font-weight:800;color:var(--ok)}}
|
|
979
|
-
.verify.fail .v-head{{color:var(--danger)}}
|
|
980
|
-
.v-shield{{display:inline-flex;width:22px;height:22px;border-radius:50%;background:var(--ok);color:#fff;
|
|
981
|
-
align-items:center;justify-content:center;font-size:12px;flex:none}}
|
|
982
|
-
.verify.fail .v-shield{{background:var(--danger)}}
|
|
983
|
-
.v-stamp{{margin-left:auto;font-size:11px;border:1.5px solid var(--ok);color:var(--ok);border-radius:5px;
|
|
984
|
-
padding:1px 8px;letter-spacing:2px;flex:none}}
|
|
985
|
-
.v-stamp.bad{{border-color:var(--danger);color:var(--danger)}}
|
|
986
|
-
.v-reasons{{margin-top:6px;font-size:12.5px;color:var(--danger)}}
|
|
987
|
-
.v-grid{{display:grid;grid-template-columns:1fr 1fr;gap:4px 20px;margin-top:10px}}
|
|
988
|
-
.vi{{display:flex;gap:7px;align-items:baseline;font-size:12.5px;color:#35445c;line-height:1.7;min-width:0}}
|
|
989
|
-
.vi .s{{font-weight:800;flex:none}}
|
|
990
|
-
.vi .s.ok{{color:var(--ok)}}
|
|
991
|
-
.vi .s.warn{{color:var(--warn)}}
|
|
992
|
-
.vi .s.fail{{color:var(--danger)}}
|
|
993
|
-
.vi .s.man{{color:var(--case)}}
|
|
994
|
-
.vi .s.none{{color:var(--muted)}}
|
|
995
|
-
.vi .d{{color:var(--muted);min-width:0}}
|
|
996
|
-
.v-note{{margin-top:11px;padding-top:9px;border-top:1px dashed var(--line);font-size:11.5px;color:var(--muted);line-height:1.7}}
|
|
997
|
-
/* 正文章节卡 */
|
|
998
|
-
.doc-sec{{background:#fff;border:1px solid var(--line);border-radius:12px;padding:20px 24px;margin-bottom:16px}}
|
|
999
|
-
.sec-head{{display:flex;align-items:center;gap:9px;flex-wrap:wrap;margin-bottom:10px;
|
|
1000
|
-
padding-bottom:10px;border-bottom:1px solid var(--line)}}
|
|
1001
|
-
.sec-no{{display:inline-flex;width:26px;height:26px;border-radius:7px;background:var(--brand);color:#fff;
|
|
1002
|
-
align-items:center;justify-content:center;font-size:13.5px;font-weight:700;flex:none}}
|
|
1003
|
-
.sec-head h3{{margin:0;font-size:16.5px;color:var(--navy);line-height:1.5}}
|
|
1004
|
-
.sec-badge{{margin-left:auto;font-size:11.5px;color:var(--ok);background:var(--policy-soft);
|
|
1005
|
-
border-radius:6px;padding:2px 9px;font-weight:700;flex:none}}
|
|
1006
|
-
.sec-badge.bad{{color:var(--danger);background:#fdecea}}
|
|
1007
|
-
.doc-sub{{margin:16px 0 8px;color:var(--navy);font-size:14.5px;font-weight:700}}
|
|
1008
|
-
h5.doc-sub{{font-size:13.5px}}
|
|
1009
|
-
.doc-block,.doc-item{{margin:0 0 12px}}
|
|
1010
|
-
.doc-block p,.doc-item p{{margin:0;font-size:14px;line-height:1.9}}
|
|
1011
|
-
.doc-item{{display:grid;grid-template-columns:22px minmax(0,1fr);gap:8px}}
|
|
1012
|
-
.doc-item.numbered{{grid-template-columns:28px minmax(0,1fr)}}
|
|
1013
|
-
.doc-bullet{{padding-top:1px;color:#111827;font-size:15px;line-height:1.85}}
|
|
1014
|
-
.doc-divider{{border:0;border-top:1px solid var(--line);margin:18px 0}}
|
|
1015
|
-
code{{padding:1px 5px;border-radius:4px;background:#f3f4f6;color:#374151;
|
|
1016
|
-
font-family:ui-monospace,Menlo,Consolas,monospace;font-size:12px}}
|
|
1017
|
-
.tbl-wrap{{max-width:100%;overflow-x:auto;margin:8px 0}}
|
|
1018
|
-
.data-tbl{{width:100%;border-collapse:collapse;border:1px solid var(--line);font-size:13px}}
|
|
1019
|
-
.data-tbl th,.data-tbl td{{border:1px solid var(--line);padding:8px 10px;text-align:left;vertical-align:top;line-height:1.65}}
|
|
1020
|
-
.data-tbl th{{background:#f2f5fb;font-weight:700;color:#374151}}
|
|
1021
|
-
/* 角标 */
|
|
1022
|
-
.cite{{margin:0 1px;padding:0 5px;border:0;border-radius:4px;background:var(--brand-soft);color:var(--brand);
|
|
1023
|
-
font-weight:800;font-size:10.5px;cursor:pointer;vertical-align:super;font-family:monospace}}
|
|
1024
|
-
.cite:hover,.cite:focus-visible{{background:var(--brand);color:#fff;outline:none}}
|
|
1025
|
-
.cite.unresolved{{background:#fdecea;color:var(--danger)}}
|
|
1026
|
-
/* 段落级证据 chips */
|
|
1027
|
-
.ev-row{{display:flex;flex-wrap:wrap;gap:6px;margin:6px 0 2px}}
|
|
1028
|
-
.ev-chip{{max-width:100%}}
|
|
1029
|
-
.ev-chip summary{{display:inline-flex;align-items:center;max-width:100%;border-radius:999px;padding:3px 10px;
|
|
1030
|
-
color:#4b5563;background:#f3f4f6;cursor:pointer;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
|
|
1031
|
-
list-style:none;font-size:11.5px}}
|
|
1032
|
-
.ev-chip summary::-webkit-details-marker{{display:none}}
|
|
1033
|
-
.ev-chip summary::after{{content:"核验";margin-left:7px;color:#9ca3af;font-size:10.5px}}
|
|
1034
|
-
.ev-chip[open] summary::after{{content:"收起"}}
|
|
1035
|
-
.ev-chip summary b{{color:var(--brand);margin-right:5px}}
|
|
1036
|
-
.ev-panel{{margin:7px 0 6px;padding:12px 14px;border:1px solid var(--line);border-radius:9px;background:#fbfcfe;
|
|
1037
|
-
box-shadow:0 8px 24px rgba(15,23,42,.06)}}
|
|
1038
|
-
.ev-title{{font-weight:700;font-size:13.5px;margin-bottom:4px;color:var(--navy)}}
|
|
1039
|
-
.ev-meta{{color:var(--muted);font-size:12px;margin-bottom:6px}}
|
|
1040
|
-
.ev-panel p{{margin:0 0 8px;color:#374151;font-size:12.8px;line-height:1.7}}
|
|
1041
|
-
.sc-links{{display:flex;flex-wrap:wrap;gap:8px;margin-top:6px}}
|
|
1042
|
-
.sc-links span{{display:inline-flex}}
|
|
1043
|
-
.sc-links a{{display:inline-flex;align-items:center;min-height:24px;padding:3px 9px;border-radius:6px;
|
|
1044
|
-
background:var(--brand-soft);color:var(--brand);font-weight:700;text-decoration:none;font-size:12px}}
|
|
1045
|
-
/* 右栏 核验材料 */
|
|
1046
|
-
.sources{{position:sticky;top:56px;align-self:start;max-height:calc(100vh - 76px);overflow:auto;
|
|
1047
|
-
background:#fff;border:1px solid var(--line);border-radius:12px;padding:16px 18px}}
|
|
1048
|
-
.sources h3{{margin:0 0 3px;font-size:15px;color:var(--navy)}}
|
|
1049
|
-
.src-tip{{font-size:11.5px;color:var(--muted);margin-bottom:10px}}
|
|
1050
|
-
.filters{{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:8px}}
|
|
1051
|
-
.filters button{{border:1px solid var(--line);border-radius:999px;background:#fff;color:var(--muted);
|
|
1052
|
-
padding:3px 11px;font-size:12px;cursor:pointer}}
|
|
1053
|
-
.filters button.on{{background:var(--brand);border-color:var(--brand);color:#fff;font-weight:700}}
|
|
1054
|
-
.src-search{{width:100%;padding:7px 10px;border:1px solid var(--line);border-radius:7px;font-size:12.5px;margin-bottom:12px}}
|
|
1055
|
-
.scard{{border:1px solid var(--line);border-left-width:3px;border-radius:10px;padding:11px 13px;margin-bottom:10px;
|
|
1056
|
-
background:#fff;transition:box-shadow .25s}}
|
|
1057
|
-
.scard.pol{{border-left-color:var(--policy)}}
|
|
1058
|
-
.scard.dat{{border-left-color:var(--brand)}}
|
|
1059
|
-
.scard.cas{{border-left-color:var(--case)}}
|
|
1060
|
-
.scard.ref,.scard.mat{{border-left-color:var(--ref)}}
|
|
1061
|
-
.scard.hl{{box-shadow:0 0 0 3px var(--brand)}}
|
|
1062
|
-
.scard.hide{{display:none}}
|
|
1063
|
-
.sc-head{{display:flex;align-items:center;gap:7px;margin-bottom:4px}}
|
|
1064
|
-
.sc-id{{font-family:monospace;font-weight:800;font-size:11px;color:var(--brand);background:var(--brand-soft);
|
|
1065
|
-
border-radius:4px;padding:1px 7px}}
|
|
1066
|
-
.sc-type{{font-size:11px;font-weight:700;border-radius:4px;padding:1px 8px;background:var(--ref-soft);color:var(--ref)}}
|
|
1067
|
-
.scard.pol .sc-type{{background:var(--policy-soft);color:var(--policy)}}
|
|
1068
|
-
.scard.dat .sc-type{{background:var(--brand-soft);color:var(--brand)}}
|
|
1069
|
-
.scard.cas .sc-type{{background:var(--case-soft);color:var(--case)}}
|
|
1070
|
-
.sc-vk{{margin-left:auto;font-size:11px;font-weight:800;color:var(--ok)}}
|
|
1071
|
-
.sc-vk.warn{{color:var(--warn)}}
|
|
1072
|
-
.scard h4{{margin:0 0 4px;font-size:13px;color:var(--navy);line-height:1.55}}
|
|
1073
|
-
.sc-meta{{font-size:11.5px;color:var(--muted)}}
|
|
1074
|
-
.sc-section{{font-size:11.5px;color:var(--brand);margin-top:3px;font-weight:600}}
|
|
1075
|
-
.sc-vnote{{margin-top:5px;font-size:11.3px;color:var(--ok);line-height:1.6}}
|
|
1076
|
-
.sc-excerpt{{margin:7px 0;padding:9px 10px;border-radius:7px;background:#f8fafc;color:#42566f;font-size:12px;line-height:1.7;
|
|
1077
|
-
display:-webkit-box;-webkit-line-clamp:4;-webkit-box-orient:vertical;overflow:hidden;cursor:pointer}}
|
|
1078
|
-
.scard.open .sc-excerpt{{display:block;-webkit-line-clamp:unset}}
|
|
1079
|
-
.sc-excerpt.rich{{overflow-x:auto}}
|
|
1080
|
-
.sc-excerpt.rich table{{width:max-content;min-width:100%;border-collapse:collapse;background:#fff;font-size:12px}}
|
|
1081
|
-
.sc-excerpt.rich td,.sc-excerpt.rich th{{min-width:92px;max-width:220px;padding:7px 8px;border:1px solid var(--line);
|
|
1082
|
-
vertical-align:top;word-break:break-word}}
|
|
1083
|
-
.sc-excerpt.rich thead td,.sc-excerpt.rich th{{background:#f3f4f6;color:#374151;font-weight:700}}
|
|
1084
|
-
.scard .sc-links a{{font-size:12px}}
|
|
1085
|
-
.scard .sc-links{{margin-top:4px}}
|
|
1086
|
-
.no-link{{font-size:11.5px;color:var(--muted)}}
|
|
1087
|
-
.uncited-group{{margin-top:12px;border-top:1px dashed var(--line-strong);padding-top:10px}}
|
|
1088
|
-
.ug-title{{font-size:12.5px;color:var(--muted);font-weight:700;line-height:1.6}}
|
|
1089
|
-
.uncited-group .uncited-list{{margin-top:10px}}
|
|
1090
|
-
/* 知识专库 */
|
|
1091
|
-
.kb-zone{{margin-top:14px;border-top:1px dashed var(--line-strong);padding-top:12px}}
|
|
1092
|
-
.kb-title{{font-size:12.5px;font-weight:800;color:var(--navy)}}
|
|
1093
|
-
.kb-desc{{font-size:11.3px;color:var(--muted);line-height:1.65;margin:3px 0 8px}}
|
|
1094
|
-
.kb-list{{display:flex;flex-direction:column;gap:7px}}
|
|
1095
|
-
.kb-chip{{display:flex;align-items:center;gap:8px;padding:7px 10px;border:1px solid var(--line);border-radius:8px;
|
|
1096
|
-
background:#fbfcfe;text-decoration:none;font-size:11.5px}}
|
|
1097
|
-
.kb-chip:hover{{border-color:var(--brand);background:var(--brand-soft)}}
|
|
1098
|
-
.kb-label{{font-weight:700;color:#374151;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}}
|
|
1099
|
-
.kb-count{{padding-left:8px;border-left:1px solid var(--line);color:var(--muted);white-space:nowrap}}
|
|
1100
|
-
.kb-arrow{{margin-left:auto;color:var(--brand);font-weight:700;white-space:nowrap}}
|
|
1101
|
-
.empty{{color:var(--muted)}}
|
|
1102
|
-
.foot{{text-align:center;color:var(--muted);font-size:11.5px;padding:16px 0 4px;line-height:1.8}}
|
|
1103
|
-
@media (max-width:1020px){{
|
|
1104
|
-
.layout{{grid-template-columns:1fr}}
|
|
1105
|
-
.sources{{position:static;max-height:none}}
|
|
1106
|
-
}}
|
|
1107
|
-
/* —— 移动端专项适配(手机阅读核验报告) —— */
|
|
1108
|
-
.mobile-nav{{display:none}}
|
|
1109
|
-
.back-doc{{display:none}}
|
|
1110
|
-
/* 移动端材料底部弹层:点角标就地弹出材料卡,不跳转打断阅读 */
|
|
1111
|
-
.sheet-mask{{display:none}}
|
|
1112
|
-
.sheet{{display:none}}
|
|
1113
|
-
@media (max-width:680px){{
|
|
1114
|
-
body{{font-size:14px;line-height:1.8}}
|
|
1115
|
-
.layout{{grid-template-columns:1fr;padding:12px 10px 40px;gap:14px}}
|
|
1116
|
-
.topbar{{padding:8px 12px;font-size:12px;gap:4px;flex-wrap:wrap}}
|
|
1117
|
-
.topbar .tags span{{font-size:10.5px;padding:1px 8px;margin-left:4px}}
|
|
1118
|
-
.r-head{{padding:16px 14px;border-radius:10px}}
|
|
1119
|
-
.r-head h1{{font-size:18px}}
|
|
1120
|
-
.r-head .sub{{font-size:11.5px;line-height:1.6}}
|
|
1121
|
-
.verify{{padding:13px 14px;border-radius:10px}}
|
|
1122
|
-
.v-head{{font-size:14px}}
|
|
1123
|
-
.v-grid{{grid-template-columns:1fr;gap:2px 0}}
|
|
1124
|
-
.vi{{flex-wrap:wrap;gap:4px 8px}}
|
|
1125
|
-
.vi .d{{min-width:0}}
|
|
1126
|
-
.warn-box{{font-size:12.5px;padding:11px 12px}}
|
|
1127
|
-
.doc-sec{{padding:14px;border-radius:10px}}
|
|
1128
|
-
.sec-no{{width:22px;height:22px;font-size:12px;border-radius:6px}}
|
|
1129
|
-
.sec-head{{gap:7px;padding-bottom:8px;margin-bottom:8px}}
|
|
1130
|
-
.sec-head h3{{font-size:15px}}
|
|
1131
|
-
.sec-badge{{margin-left:0;font-size:11px}}
|
|
1132
|
-
.doc-block p,.doc-item p{{font-size:13.5px;line-height:1.95}}
|
|
1133
|
-
.doc-sub{{font-size:14px;margin:12px 0 6px}}
|
|
1134
|
-
.data-tbl{{font-size:12px}}
|
|
1135
|
-
.data-tbl th,.data-tbl td{{padding:6px 7px;line-height:1.55}}
|
|
1136
|
-
.cite{{font-size:11px;padding:0 4px}}
|
|
1137
|
-
.ev-chip summary{{font-size:11px}}
|
|
1138
|
-
.sources{{padding:12px;border-radius:10px}}
|
|
1139
|
-
.scard{{padding:10px 11px}}
|
|
1140
|
-
.sc-excerpt{{font-size:11.5px}}
|
|
1141
|
-
.kb-chip{{flex-wrap:wrap}}
|
|
1142
|
-
.kb-label{{white-space:normal}}
|
|
1143
|
-
.mobile-nav{{display:block;margin:0 0 14px;padding:11px 14px;border:1.5px solid var(--brand);
|
|
1144
|
-
border-radius:10px;background:var(--brand-soft);color:var(--brand);font-weight:800;
|
|
1145
|
-
font-size:13.5px;text-decoration:none;text-align:center}}
|
|
1146
|
-
.back-doc{{display:inline-block;margin:0 0 8px;font-size:12px;color:var(--brand);
|
|
1147
|
-
font-weight:700;text-decoration:none}}
|
|
1148
|
-
.sheet-mask{{display:block;position:fixed;inset:0;background:rgba(11,31,58,.45);z-index:99;opacity:0;
|
|
1149
|
-
pointer-events:none;transition:opacity .2s}}
|
|
1150
|
-
.sheet-mask.show{{opacity:1;pointer-events:auto}}
|
|
1151
|
-
.sheet{{display:block;position:fixed;left:0;right:0;bottom:0;z-index:100;background:#fff;
|
|
1152
|
-
border-radius:14px 14px 0 0;box-shadow:0 -8px 30px rgba(11,31,58,.25);
|
|
1153
|
-
max-height:68vh;overflow-y:auto;-webkit-overflow-scrolling:touch;
|
|
1154
|
-
padding:10px 16px 22px;transform:translateY(105%);transition:transform .25s ease}}
|
|
1155
|
-
.sheet.show{{transform:translateY(0)}}
|
|
1156
|
-
.sheet-grab{{width:38px;height:4px;border-radius:2px;background:#c9d4e2;margin:2px auto 8px}}
|
|
1157
|
-
.sheet-head{{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px}}
|
|
1158
|
-
.sheet-head b{{font-size:13.5px;color:var(--navy)}}
|
|
1159
|
-
.sheet-close{{border:1px solid var(--line);background:#f5f8fc;border-radius:8px;color:#3b4a61;
|
|
1160
|
-
font-size:12.5px;font-weight:700;padding:5px 14px;cursor:pointer}}
|
|
1161
|
-
.sheet .scard{{box-shadow:none;margin-bottom:0}}
|
|
1162
|
-
.sheet .sc-excerpt{{display:block;-webkit-line-clamp:unset;cursor:auto}}
|
|
1163
|
-
}}
|
|
1164
|
-
@media print{{
|
|
1165
|
-
.topbar,.filters,.src-search{{display:none!important}}
|
|
1166
|
-
.layout{{grid-template-columns:1fr;max-width:none;padding:0;gap:14px}}
|
|
1167
|
-
body{{background:#fff;font-size:12.5px}}
|
|
1168
|
-
.sources{{position:static;max-height:none;border:0;padding:0;overflow:visible}}
|
|
1169
|
-
.r-head,.verify,.doc-sec{{border-color:#bbb;box-shadow:none;break-inside:avoid}}
|
|
1170
|
-
.sc-excerpt{{display:block;-webkit-line-clamp:unset;cursor:auto}}
|
|
1171
|
-
.uncited-group[open] .uncited-list,.uncited-group{{break-inside:avoid}}
|
|
1172
|
-
.scard{{break-inside:avoid}}
|
|
1173
|
-
.cite{{background:#eee;color:#333}}
|
|
1174
|
-
}}
|
|
1175
|
-
</style>
|
|
2059
|
+
<title>{esc(display_title)} · 溯源核验报告</title>
|
|
2060
|
+
<style>{PAGE_CSS}</style>
|
|
1176
2061
|
</head>
|
|
1177
2062
|
<body>
|
|
1178
2063
|
|
|
1179
2064
|
<header class="topbar">
|
|
1180
|
-
<div class="tb-
|
|
1181
|
-
|
|
1182
|
-
<span
|
|
1183
|
-
<span>素材来源:深知可信搜索</span>
|
|
2065
|
+
<div class="tb-left">
|
|
2066
|
+
<span class="tb-stamp">溯源核验报告</span>
|
|
2067
|
+
<span class="tb-title">{esc(display_title)}</span>
|
|
1184
2068
|
</div>
|
|
2069
|
+
<div class="tb-right">
|
|
2070
|
+
<div class="view-switch" role="tablist" aria-label="视图切换">
|
|
2071
|
+
<button class="on" data-view="report" type="button">核验报告</button>
|
|
2072
|
+
<button data-view="library" type="button">材料专库</button>
|
|
2073
|
+
</div>
|
|
2074
|
+
<div class="tb-tools">
|
|
2075
|
+
<button id="btn-reading" type="button" aria-pressed="false" title="隐藏核验元素,纯阅读正文">只看正文</button>
|
|
2076
|
+
<button id="btn-copy" type="button" title="复制正文纯文本">复制全文</button>
|
|
2077
|
+
<span class="print-menu">
|
|
2078
|
+
<button id="btn-print" type="button" aria-haspopup="true" title="浏览器打印/另存为 PDF">打印归档 ▾</button>
|
|
2079
|
+
<span class="print-drop" id="print-drop" hidden>
|
|
2080
|
+
<button id="print-body" type="button">只打印正文</button>
|
|
2081
|
+
<button id="print-full" type="button">完整归档(含核验材料)</button>
|
|
2082
|
+
</span>
|
|
2083
|
+
</span>
|
|
2084
|
+
</div>
|
|
2085
|
+
</div>
|
|
2086
|
+
<div class="progress" aria-hidden="true"><i></i></div>
|
|
1185
2087
|
</header>
|
|
1186
2088
|
|
|
1187
|
-
<div class="
|
|
1188
|
-
<
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
2089
|
+
<div class="hero">
|
|
2090
|
+
<div class="r-badge">溯源核验报告</div>
|
|
2091
|
+
<h1>{esc(display_title)}</h1>
|
|
2092
|
+
<div class="meta">{esc(meta_line)} | 素材来源:深知可信搜索</div>
|
|
2093
|
+
<div class="hero-switch">
|
|
2094
|
+
<div class="view-switch" role="tablist" aria-label="视图切换">
|
|
2095
|
+
<button class="on" data-view="report" type="button">核验报告</button>
|
|
2096
|
+
<button data-view="library" type="button">材料专库({len(sources)})</button>
|
|
1192
2097
|
</div>
|
|
2098
|
+
</div>
|
|
2099
|
+
</div>
|
|
2100
|
+
|
|
2101
|
+
<div class="app container" data-view="report">
|
|
2102
|
+
{render_process_bar(process_stats, verification)}
|
|
2103
|
+
|
|
2104
|
+
<main class="view" id="view-report" aria-label="核验报告正文">
|
|
1193
2105
|
{citation_warning}
|
|
1194
2106
|
{render_verify_panel(verification)}
|
|
1195
|
-
<
|
|
2107
|
+
<div class="doc-paper">
|
|
1196
2108
|
{render_section_cards(sections, sources)}
|
|
1197
|
-
|
|
2109
|
+
</div>
|
|
2110
|
+
<div class="foot">深知公文写作 · 溯源核验报告 | 内容由 AI 生成,仅供参考,政策现行效力以官方发布为准</div>
|
|
1198
2111
|
</main>
|
|
1199
|
-
|
|
2112
|
+
|
|
2113
|
+
{render_library_view(sources, hot_terms)}
|
|
2114
|
+
{render_print_appendix(sources)}
|
|
1200
2115
|
</div>
|
|
1201
2116
|
|
|
1202
|
-
|
|
2117
|
+
{render_toc(sections)}
|
|
2118
|
+
|
|
2119
|
+
<div class="ev-panel" id="ev-pop" hidden></div>
|
|
2120
|
+
{jb_tables_script}<div class="sheet-mask" aria-hidden="true"></div>
|
|
1203
2121
|
<div class="sheet" role="dialog" aria-label="核验材料">
|
|
1204
2122
|
<div class="sheet-grab"></div>
|
|
1205
|
-
<div class="sheet-head"><b
|
|
2123
|
+
<div class="sheet-head"><b>依据对照</b><button class="sheet-close" type="button">收起</button></div>
|
|
1206
2124
|
<div class="sheet-body"></div>
|
|
1207
2125
|
</div>
|
|
1208
2126
|
|
|
1209
|
-
<script>
|
|
1210
|
-
(function () {{
|
|
1211
|
-
"use strict";
|
|
1212
|
-
var cards = Array.prototype.slice.call(document.querySelectorAll(".scard"));
|
|
1213
|
-
var byId = {{}};
|
|
1214
|
-
cards.forEach(function (c) {{
|
|
1215
|
-
var id = c.getAttribute("data-cite-id");
|
|
1216
|
-
if (id) byId[id] = c;
|
|
1217
|
-
}});
|
|
1218
|
-
|
|
1219
|
-
/* 移动端底部弹层:点角标就地展示材料卡,不打断正文阅读 */
|
|
1220
|
-
var sheet = document.querySelector(".sheet");
|
|
1221
|
-
var mask = document.querySelector(".sheet-mask");
|
|
1222
|
-
function isMobile() {{
|
|
1223
|
-
return window.matchMedia("(max-width:680px)").matches;
|
|
1224
|
-
}}
|
|
1225
|
-
function openSheet(card) {{
|
|
1226
|
-
if (!sheet) return;
|
|
1227
|
-
var body = sheet.querySelector(".sheet-body");
|
|
1228
|
-
var clone = card.cloneNode(true);
|
|
1229
|
-
clone.removeAttribute("id");
|
|
1230
|
-
clone.classList.remove("hide");
|
|
1231
|
-
clone.classList.add("open");
|
|
1232
|
-
body.innerHTML = "";
|
|
1233
|
-
body.appendChild(clone);
|
|
1234
|
-
sheet.classList.add("show");
|
|
1235
|
-
mask.classList.add("show");
|
|
1236
|
-
document.body.style.overflow = "hidden";
|
|
1237
|
-
sheet.scrollTop = 0;
|
|
1238
|
-
}}
|
|
1239
|
-
function closeSheet() {{
|
|
1240
|
-
if (!sheet) return;
|
|
1241
|
-
sheet.classList.remove("show");
|
|
1242
|
-
mask.classList.remove("show");
|
|
1243
|
-
document.body.style.overflow = "";
|
|
1244
|
-
}}
|
|
1245
|
-
if (sheet && mask) {{
|
|
1246
|
-
mask.addEventListener("click", closeSheet);
|
|
1247
|
-
var closeBtn = sheet.querySelector(".sheet-close");
|
|
1248
|
-
if (closeBtn) closeBtn.addEventListener("click", closeSheet);
|
|
1249
|
-
}}
|
|
1250
|
-
|
|
1251
|
-
/* 角标 → 来源卡:精确 ID 匹配,缺失即红色警示,绝不按位置猜测。
|
|
1252
|
-
手机单栏下不滚动定位(会跳到页面底部打断阅读),改为底部弹层就地查看。 */
|
|
1253
|
-
document.querySelectorAll(".data-cite,[data-cite]").forEach(function (btn) {{
|
|
1254
|
-
if (btn.classList.contains("sheet-close")) return;
|
|
1255
|
-
btn.addEventListener("click", function () {{
|
|
1256
|
-
var card = byId[btn.getAttribute("data-cite")];
|
|
1257
|
-
if (!card) {{
|
|
1258
|
-
btn.classList.add("unresolved");
|
|
1259
|
-
if (console.error) console.error("[核验] 未绑定角标:", btn.getAttribute("data-cite"));
|
|
1260
|
-
return;
|
|
1261
|
-
}}
|
|
1262
|
-
if (isMobile()) {{
|
|
1263
|
-
openSheet(card);
|
|
1264
|
-
return;
|
|
1265
|
-
}}
|
|
1266
|
-
card.classList.remove("hide", "open");
|
|
1267
|
-
card.classList.add("hl", "open");
|
|
1268
|
-
card.scrollIntoView({{ block: "center", behavior: "smooth" }});
|
|
1269
|
-
setTimeout(function () {{ card.classList.remove("hl"); }}, 2200);
|
|
1270
|
-
}});
|
|
1271
|
-
}});
|
|
1272
|
-
|
|
1273
|
-
/* 摘录点击展开/收起 */
|
|
1274
|
-
cards.forEach(function (c) {{
|
|
1275
|
-
var ex = c.querySelector(".sc-excerpt");
|
|
1276
|
-
if (!ex) return;
|
|
1277
|
-
ex.addEventListener("click", function (e) {{
|
|
1278
|
-
if (e.target.closest("a")) return;
|
|
1279
|
-
c.classList.toggle("open");
|
|
1280
|
-
}});
|
|
1281
|
-
}});
|
|
1282
|
-
|
|
1283
|
-
/* 证据 chips(灰框):桌面端点击就地展开并高亮右栏来源卡;手机端不就地展开,点击直接弹出底部材料弹层 */
|
|
1284
|
-
document.querySelectorAll(".ev-chip").forEach(function (chip) {{
|
|
1285
|
-
var summary = chip.querySelector("summary");
|
|
1286
|
-
if (summary) {{
|
|
1287
|
-
summary.addEventListener("click", function (e) {{
|
|
1288
|
-
if (!isMobile()) return;
|
|
1289
|
-
e.preventDefault();
|
|
1290
|
-
var card = byId[chip.getAttribute("data-cite")];
|
|
1291
|
-
if (card) openSheet(card);
|
|
1292
|
-
}});
|
|
1293
|
-
}}
|
|
1294
|
-
chip.addEventListener("toggle", function () {{
|
|
1295
|
-
if (!chip.open || isMobile()) return;
|
|
1296
|
-
var card = byId[chip.getAttribute("data-cite")];
|
|
1297
|
-
if (!card) return;
|
|
1298
|
-
cards.forEach(function (c) {{ c.classList.remove("hl"); }});
|
|
1299
|
-
card.classList.add("hl");
|
|
1300
|
-
setTimeout(function () {{ card.classList.remove("hl"); }}, 2200);
|
|
1301
|
-
}});
|
|
1302
|
-
}});
|
|
1303
|
-
|
|
1304
|
-
/* 类型筛选 + 搜索 */
|
|
1305
|
-
var filter = "all";
|
|
1306
|
-
var kw = "";
|
|
1307
|
-
function apply() {{
|
|
1308
|
-
cards.forEach(function (c) {{
|
|
1309
|
-
var okType = filter === "all" || c.getAttribute("data-type") === filter;
|
|
1310
|
-
var okKw = !kw || (c.textContent || "").toLowerCase().indexOf(kw) !== -1;
|
|
1311
|
-
c.classList.toggle("hide", !(okType && okKw));
|
|
1312
|
-
}});
|
|
1313
|
-
}}
|
|
1314
|
-
document.querySelectorAll(".filters button").forEach(function (b) {{
|
|
1315
|
-
b.addEventListener("click", function () {{
|
|
1316
|
-
document.querySelectorAll(".filters button").forEach(function (x) {{ x.classList.remove("on"); }});
|
|
1317
|
-
b.classList.add("on");
|
|
1318
|
-
filter = b.getAttribute("data-f");
|
|
1319
|
-
apply();
|
|
1320
|
-
}});
|
|
1321
|
-
}});
|
|
1322
|
-
var search = document.querySelector(".src-search");
|
|
1323
|
-
if (search) search.addEventListener("input", function () {{ kw = search.value.trim().toLowerCase(); apply(); }});
|
|
1324
|
-
}})();
|
|
1325
|
-
</script>
|
|
2127
|
+
<script>{PAGE_JS}</script>
|
|
1326
2128
|
</body>
|
|
1327
2129
|
</html>"""
|
|
1328
2130
|
|
|
@@ -1345,19 +2147,22 @@ def align_sources_to_answer(answer: str, sources: List[Dict[str, str]]) -> List[
|
|
|
1345
2147
|
return aligned
|
|
1346
2148
|
|
|
1347
2149
|
|
|
1348
|
-
|
|
1349
|
-
|
|
2150
|
+
|
|
2151
|
+
def _dsh_default_output_dir() -> str:
|
|
2152
|
+
"""dsh:未显式传 --output 时,默认输出到会话产物目录 official-docs/output/。"""
|
|
1350
2153
|
import os as _os
|
|
1351
2154
|
_ws = _os.environ.get("DKNWOC_WS_ROOT")
|
|
1352
2155
|
if not _ws:
|
|
1353
2156
|
_sid = _os.environ.get("DSH_SESSION_ID", "")
|
|
1354
2157
|
_ws = str(Path.cwd() / "dknowc-output" / (_sid[:8] if _sid else "_default"))
|
|
1355
|
-
|
|
2158
|
+
return str(Path(_ws).resolve() / "official-docs" / "output")
|
|
2159
|
+
|
|
1356
2160
|
|
|
2161
|
+
def main() -> None:
|
|
1357
2162
|
parser = argparse.ArgumentParser(description="生成可信溯源核验报告 HTML")
|
|
1358
2163
|
parser.add_argument("input_json", help="结构化溯源 JSON 或搜索结果 JSON")
|
|
1359
2164
|
parser.add_argument("--output", help="输出 HTML 路径;不传时根据问题自动生成短文件名")
|
|
1360
|
-
parser.add_argument("--output-dir", default=
|
|
2165
|
+
parser.add_argument("--output-dir", default=_dsh_default_output_dir(), help="未传 --output 时的输出目录")
|
|
1361
2166
|
parser.add_argument("--title", default="可信溯源核验报告", help="页面标题")
|
|
1362
2167
|
parser.add_argument("--answer-file", help="最终正文文件。复杂任务综合后必须传入,确保 HTML 展示的正文与交付一致。")
|
|
1363
2168
|
parser.add_argument("--clean-md-output", help="输出干净 Markdown 路径;内容来自同一份最终答案,并移除 [1]、【1】等溯源角标。")
|