dknowc-dsh 1.3.0 → 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 +1 -1
- package/skills/dknowc-official-doc-writer/SKILL.md +26 -6
- package/skills/dknowc-official-doc-writer/reference/sample_trace_report.html +901 -269
- package/skills/dknowc-official-doc-writer/reference/search_guide.md +31 -3
- package/skills/dknowc-official-doc-writer/reference/search_policy.md +14 -1
- package/skills/dknowc-official-doc-writer/reference/task_router.md +1 -1
- package/skills/dknowc-official-doc-writer/scripts/adapt_mcp_result.py +52 -2
- package/skills/dknowc-official-doc-writer/scripts/dkag_search.py +9 -1
- package/skills/dknowc-official-doc-writer/scripts/initialize.py +6 -14
- package/skills/dknowc-official-doc-writer/scripts/mcp_direct.py +1 -1
- package/skills/dknowc-official-doc-writer/scripts/register.mjs +2 -2
- package/skills/dknowc-official-doc-writer/scripts/render_trace_html.py +1317 -607
- package/skills/dknowc-official-doc-writer/scripts/source_note_html.py +140 -4
- package/skills/dknowc-ppt-assistant/SKILL.md +3 -3
- package/skills/dknowc-ppt-assistant/references/material_usage.md +2 -2
- package/skills/dknowc-ppt-assistant/references/sample_trace_report.html +1335 -292
- package/skills/dknowc-ppt-assistant/references/svg-authoring.md +1 -1
- package/skills/dknowc-ppt-assistant/scripts/initialize.py +7 -17
- package/skills/dknowc-ppt-assistant/scripts/register_key.mjs +99 -60
- package/skills/dknowc-ppt-assistant/scripts/render_trace_html.py +1458 -653
- package/skills/dknowc-ppt-assistant/workflows/generate-pptx.md +2 -2
- package/skills/dknowc-trusted-consulting/README.md +1 -1
- package/skills/dknowc-trusted-consulting/SKILL.md +9 -4
- package/skills/dknowc-trusted-consulting/reference/sample_trace_report.html +672 -307
- package/skills/dknowc-trusted-consulting/scripts/initialize.py +24 -34
- package/skills/dknowc-trusted-consulting/scripts/register_key.mjs +5 -3
- package/skills/dknowc-trusted-consulting/scripts/render_trace_html.py +1647 -729
- package/skills/dknowc-trusted-search/README.md +2 -1
- package/skills/dknowc-trusted-search/SKILL.md +3 -2
- package/skills/dknowc-trusted-search/reference/sample_trace_report.html +1110 -251
- package/skills/dknowc-trusted-search/scripts/initialize.py +2 -3
- package/skills/dknowc-trusted-search/scripts/register_key.mjs +2 -2
- package/skills/dknowc-trusted-search/scripts/render_trace_html.py +1590 -692
- package/skills/dknowc-trusted-search/scripts/trusted_search.py +6 -3
- package/src/index.js +1 -1
- 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/scripts/check_release.py +0 -79
|
@@ -5,32 +5,37 @@
|
|
|
5
5
|
- outline 提纲版:结构方案确认门前的提纲答案文件(页面规划表 + 口径事项清单)→ 事前核验
|
|
6
6
|
- final 成稿版:交付时的页面级结论文本 → 事后溯源
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
8
|
+
3.7.0 同源架构(对齐公文写作 3.7.0,参考深知晓交互原型,数据口径保持自有与真实):
|
|
9
|
+
- 顶栏:身份章 + 标题 + 工具组(只看正文 / 复制全文 / 打印归档)+ 阅读进度条
|
|
10
|
+
- Hero:大标题 + 真实统计(N 次检索 · M 条材料 · K 处引用)+ 双视图切换
|
|
11
|
+
- 过程回顾条:检索 → 入库 → 逐条比对 → 核验完成(静态回放,数字全部真实计算)
|
|
12
|
+
- 核验报告视图(默认):核验报告单 + 正文文档流(章节标题 + 句后引文胶囊,点击原地展开溯源卡)
|
|
13
|
+
- 材料专库视图(全屏):大搜索 + 热词(真实计算)+ 检索分组 tabs + 材料卡
|
|
14
|
+
- 链接质量保障:生成时检测全部材料链接(HTTP 404/410 + 政府站软 404 标题嗅探),
|
|
15
|
+
失效链接改用存档快照回看(接口 screenShotPath,路径容错补 /A/,纯本地校验不误杀)
|
|
16
|
+
|
|
17
|
+
PPT 特有口径(与公文写作的差异,均为产品决策):
|
|
18
|
+
- 提醒制:数据缺口(缺原文链接/缺摘录)不判不通过、指标恒绿附温和提醒;只有无素材/
|
|
19
|
+
正文无角标/角标未绑定三种真实错误才判不通过
|
|
20
|
+
- 双版 stage:提纲版(事前核验)与成稿版(事后溯源)同脚本同形式,标题与身份章带版本后缀
|
|
21
|
+
- 双形态 JSON:素材数组认顶层 {"检索文章": [...]} 或原始接口 content.data.检索文章
|
|
22
|
+
- 未引用判定双通道:JSON 标记(recalled_materials)∪ 正文角标未引用
|
|
23
|
+
- 去重键含角标:同一文章被赋不同角标时各留一卡;双向硬校验(exit 2)
|
|
24
|
+
|
|
25
|
+
诚实原则:脚本真实计算的结果才打勾;政策现行效力等无法自动判定项归入"建议人工复核"。
|
|
26
|
+
布局为单文件静态 HTML;打印归档模式单栏全展开并附材料附录。
|
|
25
27
|
"""
|
|
26
28
|
|
|
27
29
|
from __future__ import annotations
|
|
28
30
|
|
|
29
31
|
import argparse
|
|
32
|
+
import concurrent.futures
|
|
30
33
|
import html
|
|
31
34
|
import json
|
|
32
35
|
import re
|
|
33
36
|
import sys
|
|
37
|
+
import urllib.error
|
|
38
|
+
import urllib.request
|
|
34
39
|
from datetime import datetime
|
|
35
40
|
from pathlib import Path
|
|
36
41
|
from typing import Any, Dict, List, Optional, Tuple
|
|
@@ -51,6 +56,10 @@ OUTPUT_DIR = WS_ROOT / "official-docs" / "output"
|
|
|
51
56
|
STAGE_LABELS = {"outline": "提纲版", "final": "成稿版"}
|
|
52
57
|
REPORT_NAME = "溯源核验报告"
|
|
53
58
|
|
|
59
|
+
# 快照兜底开关:默认启用。接口 screenShotPath 曾存在路径缺 /A/ 层级的拼接 bug;
|
|
60
|
+
# verify_snapshots 在展示前完成"补 /A/ 修订 + 纯本地格式校验 + 非法弃用"。
|
|
61
|
+
SNAPSHOT_ENABLED = True
|
|
62
|
+
|
|
54
63
|
|
|
55
64
|
def _is_within(path: Path, parent: Path) -> bool:
|
|
56
65
|
try:
|
|
@@ -154,8 +163,8 @@ KIND_CATALOG = {
|
|
|
154
163
|
}
|
|
155
164
|
|
|
156
165
|
|
|
157
|
-
def normalize_kind(raw: str) -> Tuple[str, str
|
|
158
|
-
"""把来源类型文本归一化为(类型键,
|
|
166
|
+
def normalize_kind(raw: str) -> Tuple[str, str]:
|
|
167
|
+
"""把来源类型文本归一化为(类型键, 中文标签);css 类名查 KIND_CATALOG。"""
|
|
159
168
|
text = str(raw or "")
|
|
160
169
|
if "政策" in text or "法规" in text or "依据" in text or "policy" in text.lower():
|
|
161
170
|
key = "policy"
|
|
@@ -167,8 +176,8 @@ def normalize_kind(raw: str) -> Tuple[str, str, str]:
|
|
|
167
176
|
key = "reference"
|
|
168
177
|
else:
|
|
169
178
|
key = "material"
|
|
170
|
-
label,
|
|
171
|
-
return key, label
|
|
179
|
+
label, _css = KIND_CATALOG[key]
|
|
180
|
+
return key, label
|
|
172
181
|
|
|
173
182
|
|
|
174
183
|
def parse_year_month(raw: str) -> Optional[Tuple[int, int]]:
|
|
@@ -186,22 +195,40 @@ def parse_year_month(raw: str) -> Optional[Tuple[int, int]]:
|
|
|
186
195
|
|
|
187
196
|
|
|
188
197
|
# ============================================================
|
|
189
|
-
# 素材提取(数据层:材料级编号优先 +
|
|
198
|
+
# 素材提取(数据层:材料级编号优先 + 位置兜底 + 双形态 JSON)
|
|
190
199
|
# ============================================================
|
|
191
200
|
|
|
201
|
+
def clean_paragraph_noise(text: str) -> str:
|
|
202
|
+
"""清洗接口段落文本中的附件链接噪音。
|
|
203
|
+
|
|
204
|
+
接口段落内容格式为「段落标题 https://attach.dknowc.cn/file/<正文>」——
|
|
205
|
+
URL 前是段落标题(已由标题链单独展示),URL 本身是附件地址(卡片有"查看全文"入口)。
|
|
206
|
+
摘录只保留 URL 之后的正文;无该前缀时兜底剔除文本中的裸 URL。
|
|
207
|
+
"""
|
|
208
|
+
value = str(text or "")
|
|
209
|
+
m = re.search(r"https?://\S*attach\.dknowc\.cn/file/", value)
|
|
210
|
+
if m:
|
|
211
|
+
return value[m.end():].strip()
|
|
212
|
+
value = re.sub(r"https?://\S+", " ", value)
|
|
213
|
+
return re.sub(r"[ \t]{2,}", " ", value).strip()
|
|
214
|
+
|
|
215
|
+
|
|
192
216
|
def paragraph_text(item: Dict[str, Any]) -> str:
|
|
193
217
|
paragraphs = item.get("content") or item.get("段落") or item.get("paragraphs") or item.get("paragraphList")
|
|
194
218
|
if isinstance(paragraphs, list):
|
|
195
219
|
chunks = []
|
|
196
220
|
for para in paragraphs:
|
|
197
221
|
if isinstance(para, dict):
|
|
198
|
-
|
|
222
|
+
chunk = first_str(para.get("text"), para.get("内容"), para.get("content"), para.get("summary"), para.get("标题"), para.get("title"))
|
|
199
223
|
else:
|
|
200
|
-
|
|
201
|
-
|
|
224
|
+
chunk = str(para)
|
|
225
|
+
chunk = clean_paragraph_noise(chunk)
|
|
226
|
+
if chunk:
|
|
227
|
+
chunks.append(chunk)
|
|
228
|
+
text = "\n".join(chunks)
|
|
202
229
|
if text:
|
|
203
230
|
return text
|
|
204
|
-
return first_str(
|
|
231
|
+
return clean_paragraph_noise(first_str(
|
|
205
232
|
item.get("摘录"),
|
|
206
233
|
item.get("摘要"),
|
|
207
234
|
item.get("相关段落"),
|
|
@@ -211,7 +238,7 @@ def paragraph_text(item: Dict[str, Any]) -> str:
|
|
|
211
238
|
item.get("content"),
|
|
212
239
|
item.get("text"),
|
|
213
240
|
item.get("snippet"),
|
|
214
|
-
)
|
|
241
|
+
))
|
|
215
242
|
|
|
216
243
|
|
|
217
244
|
def content_segments(item: Dict[str, Any]) -> List[Dict[str, str]]:
|
|
@@ -236,8 +263,8 @@ def content_segments(item: Dict[str, Any]) -> List[Dict[str, str]]:
|
|
|
236
263
|
def source_from_article(item: Dict[str, Any], index: int, segment: Optional[Dict[str, str]] = None) -> Dict[str, str]:
|
|
237
264
|
vo = item.get("vo") if isinstance(item.get("vo"), dict) else {}
|
|
238
265
|
segment = segment or {}
|
|
239
|
-
# 材料级编号(角标/编号/materialIndex
|
|
240
|
-
#
|
|
266
|
+
# 材料级编号(角标/编号/materialIndex 等)优先;段落 id 是文章内段落序号(各篇独立
|
|
267
|
+
# 从 1 起,多篇同为 "1" 会互相冲突导致角标错乱),彻底不用作材料编号。
|
|
241
268
|
explicit_id = first_str(
|
|
242
269
|
item.get("角标"),
|
|
243
270
|
item.get("编号"),
|
|
@@ -280,39 +307,49 @@ def source_from_article(item: Dict[str, Any], index: int, segment: Optional[Dict
|
|
|
280
307
|
"date": first_str(item.get("发布日期"), item.get("date"), item.get("发布时间"), item.get("createDate"), vo.get("dateTime"), vo.get("createDate")),
|
|
281
308
|
"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")),
|
|
282
309
|
"policy_url": first_str(item.get("policyUrl"), item.get("policy_url"), item.get("知识专库原文"), vo.get("policyUrl")),
|
|
283
|
-
"excerpt":
|
|
310
|
+
"excerpt": segment.get("text") or paragraph_text(item),
|
|
284
311
|
"section": first_str(item.get("正文对应"), item.get("section"), item.get("支撑")),
|
|
285
312
|
"kind": first_str(item.get("类型"), item.get("type"), item.get("素材类型"), vo.get("typeName"), "材料"),
|
|
286
313
|
"verify_note": first_str(item.get("核验"), item.get("verification"), item.get("核验说明")),
|
|
287
314
|
"area": first_str(item.get("intentionArea"), item.get("area"), item.get("地域")),
|
|
288
315
|
}
|
|
289
|
-
#
|
|
290
|
-
#
|
|
291
|
-
|
|
316
|
+
# 段落级数据(多段分块展示用):每段 {chain:[文章,章节,子节...], text}
|
|
317
|
+
# 段落标题自带 > 层级,拆级成面包屑;段落标题与文章标题相同或缺失时链只含文章一级。
|
|
318
|
+
segments = []
|
|
292
319
|
for seg in content_segments(item):
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
source["
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
320
|
+
seg_title = first_str(seg.get("title"))
|
|
321
|
+
levels = [lvl.strip() for lvl in re.split(r"\s*>\s*", seg_title) if lvl.strip()] if seg_title else []
|
|
322
|
+
if levels and levels[0] == source["title"]:
|
|
323
|
+
levels = levels[1:]
|
|
324
|
+
seg_text = clean_paragraph_noise(seg.get("text"))
|
|
325
|
+
chain_lvls = [source["title"]] + levels
|
|
326
|
+
segments.append({"chain": chain_lvls, "text": strip_leading_chain(seg_text, chain_lvls)})
|
|
327
|
+
source["segments"] = segments
|
|
328
|
+
# 首段章节位置(兼容旧单行引用处)
|
|
329
|
+
first_chain = segments[0]["chain"][1:] if segments else []
|
|
330
|
+
source["doc_section"] = " › ".join(first_chain)
|
|
331
|
+
source["chain_full"] = " › ".join(segments[0]["chain"]) if segments else ""
|
|
332
|
+
# 发文字号(接口字段或合并 JSON 的 文号/doc_number;无文号按数据源名显示)
|
|
333
|
+
source["doc_number"] = first_str(item.get("文号"), item.get("发文字号"), item.get("doc_number"))
|
|
334
|
+
# 所属搜索条件(多路检索分组)与引用状态(未引用=接口召回但正文未采用)
|
|
304
335
|
source["search_key"] = first_str(item.get("搜索条件"), item.get("search_key"))
|
|
305
336
|
source["used"] = item.get("已引用", item.get("used", True))
|
|
306
337
|
if not isinstance(source["used"], bool):
|
|
307
338
|
source["used"] = True
|
|
308
|
-
#
|
|
339
|
+
# 快照兜底:原文链接 404/410(生成时真实检测)或接口未返回源网址时,
|
|
340
|
+
# 改用接口提供的存档快照链接回看——快照是原文的存档副本,按钮文案如实区分。
|
|
341
|
+
source["snapshot"] = first_str(item.get("快照链接"), item.get("snapshot"), item.get("screenShotPath"))
|
|
342
|
+
source["link_dead"] = item.get("链接失效") is True or item.get("link_dead") is True
|
|
343
|
+
# 发布日期可信度(实测:「高」=模型治理入库、标题模型精抽;「较高」=门户抓取、标题规则提取)
|
|
309
344
|
source["conf"] = first_str(item.get("发布日期可信度"), item.get("可信度"), item.get("confidence"))
|
|
310
|
-
key, label
|
|
345
|
+
key, label = normalize_kind(source["kind"])
|
|
311
346
|
source["type_key"] = key
|
|
312
347
|
source["type_label"] = label
|
|
313
|
-
source["type_css"] =
|
|
314
|
-
|
|
315
|
-
|
|
348
|
+
source["type_css"] = KIND_CATALOG[key][1]
|
|
349
|
+
live_url = bool(source["url"] and source["url"] != "接口未返回") and not source["link_dead"]
|
|
350
|
+
source["has_link"] = live_url or bool(source["policy_url"]) or bool(source["snapshot"])
|
|
351
|
+
# 核验状态只看摘录可比对;原文链接死活与快照有无是回看通道问题,不影响核验结论
|
|
352
|
+
# (PPT 提醒制:数据缺口不判不通过,卡片与指标行温和提醒)
|
|
316
353
|
source["verified"] = bool(source["excerpt"])
|
|
317
354
|
return source
|
|
318
355
|
|
|
@@ -359,15 +396,16 @@ def extract_reference_materials(payload: Dict[str, Any]) -> List[Dict[str, Any]]
|
|
|
359
396
|
return []
|
|
360
397
|
|
|
361
398
|
|
|
362
|
-
def
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
399
|
+
def collect_raw_articles(payload: Dict[str, Any]) -> List[Dict[str, Any]]:
|
|
400
|
+
"""链接检测/快照校验的作用对象:全部原始材料 dict(含未引用召回),就地修改生效。"""
|
|
401
|
+
raws: List[Dict[str, Any]] = []
|
|
402
|
+
raws.extend(extract_reference_materials(payload))
|
|
403
|
+
raws.extend(extract_articles_from_search(payload))
|
|
404
|
+
raws.extend(extract_articles_from_deep(payload))
|
|
405
|
+
recalled = payload.get("recalled_materials") or payload.get("召回材料")
|
|
406
|
+
if isinstance(recalled, list):
|
|
407
|
+
raws.extend(x for x in recalled if isinstance(x, dict))
|
|
408
|
+
return raws
|
|
371
409
|
|
|
372
410
|
|
|
373
411
|
def extract_sources(payload: Dict[str, Any]) -> List[Dict[str, str]]:
|
|
@@ -376,7 +414,7 @@ def extract_sources(payload: Dict[str, Any]) -> List[Dict[str, str]]:
|
|
|
376
414
|
raw_sources.extend(extract_articles_from_search(payload))
|
|
377
415
|
raw_sources.extend(extract_articles_from_deep(payload))
|
|
378
416
|
# 未引用召回材料(接口召回但正文未采用,agent 筛选后全量放入 recalled_materials):
|
|
379
|
-
#
|
|
417
|
+
# 进面板「未引用」分组,不占正文角标编号,不参与核验统计。
|
|
380
418
|
recalled = payload.get("recalled_materials") or payload.get("召回材料")
|
|
381
419
|
if isinstance(recalled, list):
|
|
382
420
|
raw_sources.extend({**{"已引用": False}, **x} for x in recalled if isinstance(x, dict))
|
|
@@ -427,7 +465,7 @@ def extract_answer(payload: Dict[str, Any]) -> str:
|
|
|
427
465
|
vo = item.get("vo") if isinstance(item.get("vo"), dict) else {}
|
|
428
466
|
rows.append(f"[{idx}] {first_str(vo.get('showTitle'), vo.get('title'), item.get('title'), '未命名材料')}")
|
|
429
467
|
return "\n".join(rows)
|
|
430
|
-
return "
|
|
468
|
+
return "接口返回中未识别到正文内容;请查看材料专库或原始 JSON。"
|
|
431
469
|
|
|
432
470
|
|
|
433
471
|
def extract_question(payload: Dict[str, Any]) -> str:
|
|
@@ -518,12 +556,15 @@ def compute_verification(answer: str, sources: List[Dict[str, str]], payload: Di
|
|
|
518
556
|
"""核验报告单数据。只计算脚本真实可得的结果,不虚构通过。"""
|
|
519
557
|
generated_at = generated_at or datetime.now()
|
|
520
558
|
|
|
521
|
-
# ① 依据溯源:摘录可比对 +
|
|
522
|
-
#
|
|
523
|
-
#
|
|
559
|
+
# ① 依据溯源:摘录可比对 + 原文链接可回看。
|
|
560
|
+
# 只统计被正文引用的材料——未引用召回材料未进入正文核验流程,其缺链在自身卡片上如实标注,
|
|
561
|
+
# 不应拖累"正文依据可交付"的报告级结论。
|
|
562
|
+
# PPT 提醒制:缺原文链接(接口对部分治理库文章不返回源网址,属数据源覆盖问题)与
|
|
563
|
+
# 缺摘录均降级为提醒,不参与核验判定——报告级只拦真实错误。
|
|
524
564
|
cited_sources = [s for s in sources if s.get("used", True)]
|
|
525
565
|
missing_links = [s["title"] for s in cited_sources if not s.get("has_link")]
|
|
526
566
|
missing_excerpts = [s["title"] for s in cited_sources if not (s.get("excerpt") or "").strip()]
|
|
567
|
+
trace_passed = len(cited_sources) - len(missing_excerpts)
|
|
527
568
|
|
|
528
569
|
# ② 引用绑定:正文角标与来源卡一一对应(按角标出现次数计,与用户在正文中数到的一致)
|
|
529
570
|
cited = citation_ids(answer)
|
|
@@ -550,7 +591,7 @@ def compute_verification(answer: str, sources: List[Dict[str, str]], payload: Di
|
|
|
550
591
|
for s in sources:
|
|
551
592
|
coverage[s.get("type_key", "material")] = coverage.get(s.get("type_key", "material"), 0) + 1
|
|
552
593
|
|
|
553
|
-
# ⑤
|
|
594
|
+
# ⑤ 交付前检查:由检索/溯源 JSON 的 self_check 传入,未传入如实显示未记录
|
|
554
595
|
self_check_raw = None
|
|
555
596
|
for holder in (payload, payload.get("content") if isinstance(payload.get("content"), dict) else {}):
|
|
556
597
|
self_check_raw = self_check_raw or holder.get("selfCheck") or holder.get("self_check")
|
|
@@ -566,8 +607,8 @@ def compute_verification(answer: str, sources: List[Dict[str, str]], payload: Di
|
|
|
566
607
|
# 政策效力:无法自动判定现行效力,列出建议人工复核
|
|
567
608
|
policy_count = coverage.get("policy", 0)
|
|
568
609
|
|
|
569
|
-
#
|
|
570
|
-
#
|
|
610
|
+
# 核验判定(PPT 提醒制):只有真实错误才判不通过(无素材 / 正文无角标 / 角标未绑定);
|
|
611
|
+
# 数据缺口(缺链/缺摘录)只提醒不影响判定。
|
|
571
612
|
trace_ok = bool(cited_sources)
|
|
572
613
|
binding_ok = (not unbound) and not no_citation
|
|
573
614
|
overall_passed = trace_ok and binding_ok
|
|
@@ -588,7 +629,7 @@ def compute_verification(answer: str, sources: List[Dict[str, str]], payload: Di
|
|
|
588
629
|
"label": "核验完成,正文依据逐条对过原文" if overall_passed else "核验未完全通过",
|
|
589
630
|
"reasons": reasons,
|
|
590
631
|
},
|
|
591
|
-
"traceability": {"total": len(cited_sources), "passed":
|
|
632
|
+
"traceability": {"total": len(cited_sources), "passed": trace_passed,
|
|
592
633
|
"missing_links": missing_links, "missing_excerpts": missing_excerpts},
|
|
593
634
|
"binding": {"total": len(all_marks), "bound": len(all_marks) - len(unbound), "unbound": unbound_ids, "no_citation": no_citation},
|
|
594
635
|
"freshness": freshness,
|
|
@@ -599,6 +640,100 @@ def compute_verification(answer: str, sources: List[Dict[str, str]], payload: Di
|
|
|
599
640
|
}
|
|
600
641
|
|
|
601
642
|
|
|
643
|
+
# ============================================================
|
|
644
|
+
# 过程回顾 / 热词(真实计算,不虚构流程)
|
|
645
|
+
# ============================================================
|
|
646
|
+
|
|
647
|
+
def compute_process_stats(sources: List[Dict[str, str]], answer: str) -> Dict[str, Any]:
|
|
648
|
+
"""过程回顾条数据:检索次数、每组检索的召回/采用数、入库与引用计数。
|
|
649
|
+
|
|
650
|
+
全部来自素材自带的真实字段(search_key 分组、used 引用状态、正文角标计数),
|
|
651
|
+
不虚构任何流程步骤。
|
|
652
|
+
"""
|
|
653
|
+
order: List[str] = []
|
|
654
|
+
for s in sources:
|
|
655
|
+
key = (s.get("search_key") or "").strip()
|
|
656
|
+
if key and key not in order:
|
|
657
|
+
order.append(key)
|
|
658
|
+
cond_rows = []
|
|
659
|
+
for key in order:
|
|
660
|
+
group = [s for s in sources if (s.get("search_key") or "").strip() == key]
|
|
661
|
+
cond_rows.append({
|
|
662
|
+
"key": key,
|
|
663
|
+
"total": len(group),
|
|
664
|
+
"used": sum(1 for s in group if s.get("used", True)),
|
|
665
|
+
})
|
|
666
|
+
n_searches = len(cond_rows) or (1 if sources else 0)
|
|
667
|
+
used_count = sum(1 for s in sources if s.get("used", True))
|
|
668
|
+
unused_count = len(sources) - used_count
|
|
669
|
+
n_cite_marks = len(re.findall(r"\[(\d+)\]", answer))
|
|
670
|
+
return {
|
|
671
|
+
"conds": cond_rows,
|
|
672
|
+
"n_searches": n_searches,
|
|
673
|
+
"has_cond_detail": bool(cond_rows),
|
|
674
|
+
"n_materials": len(sources),
|
|
675
|
+
"used_count": used_count,
|
|
676
|
+
"unused_count": unused_count,
|
|
677
|
+
"n_cite_marks": n_cite_marks,
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
|
|
681
|
+
HOT_STOP = {
|
|
682
|
+
"关于", "通知", "工作", "意见", "方案", "实施", "有关", "问题", "情况", "报告", "总结",
|
|
683
|
+
"制度", "体系", "机制", "指导", "贯彻", "落实", "进一步", "以及", "其他", "相关", "以下",
|
|
684
|
+
"以上", "共和国", "人民", "中华", "国务院", "人民政府", "办公厅", "印发", "试行",
|
|
685
|
+
"办法", "条例", "若干", "的重点", "有所", "一个", "方面", "方式", "内容", "基本",
|
|
686
|
+
"发展", "建设", "政策", "产业", "企业", "应用", "改革", "目标", "任务", "规划",
|
|
687
|
+
"领域", "措施", "支持", "行动", "服务", "管理", "政府",
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
|
|
691
|
+
def extract_hot_terms(answer: str, sources: List[Dict[str, str]], top: int = 8) -> List[str]:
|
|
692
|
+
"""材料专库热词:材料标题(加权)+ 检索条件 + 正文的高频 2-4 字词,真实统计。
|
|
693
|
+
|
|
694
|
+
泛词过滤:出现在超过 60% 材料标题中的词(如库内全部材料共有的主题词)
|
|
695
|
+
无法筛出子集,没有筛选价值,剔除。
|
|
696
|
+
"""
|
|
697
|
+
corpus_parts: List[str] = []
|
|
698
|
+
for s in sources:
|
|
699
|
+
if s.get("title"):
|
|
700
|
+
corpus_parts.extend([s["title"]] * 3)
|
|
701
|
+
if s.get("search_key"):
|
|
702
|
+
corpus_parts.extend([s["search_key"]] * 2)
|
|
703
|
+
clean_answer = re.sub(r"\[\d+\]", "", answer or "")
|
|
704
|
+
corpus_parts.append(clean_answer)
|
|
705
|
+
corpus = "\n".join(corpus_parts)
|
|
706
|
+
|
|
707
|
+
counts: Dict[str, int] = {}
|
|
708
|
+
for run in re.findall(r"[一-鿿]{2,}", corpus):
|
|
709
|
+
for n in (2, 3, 4):
|
|
710
|
+
for i in range(len(run) - n + 1):
|
|
711
|
+
gram = run[i:i + n]
|
|
712
|
+
counts[gram] = counts.get(gram, 0) + 1
|
|
713
|
+
|
|
714
|
+
titles = [s.get("title") or "" for s in sources]
|
|
715
|
+
n_titles = max(1, len(titles))
|
|
716
|
+
df_limit = max(1, int(n_titles * 0.6))
|
|
717
|
+
|
|
718
|
+
cands = [(g, c) for g, c in counts.items()
|
|
719
|
+
if c >= 2 and g not in HOT_STOP and "的" not in g and not any(ch.isdigit() for ch in g)
|
|
720
|
+
and sum(1 for t in titles if g in t) <= df_limit]
|
|
721
|
+
cands.sort(key=lambda x: (-x[1], -len(x[0])))
|
|
722
|
+
kept: List[Tuple[str, int]] = []
|
|
723
|
+
for gram, count in cands:
|
|
724
|
+
redundant = False
|
|
725
|
+
for kgram, kcount in kept:
|
|
726
|
+
# 短词是已入选高频长词的子串且计数接近 → 被长词覆盖,剔除
|
|
727
|
+
if gram in kgram and kcount >= count * 0.6:
|
|
728
|
+
redundant = True
|
|
729
|
+
break
|
|
730
|
+
if not redundant:
|
|
731
|
+
kept.append((gram, count))
|
|
732
|
+
if len(kept) >= top:
|
|
733
|
+
break
|
|
734
|
+
return [g for g, _ in kept]
|
|
735
|
+
|
|
736
|
+
|
|
602
737
|
# ============================================================
|
|
603
738
|
# 正文解析与分节
|
|
604
739
|
# ============================================================
|
|
@@ -609,6 +744,7 @@ def render_inline_markdown(text: str, citation_repl) -> str:
|
|
|
609
744
|
body = re.sub(r"\*\*(.+?)\*\*", r"<strong>\1</strong>", body)
|
|
610
745
|
body = re.sub(r"__(.+?)__", r"<strong>\1</strong>", body)
|
|
611
746
|
body = re.sub(r"(?<!\*)\*([^*\n]+)\*(?!\*)", r"<em>\1</em>", body)
|
|
747
|
+
body = re.sub(r"(?<!_)_([^_\n]+_)(?!_)", r"<em>\1</em>", body)
|
|
612
748
|
body = re.sub(r"\[(\d+)\]", citation_repl, body)
|
|
613
749
|
return body
|
|
614
750
|
|
|
@@ -627,7 +763,7 @@ def split_markdown_table_row(line: str) -> List[str]:
|
|
|
627
763
|
return [cell.strip() for cell in line.strip().strip("|").split("|")]
|
|
628
764
|
|
|
629
765
|
|
|
630
|
-
def render_markdown_table(lines: List[str], citation_repl
|
|
766
|
+
def render_markdown_table(lines: List[str], citation_repl) -> str:
|
|
631
767
|
header = split_markdown_table_row(lines[0])
|
|
632
768
|
body_lines = lines[2:] if len(lines) > 1 and is_markdown_table_separator(lines[1]) else lines[1:]
|
|
633
769
|
head_html = "".join(f"<th>{render_inline_markdown(cell, citation_repl)}</th>" for cell in header)
|
|
@@ -636,26 +772,15 @@ def render_markdown_table(lines: List[str], citation_repl, sources: Optional[Lis
|
|
|
636
772
|
cells = split_markdown_table_row(line)
|
|
637
773
|
if len(cells) < len(header): # 行内缺格时补空,保持列对齐
|
|
638
774
|
cells = cells + [""] * (len(header) - len(cells))
|
|
639
|
-
|
|
640
|
-
for cell in cells:
|
|
641
|
-
inner = render_inline_markdown(cell, citation_repl)
|
|
642
|
-
# 证据灰框就地放在含角标的单元格内(文字下方折行),不在表外另挂一排
|
|
643
|
-
if sources:
|
|
644
|
-
cell_cites = citation_ids(cell)
|
|
645
|
-
if cell_cites:
|
|
646
|
-
inner += render_evidence_chips(cell_cites, sources)
|
|
647
|
-
tds.append(f"<td>{inner}</td>")
|
|
648
|
-
rows.append("<tr>" + "".join(tds) + "</tr>")
|
|
775
|
+
rows.append("<tr>" + "".join(f"<td>{render_inline_markdown(cell, citation_repl)}</td>" for cell in cells) + "</tr>")
|
|
649
776
|
wide_cls = " wide" if len(header) >= 4 else ""
|
|
650
777
|
return f'<div class="tbl-wrap"><table class="data-tbl{wide_cls}"><thead><tr>{head_html}</tr></thead><tbody>{"".join(rows)}</tbody></table></div>'
|
|
651
778
|
|
|
652
779
|
|
|
653
|
-
def
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
cleaned = re.sub(r"(?is)<script.*?</script>", "", value)
|
|
658
|
-
cleaned = re.sub(r"(?is)<style.*?</style>", "", value)
|
|
780
|
+
def sanitize_table_html(text: str) -> str:
|
|
781
|
+
"""清洗接口表格 HTML:仅保留 table/thead/tbody/tr/td/th/br,去脚本样式与属性。"""
|
|
782
|
+
cleaned = re.sub(r"(?is)<script.*?</script>", "", text)
|
|
783
|
+
cleaned = re.sub(r"(?is)<style.*?</style>", "", cleaned)
|
|
659
784
|
cleaned = re.sub(r"\s+on\w+\s*=\s*(['\"]).*?\1", "", cleaned)
|
|
660
785
|
cleaned = re.sub(r"\s+(href|src)\s*=\s*(['\"]).*?\2", "", cleaned)
|
|
661
786
|
allowed = {"table", "thead", "tbody", "tr", "td", "th", "br"}
|
|
@@ -666,17 +791,89 @@ def render_excerpt_html(text: str) -> str:
|
|
|
666
791
|
return ""
|
|
667
792
|
return f"<{closing}{name}>"
|
|
668
793
|
|
|
669
|
-
|
|
670
|
-
|
|
794
|
+
return re.sub(r"<\s*(/?)\s*([a-zA-Z0-9]+)(?:\s+[^>]*)?>", tag_repl, cleaned)
|
|
795
|
+
|
|
796
|
+
|
|
797
|
+
def render_excerpt_html(text: str) -> str:
|
|
798
|
+
value = str(text or "")
|
|
799
|
+
if "<table" not in value.lower():
|
|
800
|
+
return f'<div class="sc-excerpt plain">{esc(value)}</div>'
|
|
801
|
+
return f'<div class="sc-excerpt rich">{sanitize_table_html(value)}</div>'
|
|
802
|
+
|
|
803
|
+
|
|
804
|
+
def parse_answer_blocks(answer: str, valid_ids: set, chip_map: Optional[Dict[str, Any]] = None) -> Tuple[List[Dict[str, Any]], set]:
|
|
805
|
+
"""把正文 Markdown 解析为结构化块;同时收集全部角标。
|
|
671
806
|
|
|
807
|
+
角标渲染为原型式 jb 胶囊(编号圆徽章 + 材料标题),点击原地展开溯源卡;
|
|
808
|
+
表格单元格内的角标同样就地变胶囊(证据在含角标的单元格内,不挂表外)。
|
|
809
|
+
"""
|
|
810
|
+
|
|
811
|
+
def jb_html(cid: str) -> str:
|
|
812
|
+
jb = chip_map.get(cid)
|
|
813
|
+
if not jb:
|
|
814
|
+
return ""
|
|
815
|
+
if jb.get("url"):
|
|
816
|
+
btn_txt = "查看存档全文" if jb.get("dead") else "查看全文"
|
|
817
|
+
link = (f'<a class="jb-src" href="{esc(jb["url"])}" target="_blank" rel="noopener noreferrer">'
|
|
818
|
+
f'{ARROW_SVG}<span>{btn_txt}</span></a>')
|
|
819
|
+
else:
|
|
820
|
+
link = ""
|
|
821
|
+
# 原文直达区展示标题链(多段分块,各段带链——快速人工核验的核心抓手)
|
|
822
|
+
segs = jb.get("segments") or []
|
|
823
|
+
if segs:
|
|
824
|
+
quote = ""
|
|
825
|
+
seg_idx = -1
|
|
826
|
+
for seg in segs:
|
|
827
|
+
text = (seg.get("text") or "").strip()
|
|
828
|
+
if not text:
|
|
829
|
+
continue
|
|
830
|
+
seg_idx += 1
|
|
831
|
+
if "<table" in text.lower():
|
|
832
|
+
# 表格不能静态写进 span(解析器会拆散):此处留占位,
|
|
833
|
+
# 表格数据由 render_html 汇总注入页尾 JSON,展开时 JS 填充
|
|
834
|
+
tbl_key = f"{cid}-{seg_idx}"
|
|
835
|
+
jb.setdefault("_tables", {})[tbl_key] = sanitize_table_html(text)
|
|
836
|
+
body_txt = f'<span class="sc-excerpt rich tbl-holder" data-tbl="{esc(tbl_key)}"></span>'
|
|
837
|
+
else:
|
|
838
|
+
body_txt = f'<span class="sc-excerpt">{esc(text)}</span>'
|
|
839
|
+
inner = f'<i class="jb-no">{esc(cid)}</i>{body_txt}'
|
|
840
|
+
item = f'<span class="jb-quote" role="button" tabindex="0">{inner}</span>'
|
|
841
|
+
quote += render_crumb(seg.get("chain") or []) + item
|
|
842
|
+
elif jb["excerpt"]:
|
|
843
|
+
inner = f'<i class="jb-no">{esc(cid)}</i><span>{esc(jb["excerpt"])}</span>'
|
|
844
|
+
quote = f'<span class="jb-quote" role="button" tabindex="0">{inner}</span>'
|
|
845
|
+
else:
|
|
846
|
+
quote = ""
|
|
847
|
+
site_html = (f'<span class="jb-site"><span class="dot"></span>{esc(jb.get("site") or "")}</span>'
|
|
848
|
+
if (jb.get("site") or "").strip() else "")
|
|
849
|
+
return (
|
|
850
|
+
f'<span class="jb" data-cite="{esc(cid)}">'
|
|
851
|
+
f'<button class="jb-name" type="button" aria-expanded="false">{CARET_SVG}'
|
|
852
|
+
f'<i class="jb-id">{esc(cid)}</i>'
|
|
853
|
+
f'<span class="jb-txt">{esc(jb["title"])}</span></button>'
|
|
854
|
+
f'<span class="jb-body"><span class="jb-head"><span class="jb-label">{SRC_ICO_SVG}溯源原文:</span>{link}</span>'
|
|
855
|
+
f'{site_html}'
|
|
856
|
+
f'{quote}</span></span>'
|
|
857
|
+
)
|
|
672
858
|
|
|
673
|
-
def
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
859
|
+
def make_block_repl(block_text: str):
|
|
860
|
+
"""按块构造角标替换器:同块同材料只保留最后一次出现的角标(前处整体删除),
|
|
861
|
+
最后一处挂 jb 胶囊——一块中同一材料只出现一次,杜绝重复引用刷屏。"""
|
|
862
|
+
remaining: Dict[str, int] = {}
|
|
863
|
+
for cid in re.findall(r"\[(\d+)\]", block_text):
|
|
864
|
+
remaining[cid] = remaining.get(cid, 0) + 1
|
|
865
|
+
|
|
866
|
+
def repl(match: re.Match[str]) -> str:
|
|
867
|
+
cid = match.group(1)
|
|
868
|
+
remaining[cid] = max(0, remaining.get(cid, 1) - 1)
|
|
869
|
+
if remaining[cid] > 0:
|
|
870
|
+
return ""
|
|
871
|
+
if cid in chip_map:
|
|
872
|
+
return jb_html(cid)
|
|
873
|
+
# 未绑定角标(无对应材料):红色数字警示,绝不按位置猜测
|
|
874
|
+
return f'<sup class="cite unresolved" data-cite="{esc(cid)}" title="核验依据 [{esc(cid)}?]">{esc(cid)}?</sup>'
|
|
875
|
+
|
|
876
|
+
return repl
|
|
680
877
|
|
|
681
878
|
blocks: List[Dict[str, Any]] = []
|
|
682
879
|
lines = answer.split("\n")
|
|
@@ -686,11 +883,15 @@ def parse_answer_blocks(answer: str, valid_ids: set, sources: Optional[List[Dict
|
|
|
686
883
|
if not block:
|
|
687
884
|
idx += 1
|
|
688
885
|
continue
|
|
886
|
+
# 引文胶囊位置规范:角标与后随标点换位——标点紧跟文字,胶囊放标点之后
|
|
887
|
+
# (避免胶囊把句号挤到下一行孤悬,对齐深知晓原型"…内容。~出处"形态)
|
|
888
|
+
block = re.sub(r"\[(\d+)\]([。;,、!?:;,.])", r"\2[\1]", block)
|
|
689
889
|
ids = citation_ids(block)
|
|
890
|
+
repl = make_block_repl(block)
|
|
690
891
|
heading_match = re.match(r"^(#{1,4})\s+(.+)$", block)
|
|
691
892
|
if heading_match:
|
|
692
893
|
blocks.append({"kind": "heading", "level": len(heading_match.group(1)),
|
|
693
|
-
"text": heading_match.group(2).strip(), "cites": ids})
|
|
894
|
+
"text": heading_match.group(2).strip(), "cites": ids, "repl": repl})
|
|
694
895
|
idx += 1
|
|
695
896
|
elif "|" in block and idx + 1 < len(lines) and is_markdown_table_separator(lines[idx + 1]):
|
|
696
897
|
table_lines = [block, lines[idx + 1].strip()]
|
|
@@ -698,7 +899,8 @@ def parse_answer_blocks(answer: str, valid_ids: set, sources: Optional[List[Dict
|
|
|
698
899
|
while idx < len(lines) and "|" in lines[idx].strip() and lines[idx].strip():
|
|
699
900
|
table_lines.append(lines[idx].strip())
|
|
700
901
|
idx += 1
|
|
701
|
-
|
|
902
|
+
repl = make_block_repl("\n".join(table_lines))
|
|
903
|
+
blocks.append({"kind": "table", "html": render_markdown_table(table_lines, repl), "cites": citation_ids("\n".join(table_lines))})
|
|
702
904
|
elif block in {"---", "***"}:
|
|
703
905
|
blocks.append({"kind": "hr", "html": '<hr class="doc-divider">', "cites": []})
|
|
704
906
|
idx += 1
|
|
@@ -725,10 +927,10 @@ def split_heading_number(text: str) -> Tuple[Optional[str], str]:
|
|
|
725
927
|
|
|
726
928
|
|
|
727
929
|
def group_sections(blocks: List[Dict[str, Any]]) -> Tuple[Optional[str], List[Dict[str, Any]]]:
|
|
728
|
-
"""
|
|
930
|
+
"""按标题层级切分章节。返回(报告标题, 章节列表)。
|
|
729
931
|
|
|
730
|
-
|
|
731
|
-
|
|
932
|
+
规则:最浅层级标题若唯一且居文首,视为报告标题提出;其下一级为章节边界。
|
|
933
|
+
无标题的短正文整篇一节。
|
|
732
934
|
"""
|
|
733
935
|
if not blocks:
|
|
734
936
|
return None, [{"title": None, "blocks": []}]
|
|
@@ -766,38 +968,43 @@ def group_sections(blocks: List[Dict[str, Any]]) -> Tuple[Optional[str], List[Di
|
|
|
766
968
|
# 各部分渲染
|
|
767
969
|
# ============================================================
|
|
768
970
|
|
|
769
|
-
def
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
971
|
+
def build_chip_data(sources: List[Dict[str, str]]) -> Dict[str, Dict[str, Any]]:
|
|
972
|
+
"""行内引文胶囊数据:id → {title, site, url, excerpt, segments}。
|
|
973
|
+
|
|
974
|
+
角标后渲染原型式 jb(行内小胶囊,点击展开块级卡)。摘录展示完整
|
|
975
|
+
原文原段、不截断——块内去重后重复量可控,核对场景下就地读全文。
|
|
976
|
+
"""
|
|
977
|
+
chip_map: Dict[str, Dict[str, Any]] = {}
|
|
978
|
+
for source in sources:
|
|
979
|
+
cid = source["id"]
|
|
980
|
+
if cid in chip_map:
|
|
775
981
|
continue
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
)
|
|
792
|
-
if not chips:
|
|
793
|
-
return ""
|
|
794
|
-
return f'<div class="ev-row">{"".join(chips)}</div>'
|
|
982
|
+
meta_bits = [v for v in [source.get("agency"), source.get("date")] if v and v != "未知来源"]
|
|
983
|
+
url = source.get("url") if (source.get("url") and source["url"] != "接口未返回") else (source.get("policy_url") or "")
|
|
984
|
+
if source.get("link_dead"):
|
|
985
|
+
url = source.get("snapshot") or ""
|
|
986
|
+
site_bits = ([source["doc_number"]] if source.get("doc_number") else []) + meta_bits
|
|
987
|
+
chip_map[cid] = {
|
|
988
|
+
"title": short(source.get("title") or "未命名材料", 30),
|
|
989
|
+
"site": " · ".join(site_bits) or "来源站点",
|
|
990
|
+
"url": url,
|
|
991
|
+
"snapshot": source.get("snapshot") or "",
|
|
992
|
+
"dead": bool(source.get("link_dead")),
|
|
993
|
+
"excerpt": (source.get("excerpt") or "").strip(),
|
|
994
|
+
"segments": source.get("segments") or [],
|
|
995
|
+
}
|
|
996
|
+
return chip_map
|
|
795
997
|
|
|
796
998
|
|
|
797
|
-
def render_source_links(url: str, policy_url: str = "") -> str:
|
|
999
|
+
def render_source_links(url: str, policy_url: str = "", snapshot: str = "", link_dead: bool = False) -> str:
|
|
1000
|
+
"""链接区四态:原文可回看 / 原文失效改快照 / 原文失效无快照 / 无源网址有快照。
|
|
1001
|
+
快照是接口对原文的存档副本,文案如实标注,不冒充原文链接。"""
|
|
798
1002
|
links = []
|
|
799
|
-
if url and url != "接口未返回":
|
|
800
|
-
links.append(f'<a href="{esc(url)}" target="_blank" rel="noopener"
|
|
1003
|
+
if url and url != "接口未返回" and not link_dead:
|
|
1004
|
+
links.append(f'<a href="{esc(url)}" target="_blank" rel="noopener">查看全文 ↗</a>')
|
|
1005
|
+
if snapshot:
|
|
1006
|
+
# 有哪个显示哪个:快照统一展示"查看存档全文",不做原文失效的状态解释
|
|
1007
|
+
links.append(f'<a class="snap" href="{esc(snapshot)}" target="_blank" rel="noopener">查看存档全文 ↗</a>')
|
|
801
1008
|
if policy_url:
|
|
802
1009
|
links.append(f'<a href="{esc(policy_url)}" target="_blank" rel="noopener">知识专库原文 ↗</a>')
|
|
803
1010
|
if not links:
|
|
@@ -806,7 +1013,7 @@ def render_source_links(url: str, policy_url: str = "") -> str:
|
|
|
806
1013
|
|
|
807
1014
|
|
|
808
1015
|
def render_verify_panel(v: Dict[str, Any], stage: str = "final") -> str:
|
|
809
|
-
"""核验报告单:报告级核验结论 + 五项指标(
|
|
1016
|
+
"""核验报告单:报告级核验结论 + 五项指标(PPT 双版 + 提醒制口径)。"""
|
|
810
1017
|
stage_label = STAGE_LABELS.get(stage, "成稿版")
|
|
811
1018
|
manual_checks_html = "".join("<br>· " + esc(x) for x in v.get("manual_checks", []))
|
|
812
1019
|
ov = v["overall"]
|
|
@@ -820,14 +1027,14 @@ def render_verify_panel(v: Dict[str, Any], stage: str = "final") -> str:
|
|
|
820
1027
|
n_missing = len(set(tr["missing_links"]) | set(tr["missing_excerpts"]))
|
|
821
1028
|
if not tr["total"]:
|
|
822
1029
|
tr_html = ('<div class="vi"><span class="s fail">✗ 依据溯源 0/0</span>'
|
|
823
|
-
'<span class="d"
|
|
1030
|
+
'<span class="d">未识别到来源材料</span></div>')
|
|
824
1031
|
elif n_missing:
|
|
825
|
-
#
|
|
1032
|
+
# PPT 提醒制:数据缺口恒绿,附温和提醒(缺口明细在材料卡上如实标注)
|
|
826
1033
|
tr_html = (f'<div class="vi"><span class="s ok">✓ 依据溯源 {tr["total"]}/{tr["total"]}</span>'
|
|
827
|
-
f'<span class="d">素材摘录可比对;{n_missing}
|
|
1034
|
+
f'<span class="d">素材摘录可比对;{n_missing} 条原文链接或摘录待补,卡片已标注,汇报前请注意核对</span></div>')
|
|
828
1035
|
else:
|
|
829
|
-
tr_html = (f'<div class="vi"><span class="s ok">✓ 依据溯源 {tr["
|
|
830
|
-
f'<span class="d"
|
|
1036
|
+
tr_html = (f'<div class="vi"><span class="s ok">✓ 依据溯源 {tr["passed"]}/{tr["total"]}</span>'
|
|
1037
|
+
f'<span class="d">每条素材摘录可比对,原文或存档快照可回看</span></div>')
|
|
831
1038
|
|
|
832
1039
|
bd = v["binding"]
|
|
833
1040
|
if bd.get("no_citation"):
|
|
@@ -894,111 +1101,221 @@ def render_verify_panel(v: Dict[str, Any], stage: str = "final") -> str:
|
|
|
894
1101
|
</div>"""
|
|
895
1102
|
|
|
896
1103
|
|
|
1104
|
+
SRC_ICO_SVG = ('<svg viewBox="0 0 24 24" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.8" '
|
|
1105
|
+
'stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">'
|
|
1106
|
+
'<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"/>'
|
|
1107
|
+
'<path d="M9 13h6M9 17h4"/></svg>')
|
|
1108
|
+
ARROW_SVG = ('<svg viewBox="0 0 24 24" width="11" height="11" fill="none" stroke="currentColor" stroke-width="2.2" '
|
|
1109
|
+
'stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M7 17 17 7M9 7h8v8"/></svg>')
|
|
1110
|
+
CARET_SVG = ('<svg viewBox="0 0 24 24" width="12" height="12" fill="none" stroke="currentColor" stroke-width="2.4" '
|
|
1111
|
+
'stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg>')
|
|
1112
|
+
|
|
1113
|
+
|
|
897
1114
|
def render_section_cards(sections: List[Dict[str, Any]], sources: List[Dict[str, str]]) -> str:
|
|
1115
|
+
"""正文渲染(原型复刻):chapter(h2)+ lead/para 段落文档流 + 句后 jb 引文胶囊。
|
|
1116
|
+
|
|
1117
|
+
同一块内同一材料只保留最后一处角标与胶囊(make_block_repl 去重);
|
|
1118
|
+
提纲页面规划表等 markdown 表格内角标同样就地变胶囊(证据在含角标的单元格内)。
|
|
1119
|
+
"""
|
|
1120
|
+
parts: List[str] = []
|
|
1121
|
+
first_para = True
|
|
898
1122
|
source_ids = {s["id"] for s in sources}
|
|
899
|
-
|
|
900
|
-
|
|
1123
|
+
for sec_idx, sec in enumerate(sections, 1):
|
|
1124
|
+
number, title_text = split_heading_number(sec["title"] or "")
|
|
1125
|
+
chapter_title = f"{number}、{title_text}" if (number and title_text) else (title_text or "")
|
|
901
1126
|
sec_cites: List[str] = []
|
|
902
1127
|
for b in sec["blocks"]:
|
|
903
1128
|
for cid in b.get("cites", []):
|
|
904
1129
|
if cid not in sec_cites:
|
|
905
1130
|
sec_cites.append(cid)
|
|
906
|
-
|
|
907
|
-
number, title_text = split_heading_number(sec["title"] or "")
|
|
908
|
-
no_html = f'<span class="sec-no">{esc(number)}</span>' if number else ""
|
|
909
|
-
title_html = f"<h3>{esc(title_text)}</h3>" if title_text else ""
|
|
910
|
-
if sec_cites:
|
|
911
|
-
badge_state = "bad" if unbound_count else ""
|
|
912
|
-
badge_text = f"本节引用 {len(sec_cites)} 处" + (f" · {unbound_count} 处未绑定" if unbound_count else " · 已核验")
|
|
913
|
-
badge_html = f'<span class="sec-badge {badge_state}">{esc(badge_text)}</span>'
|
|
914
|
-
else:
|
|
1131
|
+
if chapter_title:
|
|
915
1132
|
badge_html = ""
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
1133
|
+
if sec_cites:
|
|
1134
|
+
unbound = sum(1 for cid in sec_cites if cid not in source_ids)
|
|
1135
|
+
state = "bad" if unbound else ""
|
|
1136
|
+
text = f"本章引用 {len(sec_cites)} 处" + (f" · {unbound} 处未绑定" if unbound else " · 已核验")
|
|
1137
|
+
badge_html = f'<span class="sec-badge {state}">{esc(text)}</span>'
|
|
1138
|
+
parts.append(f'<section class="chapter" id="sec-{sec_idx}">'
|
|
1139
|
+
f'<header class="ch-head"><h2>{esc(chapter_title)}</h2>{badge_html}</header>')
|
|
919
1140
|
for b in sec["blocks"]:
|
|
920
1141
|
if b["kind"] == "heading":
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
1142
|
+
parts.append(f'<p class="para"><b class="kw">{esc(b["text"])}</b></p>')
|
|
1143
|
+
first_para = False
|
|
1144
|
+
continue
|
|
1145
|
+
cls = "lead" if first_para else "para"
|
|
1146
|
+
first_para = False
|
|
1147
|
+
if b["kind"] == "list_item":
|
|
924
1148
|
marker = f'{esc(b.get("number", "•"))}.' if b.get("numbered") else "•"
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
)
|
|
929
|
-
elif b["kind"] == "table":
|
|
930
|
-
body_parts.append(f'<div class="doc-block">{b["html"]}</div>')
|
|
1149
|
+
parts.append(f'<p class="{cls}"><b class="kw">{marker}</b> {b["html"]}</p>')
|
|
1150
|
+
elif b["kind"] == "hr":
|
|
1151
|
+
parts.append('<hr class="doc-divider">')
|
|
931
1152
|
else:
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
1153
|
+
parts.append(f'<p class="{cls}">{b["html"]}</p>')
|
|
1154
|
+
if chapter_title:
|
|
1155
|
+
parts.append("</section>")
|
|
1156
|
+
return "\n".join(parts)
|
|
1157
|
+
|
|
1158
|
+
|
|
1159
|
+
def strip_leading_chain(text: str, chain: List[str]) -> str:
|
|
1160
|
+
"""剥掉段落文本开头与标题链各级重复的前缀。
|
|
1161
|
+
|
|
1162
|
+
接口部分材料的"内容"字段自带段落标题前缀(个别还重复两遍),标题链已承载
|
|
1163
|
+
位置信息,摘录开头再出现同级文本即冗余;逐级最长匹配剥离,无重复则原样返回。
|
|
1164
|
+
"""
|
|
1165
|
+
t = (text or "").strip()
|
|
1166
|
+
cands = set()
|
|
1167
|
+
for lvl in chain:
|
|
1168
|
+
lvl = (lvl or "").strip()
|
|
1169
|
+
if lvl:
|
|
1170
|
+
cands.add(lvl)
|
|
1171
|
+
# 粘连标题(接口未给分隔符,如"建设交通强省5.民航和低空")拆出编号尾部子串
|
|
1172
|
+
parts = re.split(r"(?<=[一-鿿])(?=\d+[.、])", lvl)
|
|
1173
|
+
if len(parts) > 1 and parts[-1].strip():
|
|
1174
|
+
cands.add(parts[-1].strip())
|
|
1175
|
+
levels = sorted(cands, key=len, reverse=True)
|
|
1176
|
+
changed = True
|
|
1177
|
+
while changed and t:
|
|
1178
|
+
changed = False
|
|
1179
|
+
for lvl in levels:
|
|
1180
|
+
if t.startswith(lvl):
|
|
1181
|
+
t = t[len(lvl):].lstrip(" \n\r\t、。;;,,").strip()
|
|
1182
|
+
changed = True
|
|
1183
|
+
break
|
|
1184
|
+
return t
|
|
1185
|
+
|
|
1186
|
+
|
|
1187
|
+
def render_crumb(chain: List[str]) -> str:
|
|
1188
|
+
"""面包屑标题链:文章 › 章 › 节(标题链是模型生成的结构化位置,核验核心抓手)。"""
|
|
1189
|
+
parts = [esc(level) for level in chain if level]
|
|
1190
|
+
if not parts:
|
|
1191
|
+
return ""
|
|
1192
|
+
return '<span class="crumb">' + ' <i>›</i> '.join(parts) + "</span>"
|
|
1193
|
+
|
|
1194
|
+
|
|
1195
|
+
def render_segments(source: Dict[str, Any]) -> str:
|
|
1196
|
+
"""多段分块摘录:每段独立区块,各带自己的标题链——段落结构与位置直接可见。"""
|
|
1197
|
+
segments = source.get("segments") or []
|
|
1198
|
+
if not segments:
|
|
1199
|
+
return render_excerpt_html(source.get("excerpt") or "接口返回中未识别到可展示的摘录。")
|
|
1200
|
+
blocks = []
|
|
1201
|
+
for seg in segments:
|
|
1202
|
+
text = (seg.get("text") or "").strip()
|
|
1203
|
+
if not text:
|
|
1204
|
+
continue
|
|
1205
|
+
blocks.append(f'<div class="seg-block">{render_crumb(seg.get("chain") or [])}'
|
|
1206
|
+
f'{render_excerpt_html(text)}</div>')
|
|
1207
|
+
return "".join(blocks) if blocks else render_excerpt_html(source.get("excerpt") or "接口返回中未识别到可展示的摘录。")
|
|
935
1208
|
|
|
936
1209
|
|
|
937
|
-
def render_source_card(source: Dict[str, str]) -> str:
|
|
1210
|
+
def render_source_card(source: Dict[str, str], for_print: bool = False) -> str:
|
|
938
1211
|
if not source.get("used", True):
|
|
939
1212
|
# 未引用召回材料:不标"已核验"(未进入正文核验流程),只标可否查看
|
|
940
|
-
vk = ('<span class="sc-vk" style="color:var(--muted)"
|
|
1213
|
+
vk = ('<span class="sc-vk" style="color:var(--muted)">可查看全文</span>' if source.get("has_link")
|
|
941
1214
|
else '<span class="sc-vk warn">待补链接</span>')
|
|
942
1215
|
note_html = ""
|
|
943
1216
|
elif source.get("verified"):
|
|
944
1217
|
note = source.get("verify_note") or "摘录可比对,原文链接与知识专库可回看"
|
|
945
1218
|
if not source.get("has_link"):
|
|
1219
|
+
# PPT 提醒制:无原文链接不改变核验状态,卡片附温和提醒
|
|
946
1220
|
note = "摘录可比对;本条无原文链接,请留意核对"
|
|
947
1221
|
vk = f'<span class="sc-vk ok" title="{esc(note)}">✓ 已核验</span>'
|
|
948
1222
|
if not source.get("has_link"):
|
|
949
1223
|
vk += '<span class="sc-vk warn">◐ 无原文链接</span>'
|
|
950
1224
|
note_html = f'<div class="sc-vnote">{esc(short(note, 90))}</div>' if source.get("verify_note") else ""
|
|
951
1225
|
else:
|
|
952
|
-
reason = "
|
|
1226
|
+
reason = "待补原文链接" if not source.get("has_link") else "待补摘录"
|
|
953
1227
|
vk = f'<span class="sc-vk warn">◐ {reason}</span>'
|
|
954
1228
|
note_html = ""
|
|
955
|
-
links = render_source_links(source.get("url"), source.get("policy_url", ""))
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
# 高可信徽标:仅"发布日期可信度=高"(模型治理入库、标题模型精抽);"较高"(门户抓取)不标
|
|
1229
|
+
links = render_source_links(source.get("url"), source.get("policy_url", ""), source.get("snapshot", ""), source.get("link_dead", False))
|
|
1230
|
+
# 关键性行:有文号(接口字段或合并 JSON)时"文号 · 数据源 · 日期",否则"数据源 · 日期"
|
|
1231
|
+
meta_parts = [v for v in [source.get("doc_number"), source.get("agency"), source.get("date"), source.get("area")]
|
|
1232
|
+
if v and v != "未知来源"]
|
|
1233
|
+
meta = " | ".join(meta_parts)
|
|
1234
|
+
# 高可信徽标:仅"发布日期可信度=高"(模型治理入库、标题模型精抽)的材料;"较高"(门户抓取)不标。
|
|
962
1235
|
conf_badge = ""
|
|
963
1236
|
if source.get("conf") == "高":
|
|
964
1237
|
conf_badge = ('<span class="sc-conf" title="发布日期可信度:高。内容经模型治理入库,'
|
|
965
1238
|
'标题为模型从原文动态抽取,非规则提取">高可信</span>')
|
|
966
|
-
excerpt_tag = '<div class="sc-extag">▍ 原文原段(非 AI 生成)</div>'
|
|
967
1239
|
# 已引用材料显示角标编号;未引用召回材料显示"未引用"灰标(不占正文角标号)
|
|
968
1240
|
id_html = f'<span class="sc-id">[{esc(source["id"])}]</span>' if source.get("used", True) else '<span class="sc-unused">未引用</span>'
|
|
1241
|
+
body_html = (f'<div class="sc-head">{id_html}'
|
|
1242
|
+
f'<span class="sc-type">{esc(source["type_label"])}</span>{conf_badge}{vk}</div>'
|
|
1243
|
+
f'<h4>{esc(source.get("title"))}</h4>'
|
|
1244
|
+
f'<div class="sc-meta">{esc(meta)}</div>'
|
|
1245
|
+
f'{note_html}'
|
|
1246
|
+
f'{render_segments(source)}'
|
|
1247
|
+
f'{links}')
|
|
1248
|
+
if for_print:
|
|
1249
|
+
# 打印附录版:无交互属性,避免与专库卡片 id 冲突
|
|
1250
|
+
return f'<article class="scard print-only {source["type_css"]}">{body_html}</article>'
|
|
969
1251
|
unused_attr = "" if source.get("used", True) else ' data-unused="1"'
|
|
970
1252
|
return (
|
|
971
|
-
f'<article class="scard {source["type_css"]}" id="src-{esc(source["id"])}" data-type="{esc(source["type_key"])}"
|
|
972
|
-
f'
|
|
973
|
-
f'<span class="sc-type">{esc(source["type_label"])}</span>{conf_badge}{vk}</div>'
|
|
974
|
-
f'<h4>{esc(source.get("title"))}</h4>'
|
|
975
|
-
f'<div class="sc-meta">{esc(meta)}</div>'
|
|
976
|
-
f'{chain_html}{section_html}{note_html}'
|
|
977
|
-
f'{excerpt_tag}'
|
|
978
|
-
f'{render_excerpt_html(source.get("excerpt") or "接口返回中未识别到可展示的摘录。")}'
|
|
979
|
-
f'<div class="sc-more" role="button" tabindex="0"></div>'
|
|
980
|
-
f'{links}</article>'
|
|
1253
|
+
f'<article class="scard {source["type_css"]}" id="src-{esc(source["id"])}" data-type="{esc(source["type_key"])}" '
|
|
1254
|
+
f'data-cite-id="{esc(source["id"])}" data-search="{esc(source.get("search_key", ""))}"{unused_attr}>{body_html}</article>'
|
|
981
1255
|
)
|
|
982
1256
|
|
|
983
1257
|
|
|
984
|
-
def
|
|
1258
|
+
def render_process_bar(stats: Dict[str, Any], verification: Dict[str, Any]) -> str:
|
|
1259
|
+
"""过程回顾条:静态回放真实流程。无思考流数据,不做"深度思考"步骤。"""
|
|
1260
|
+
ov = verification["overall"]
|
|
1261
|
+
tr = verification["traceability"]
|
|
1262
|
+
first_query = stats["conds"][0]["key"] if stats["conds"] else ""
|
|
1263
|
+
detail_rows = "".join(
|
|
1264
|
+
f'<div class="pd-row"><b>{esc(row["key"])}</b>'
|
|
1265
|
+
f'<span>召回 {row["total"]} 条 · 正文采用 {row["used"]} 条</span></div>'
|
|
1266
|
+
for row in stats["conds"]
|
|
1267
|
+
) or '<div class="pd-row"><span>本次溯源 JSON 未记录各次检索条件</span></div>'
|
|
1268
|
+
detail_hint = f'{esc(short(first_query, 26))}…' if (stats["n_searches"] > 1 and first_query) else "查看检索明细"
|
|
1269
|
+
if stats["n_searches"] > 1:
|
|
1270
|
+
step1_sub = f"共 {stats['n_searches']} 路检索 · {detail_hint}"
|
|
1271
|
+
elif first_query:
|
|
1272
|
+
step1_sub = esc(short(first_query, 26))
|
|
1273
|
+
else:
|
|
1274
|
+
step1_sub = "深知可信搜索"
|
|
1275
|
+
step4_state = "done" if ov["passed"] else "bad"
|
|
1276
|
+
step4_icon = "✓" if ov["passed"] else "!"
|
|
1277
|
+
step4_label = "核验完成" if ov["passed"] else "核验未完全通过"
|
|
1278
|
+
step4_sub = "结论:正文依据逐条对过原文" if ov["passed"] else esc(short(";".join(ov["reasons"]) or "见核验报告单", 30))
|
|
1279
|
+
return f"""
|
|
1280
|
+
<section class="process" aria-label="生成过程回顾">
|
|
1281
|
+
<div class="p-head"><b>过程回顾</b><span>数字来自本次任务的真实记录</span></div>
|
|
1282
|
+
<ol class="p-steps">
|
|
1283
|
+
<li class="p-step expandable" id="p-step-search" role="button" tabindex="0" title="展开各路检索明细">
|
|
1284
|
+
<span class="p-no">1</span>
|
|
1285
|
+
<div class="p-txt"><b>深知检索 {stats['n_searches']} 次</b><i>{step1_sub}</i></div>
|
|
1286
|
+
</li>
|
|
1287
|
+
<li class="p-arrow" aria-hidden="true">›</li>
|
|
1288
|
+
<li class="p-step">
|
|
1289
|
+
<span class="p-no">2</span>
|
|
1290
|
+
<div class="p-txt"><b>材料入库 {stats['n_materials']} 条</b><i>正文采用 {stats['used_count']} · 召回未采用 {stats['unused_count']}</i></div>
|
|
1291
|
+
</li>
|
|
1292
|
+
<li class="p-arrow" aria-hidden="true">›</li>
|
|
1293
|
+
<li class="p-step">
|
|
1294
|
+
<span class="p-no">3</span>
|
|
1295
|
+
<div class="p-txt"><b>逐条比对原文</b><i>依据溯源 {tr['passed']}/{tr['total']} · 摘录可比对</i></div>
|
|
1296
|
+
</li>
|
|
1297
|
+
<li class="p-arrow" aria-hidden="true">›</li>
|
|
1298
|
+
<li class="p-step {step4_state}">
|
|
1299
|
+
<span class="p-no">{step4_icon}</span>
|
|
1300
|
+
<div class="p-txt"><b>{esc(step4_label)}</b><i>{step4_sub}</i></div>
|
|
1301
|
+
</li>
|
|
1302
|
+
</ol>
|
|
1303
|
+
<div class="p-detail" id="p-detail">{detail_rows}</div>
|
|
1304
|
+
</section>"""
|
|
1305
|
+
|
|
1306
|
+
|
|
1307
|
+
def render_library_view(sources: List[Dict[str, str]], hot_terms: List[str], kb_zone: str = "") -> str:
|
|
1308
|
+
"""材料专库全屏视图:大搜索 + 热词 + 检索分组 tabs + 材料卡列表(+ 原始召回存档)。"""
|
|
985
1309
|
if not sources:
|
|
986
|
-
return '<
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
# 不用 <details> 折叠:部分宿主(WorkBuddy 等)的 HTML 预览服务会改写折叠区导致卡片丢失
|
|
993
|
-
uncited_html = (
|
|
994
|
-
'<div class="uncited-group"><div class="ug-title">未引用素材('
|
|
995
|
-
f'{len(uncited)} 条 · 接口召回但正文未采用,供比对参考)</div>'
|
|
996
|
-
f'<div class="uncited-list">{uncited_cards}</div></div>'
|
|
997
|
-
)
|
|
998
|
-
# 筛选维度 = 检索分组(多路检索时按每路 search_key 分组);类型不再作筛选维度(卡片徽章保留)
|
|
1310
|
+
return ('<section class="view" id="view-library" aria-label="材料专库">'
|
|
1311
|
+
'<div class="lib-empty">接口返回中未识别到可展示的材料。</div></section>')
|
|
1312
|
+
used_sources = [s for s in sources if s.get("used", True)]
|
|
1313
|
+
unused_sources = [s for s in sources if not s.get("used", True)]
|
|
1314
|
+
|
|
1315
|
+
# tabs = 检索分组(全部 / 各路检索 / 未引用),数字真实统计
|
|
999
1316
|
conds: List[Tuple[str, int]] = []
|
|
1000
1317
|
for s in sources:
|
|
1001
|
-
key = s.get("search_key"
|
|
1318
|
+
key = (s.get("search_key") or "").strip()
|
|
1002
1319
|
if not key:
|
|
1003
1320
|
continue
|
|
1004
1321
|
for i, (name, count) in enumerate(conds):
|
|
@@ -1007,31 +1324,65 @@ def render_sources_panel(sources: List[Dict[str, str]], used: List[str], kb_zone
|
|
|
1007
1324
|
break
|
|
1008
1325
|
else:
|
|
1009
1326
|
conds.append((key, 1))
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1327
|
+
tabs = [f'<button class="on" data-cond="" type="button">全部({len(sources)})</button>']
|
|
1328
|
+
for name, count in conds:
|
|
1329
|
+
tabs.append(f'<button data-cond="{esc(name)}" type="button">{esc(name)}({count})</button>')
|
|
1330
|
+
if unused_sources:
|
|
1331
|
+
tabs.append(f'<button data-cond="__unused__" type="button">未引用({len(unused_sources)})</button>')
|
|
1332
|
+
|
|
1333
|
+
hot_html = ""
|
|
1334
|
+
if hot_terms:
|
|
1335
|
+
hot_items = "".join(f'<button class="hot-term" type="button">{esc(term)}</button>' for term in hot_terms)
|
|
1336
|
+
hot_html = f'<div class="hot-terms" aria-label="热门搜索词"><span class="hot-label">大家都在搜</span>{hot_items}</div>'
|
|
1337
|
+
|
|
1338
|
+
cards_html = "".join(render_source_card(s) for s in used_sources)
|
|
1339
|
+
cards_html += "".join(render_source_card(s) for s in unused_sources)
|
|
1340
|
+
|
|
1341
|
+
cited_verified = sum(1 for s in used_sources if s.get("verified"))
|
|
1342
|
+
badge = "全部已核验" if used_sources and cited_verified == len(used_sources) else f"{cited_verified}/{len(used_sources)} 已核验"
|
|
1343
|
+
return f"""
|
|
1344
|
+
<section class="view" id="view-library" aria-label="材料专库">
|
|
1345
|
+
<div class="lib-head">
|
|
1346
|
+
<div class="lib-title"><b>材料专库</b>
|
|
1347
|
+
<span>共 {len(sources)} 条 · 已引用 {len(used_sources)} · {esc(badge)}</span>
|
|
1348
|
+
</div>
|
|
1349
|
+
<div class="lib-searchWrap">
|
|
1350
|
+
<span class="lib-searchIcon" aria-hidden="true">⌕</span>
|
|
1351
|
+
<input class="lib-search" type="search" placeholder="搜索标题 / 来源 / 摘录…" aria-label="搜索材料">
|
|
1352
|
+
</div>
|
|
1353
|
+
{hot_html}
|
|
1354
|
+
<div class="lib-tabs" role="tablist" aria-label="按检索分组筛选">{"".join(tabs)}</div>
|
|
1355
|
+
</div>
|
|
1356
|
+
<div class="lib-list" id="lib-list">{cards_html}</div>
|
|
1357
|
+
<div class="lib-empty hide" id="lib-empty">没有符合当前筛选的材料。</div>
|
|
1358
|
+
{kb_zone}
|
|
1359
|
+
<div class="lib-foot">材料来源:深知可信搜索 · 每条摘录均取自原文原段</div>
|
|
1360
|
+
</section>"""
|
|
1361
|
+
|
|
1362
|
+
|
|
1363
|
+
def render_toc(sections: List[Dict[str, Any]]) -> str:
|
|
1364
|
+
"""章节目录(滚动 spy):长报告(≥6 节)显示,桌面端左侧浮动。"""
|
|
1365
|
+
if len(sections) < 6:
|
|
1366
|
+
return ""
|
|
1367
|
+
items = []
|
|
1368
|
+
for i, sec in enumerate(sections, 1):
|
|
1369
|
+
number, title_text = split_heading_number(sec["title"] or "")
|
|
1370
|
+
label = f"{number} {title_text}" if (number and title_text) else (title_text or f"第 {i} 节")
|
|
1371
|
+
items.append(f'<a href="#sec-{i}">{esc(short(label, 16))}</a>')
|
|
1372
|
+
return f'<nav class="toc" aria-label="章节目录">{"".join(items)}</nav>'
|
|
1373
|
+
|
|
1374
|
+
|
|
1375
|
+
def render_print_appendix(sources: List[Dict[str, str]]) -> str:
|
|
1376
|
+
"""打印归档附录:全部材料卡全展开(屏幕不显示,仅打印)。"""
|
|
1377
|
+
if not sources:
|
|
1378
|
+
return ""
|
|
1379
|
+
cards = "".join(render_source_card(s, for_print=True) for s in sources)
|
|
1380
|
+
return (f'<section class="print-appendix" aria-label="核验材料附录(打印归档)">'
|
|
1381
|
+
f'<h3>核验材料(全 {len(sources)} 条)</h3>{cards}</section>')
|
|
1032
1382
|
|
|
1033
1383
|
|
|
1034
1384
|
def render_kb_zone(kb_urls: List[str], kb_labels: List[str], source_count: int) -> str:
|
|
1385
|
+
"""原始召回存档(深知知识专库):回看每次搜索的完整召回结果(PPT 特有)。"""
|
|
1035
1386
|
if not kb_urls:
|
|
1036
1387
|
return ""
|
|
1037
1388
|
chips = []
|
|
@@ -1046,7 +1397,7 @@ def render_kb_zone(kb_urls: List[str], kb_labels: List[str], source_count: int)
|
|
|
1046
1397
|
return (
|
|
1047
1398
|
'<div class="kb-zone"><div class="kb-title">原始召回存档(深知知识专库)</div>'
|
|
1048
1399
|
'<div class="kb-desc">以下链接可回看每次搜索的完整召回结果(含未写入正文的材料);'
|
|
1049
|
-
'
|
|
1400
|
+
'原文页面改版或下线时可回看当时召回的快照。逐条材料的核验请点击材料卡上的"查看全文"直达官方页面。</div>'
|
|
1050
1401
|
f'<div class="kb-list">{"".join(chips)}</div></div>'
|
|
1051
1402
|
)
|
|
1052
1403
|
|
|
@@ -1063,6 +1414,802 @@ def safe_output_filename(question: str, timestamp: datetime, fallback: str = "dk
|
|
|
1063
1414
|
return f"{stem}_{suffix}{suffix_ext}"
|
|
1064
1415
|
|
|
1065
1416
|
|
|
1417
|
+
# ============================================================
|
|
1418
|
+
# 链接活性检测与快照兜底(生成时真实检测,就地改写材料 dict)
|
|
1419
|
+
# ============================================================
|
|
1420
|
+
|
|
1421
|
+
# 软 404 关键词:政府站常以 HTTP 200 返回"页面不存在"错误页,状态码识别不了,
|
|
1422
|
+
# 需读页面标题嗅探。关键词取自实测样例,且仅匹配 <title>(政策正文不会出现在标题里),
|
|
1423
|
+
# 误杀风险极低。
|
|
1424
|
+
SOFT_404_KEYWORDS = ("页面不存在", "页面未找到", "您访问的页面", "已删除", "已下线", "无法找到", "not found", "404")
|
|
1425
|
+
|
|
1426
|
+
|
|
1427
|
+
def check_link_alive(url: str, timeout: int = 8) -> bool:
|
|
1428
|
+
"""检测原文链接是否仍然可达。失效判据(客观信号,与请求方无关):
|
|
1429
|
+
① HTTP 404/410;② 软 404——HTTP 200 但页面标题为典型失效页。
|
|
1430
|
+
连接失败、超时、403、5xx 等一律视为"无法确认"按有效处理——政府站
|
|
1431
|
+
常对脚本请求反爬,凭这些判死会误杀可用链接。
|
|
1432
|
+
"""
|
|
1433
|
+
for method in ("HEAD", "GET"):
|
|
1434
|
+
try:
|
|
1435
|
+
req = urllib.request.Request(
|
|
1436
|
+
url, method=method,
|
|
1437
|
+
headers={"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36"},
|
|
1438
|
+
)
|
|
1439
|
+
with urllib.request.urlopen(req, timeout=timeout) as resp:
|
|
1440
|
+
if resp.status in (404, 410):
|
|
1441
|
+
return False
|
|
1442
|
+
if method == "GET":
|
|
1443
|
+
chunk = resp.read(4096).decode("utf-8", errors="replace")
|
|
1444
|
+
title = re.search(r"<title>(.*?)</title>", chunk, re.I | re.S)
|
|
1445
|
+
text = title.group(1) if title else chunk[:200]
|
|
1446
|
+
lowered = text.lower()
|
|
1447
|
+
return not any(k in text or k in lowered for k in SOFT_404_KEYWORDS)
|
|
1448
|
+
except urllib.error.HTTPError as e:
|
|
1449
|
+
if method == "GET":
|
|
1450
|
+
return e.code not in (404, 410)
|
|
1451
|
+
except Exception:
|
|
1452
|
+
if method == "GET":
|
|
1453
|
+
return True
|
|
1454
|
+
return True
|
|
1455
|
+
|
|
1456
|
+
|
|
1457
|
+
def normalize_snapshot_url(url: str) -> str:
|
|
1458
|
+
"""快照路径容错:接口部分返回值缺 /A/ 层级(实测拼接 bug),统一规范化为
|
|
1459
|
+
https://attach.dknowc.cn/snapshot/A/<2位>/<2位>/<哈希>.jpg。"""
|
|
1460
|
+
u = (url or "").strip()
|
|
1461
|
+
if u.startswith("https://attach.dknowc.cn/snapshot/") and "/snapshot/A/" not in u:
|
|
1462
|
+
return u.replace("/snapshot/", "/snapshot/A/", 1)
|
|
1463
|
+
return u
|
|
1464
|
+
|
|
1465
|
+
|
|
1466
|
+
def mark_dead_links(articles: List[Dict[str, Any]]) -> int:
|
|
1467
|
+
"""并发检测全部材料的原文链接,404/410(含软 404)的标记 链接失效=True。返回失效数。"""
|
|
1468
|
+
targets = [(i, a) for i, a in enumerate(articles) if (first_str(a.get("源网址"), a.get("sourceUrl"), a.get("source_url"), a.get("原文链接"), a.get("url")) or "").strip()]
|
|
1469
|
+
if not targets:
|
|
1470
|
+
return 0
|
|
1471
|
+
urls = [first_str(a.get("源网址"), a.get("sourceUrl"), a.get("source_url"), a.get("原文链接"), a.get("url")) for _, a in targets]
|
|
1472
|
+
with concurrent.futures.ThreadPoolExecutor(max_workers=8) as pool:
|
|
1473
|
+
alive = dict(zip((i for i, _ in targets), pool.map(check_link_alive, urls)))
|
|
1474
|
+
dead = 0
|
|
1475
|
+
for i, _ in targets:
|
|
1476
|
+
if not alive.get(i, True):
|
|
1477
|
+
articles[i]["链接失效"] = True
|
|
1478
|
+
dead += 1
|
|
1479
|
+
return dead
|
|
1480
|
+
|
|
1481
|
+
|
|
1482
|
+
def apply_snapshots(articles: List[Dict[str, Any]]) -> Tuple[int, int]:
|
|
1483
|
+
"""快照兜底预处理:路径补全(/A/ 层级)+ 纯本地格式校验,非法路径弃用。
|
|
1484
|
+
|
|
1485
|
+
不做网络可达检测:attach 前置雷池 WAF 的拦截与请求方 IP 风控相关
|
|
1486
|
+
(检测机高频请求会被拦而普通用户正常),可达性实测会误杀好快照;
|
|
1487
|
+
快照文件本身的存在性由可信搜索侧的数据质量保障。
|
|
1488
|
+
"""
|
|
1489
|
+
fixed = dropped = 0
|
|
1490
|
+
for a in articles:
|
|
1491
|
+
raw = first_str(a.get("快照链接"), a.get("snapshot"), a.get("screenShotPath"), a.get("screenshot_path"))
|
|
1492
|
+
if not raw:
|
|
1493
|
+
continue
|
|
1494
|
+
normalized = normalize_snapshot_url(raw)
|
|
1495
|
+
if normalized != raw:
|
|
1496
|
+
fixed += 1
|
|
1497
|
+
if normalized.startswith("https://attach.dknowc.cn/snapshot/A/"):
|
|
1498
|
+
a["快照链接"] = normalized
|
|
1499
|
+
else:
|
|
1500
|
+
a["快照链接"] = ""
|
|
1501
|
+
dropped += 1
|
|
1502
|
+
return fixed, dropped
|
|
1503
|
+
# ============================================================
|
|
1504
|
+
# 样式与脚本(独立常量,避免模板转义)
|
|
1505
|
+
# ============================================================
|
|
1506
|
+
|
|
1507
|
+
PAGE_CSS = """
|
|
1508
|
+
:root{
|
|
1509
|
+
--navy:#20242c; --navy-2:#3a4152;
|
|
1510
|
+
--ink:#1f2328; --muted:#6b7280; --line:#e5e7eb; --line-strong:#cbd2dd;
|
|
1511
|
+
--brand:#6512ad; --brand-2:#8b5cf6; --brand-soft:#ede9fe;
|
|
1512
|
+
--grad:linear-gradient(135deg,#6512ad,#8b5cf6);
|
|
1513
|
+
--policy:#0f9d6e; --policy-soft:#e3f5ee;
|
|
1514
|
+
--case:#9a6700; --case-soft:#fdf3dc;
|
|
1515
|
+
--ref:#4b5563; --ref-soft:#f0f1f4;
|
|
1516
|
+
--warn:#9a6700; --danger:#e5484d; --ok:#0f9d6e;
|
|
1517
|
+
--shadow-1:0 1px 3px rgba(24,20,40,.04),0 8px 30px rgba(24,20,40,.08);
|
|
1518
|
+
--shadow-2:0 3px 9px rgba(101,18,173,.22),0 14px 36px rgba(24,20,40,.14);
|
|
1519
|
+
--primary-bright:#8b5cf6; --tint:#f3edfc; --tint-2:#faf7ff; --tint-bd:#e9dff9;
|
|
1520
|
+
--tint-strong:#e6d9f9; --tint-bd-strong:#d3bef0; --body-c:#3b4152; --card-bd:#e8e6f0;
|
|
1521
|
+
}
|
|
1522
|
+
*{box-sizing:border-box}
|
|
1523
|
+
html{scroll-behavior:smooth}
|
|
1524
|
+
body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text","Segoe UI",Roboto,"PingFang SC","HarmonyOS Sans SC","Microsoft YaHei",sans-serif;
|
|
1525
|
+
color:var(--ink);background:#f4f5f7;line-height:1.75;font-size:14.5px}
|
|
1526
|
+
a{color:var(--brand)}
|
|
1527
|
+
|
|
1528
|
+
/* ===== 顶栏 ===== */
|
|
1529
|
+
.topbar{position:sticky;top:0;z-index:50;display:flex;justify-content:space-between;align-items:center;gap:10px;
|
|
1530
|
+
padding:9px 22px;background:rgba(255,255,255,.92);backdrop-filter:blur(10px);
|
|
1531
|
+
border-bottom:1px solid var(--line)}
|
|
1532
|
+
.tb-left{display:flex;align-items:center;gap:10px;min-width:0}
|
|
1533
|
+
.tb-stamp{flex:none;font-size:12.5px;font-weight:800;color:var(--navy);letter-spacing:4px;text-indent:4px}
|
|
1534
|
+
.tb-stamp::before,.tb-stamp::after{content:"";display:inline-block;width:22px;border-top:1px solid var(--line-strong);
|
|
1535
|
+
vertical-align:middle;margin:0 6px}
|
|
1536
|
+
.tb-title{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--muted);font-size:13px}
|
|
1537
|
+
.tb-right{display:flex;align-items:center;gap:8px;flex:none}
|
|
1538
|
+
.view-switch{display:inline-flex;border:1px solid var(--line);border-radius:999px;overflow:hidden;background:#fff}
|
|
1539
|
+
.view-switch button{border:0;background:transparent;color:var(--muted);font-size:12.5px;font-weight:700;
|
|
1540
|
+
padding:5px 14px;cursor:pointer}
|
|
1541
|
+
.view-switch button.on{background:var(--grad);color:#fff}
|
|
1542
|
+
.tb-tools{display:flex;gap:6px}
|
|
1543
|
+
.tb-tools button{border:1px solid var(--line);border-radius:8px;background:#fff;color:#3b3550;
|
|
1544
|
+
font-size:12.5px;font-weight:700;padding:5px 11px;cursor:pointer}
|
|
1545
|
+
.tb-tools button:hover{border-color:var(--brand-2);color:var(--brand)}
|
|
1546
|
+
.tb-tools button[aria-pressed="true"]{background:var(--grad);border-color:var(--brand);color:#fff}
|
|
1547
|
+
.print-menu{position:relative;display:inline-flex}
|
|
1548
|
+
.print-drop{position:absolute;top:calc(100% + 6px);right:0;z-index:70;display:flex;flex-direction:column;gap:4px;
|
|
1549
|
+
min-width:190px;padding:6px;background:#fff;border:1px solid var(--tint-bd);border-radius:10px;
|
|
1550
|
+
box-shadow:var(--shadow-2);text-align:left}
|
|
1551
|
+
.print-drop[hidden]{display:none}
|
|
1552
|
+
.print-drop button{border:0;background:none;border-radius:7px;color:var(--ink);font-size:12.5px;font-weight:600;
|
|
1553
|
+
padding:8px 12px;cursor:pointer;text-align:left;font-family:inherit;white-space:nowrap}
|
|
1554
|
+
.print-drop button:hover{background:var(--tint);color:var(--brand)}
|
|
1555
|
+
.progress{position:absolute;left:0;right:0;bottom:-1px;height:2px;background:transparent}
|
|
1556
|
+
.progress i{display:block;height:100%;width:0;background:linear-gradient(90deg,#6512ad,#8b5cf6)}
|
|
1557
|
+
|
|
1558
|
+
/* ===== Hero ===== */
|
|
1559
|
+
.hero{position:relative;background:linear-gradient(180deg,#fbfaff 0%,#f7f4fd 100%);
|
|
1560
|
+
color:var(--ink);padding:32px 22px 58px;text-align:center;border-bottom:1px solid var(--line)}
|
|
1561
|
+
.r-badge{display:inline-flex;align-items:center;gap:14px;margin:0 0 8px;
|
|
1562
|
+
background:var(--grad);color:#fff;border-radius:999px;padding:4px 22px;
|
|
1563
|
+
font-size:15px;font-weight:800;letter-spacing:7px;text-indent:7px;line-height:1.6;
|
|
1564
|
+
box-shadow:0 2px 8px rgba(101,18,173,.22)}
|
|
1565
|
+
.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)}
|
|
1566
|
+
.hero .meta{color:var(--muted);font-size:13px;letter-spacing:.5px}
|
|
1567
|
+
.hero-switch{margin-top:16px;display:flex;justify-content:center}
|
|
1568
|
+
.hero-switch .view-switch{border-color:#d9c9f4;background:#fff;box-shadow:0 1px 3px rgba(24,20,40,.04)}
|
|
1569
|
+
.hero-switch .view-switch button{color:#70678a;padding:6px 22px;font-size:13px}
|
|
1570
|
+
.hero-switch .view-switch button.on{background:var(--grad);color:#fff}
|
|
1571
|
+
|
|
1572
|
+
/* ===== 容器与视图 ===== */
|
|
1573
|
+
.container{max-width:1080px;margin:0 auto;padding:0 18px}
|
|
1574
|
+
.app[data-view="library"] #view-report{display:none}
|
|
1575
|
+
#view-library{display:none}
|
|
1576
|
+
.app[data-view="library"] #view-library{display:block}
|
|
1577
|
+
|
|
1578
|
+
/* ===== 过程回顾条 ===== */
|
|
1579
|
+
.process{background:#fff;border:1px solid var(--line);border-radius:14px;box-shadow:var(--shadow-1);
|
|
1580
|
+
padding:15px 20px 13px;margin:-36px auto 16px;position:relative}
|
|
1581
|
+
.p-head{display:flex;align-items:baseline;gap:10px;margin-bottom:10px}
|
|
1582
|
+
.p-head b{font-size:14.5px;color:var(--navy);letter-spacing:1px}
|
|
1583
|
+
.p-head span{font-size:11.5px;color:var(--muted)}
|
|
1584
|
+
.p-steps{list-style:none;display:flex;align-items:stretch;gap:8px;margin:0;padding:0;flex-wrap:wrap}
|
|
1585
|
+
.p-step{display:flex;gap:9px;align-items:center;min-width:0;flex:1 1 150px;
|
|
1586
|
+
border:1px solid var(--line);border-radius:10px;padding:8px 11px;background:#fafbfc}
|
|
1587
|
+
.p-no{flex:none;width:24px;height:24px;border-radius:50%;background:var(--grad);color:#fff;
|
|
1588
|
+
display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:800}
|
|
1589
|
+
.p-txt{min-width:0}
|
|
1590
|
+
.p-txt b{display:block;font-size:12.8px;color:var(--navy);line-height:1.5}
|
|
1591
|
+
.p-txt i{display:block;font-style:normal;font-size:11px;color:var(--muted);line-height:1.5;
|
|
1592
|
+
overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
1593
|
+
.p-step.done{border-color:#bfe8da;background:#f2faf7}
|
|
1594
|
+
.p-step.done .p-no{background:var(--ok)}
|
|
1595
|
+
.p-step.bad{border-color:#f6c9cb;background:#fffafa}
|
|
1596
|
+
.p-step.bad .p-no{background:var(--danger)}
|
|
1597
|
+
.p-step.expandable{cursor:pointer}
|
|
1598
|
+
.p-step.expandable:hover{border-color:var(--brand)}
|
|
1599
|
+
.p-arrow{align-self:center;color:#b9c6d9;font-size:16px;font-weight:700;flex:none}
|
|
1600
|
+
.p-detail{display:none;margin-top:10px;border-top:1px dashed var(--line-strong);padding-top:9px}
|
|
1601
|
+
.p-detail.show{display:block}
|
|
1602
|
+
.pd-row{display:flex;justify-content:space-between;gap:14px;padding:3px 2px;font-size:12.3px;flex-wrap:wrap}
|
|
1603
|
+
.pd-row b{color:var(--navy);font-weight:700;min-width:0}
|
|
1604
|
+
.pd-row span{color:var(--muted)}
|
|
1605
|
+
|
|
1606
|
+
/* ===== 核验报告视图 ===== */
|
|
1607
|
+
#view-report{padding-bottom:26px}
|
|
1608
|
+
.warn-box{margin:0 0 16px;padding:13px 16px;border:1.5px solid var(--danger);border-radius:10px;
|
|
1609
|
+
background:#fdf3f3;color:#8f2626;font-size:13.5px;line-height:1.7}
|
|
1610
|
+
.verify{margin:0 0 16px;background:#fff;border:1px solid #bfe8da;border-left:4px solid var(--ok);
|
|
1611
|
+
border-radius:14px;padding:16px 20px;box-shadow:var(--shadow-1)}
|
|
1612
|
+
.verify.fail{border-color:#f6c9cb;border-left-color:var(--danger);background:#fffafa}
|
|
1613
|
+
.v-head{display:flex;align-items:center;gap:9px;font-size:15px;font-weight:800;color:var(--ok)}
|
|
1614
|
+
.verify.fail .v-head{color:var(--danger)}
|
|
1615
|
+
.v-shield{display:inline-flex;width:22px;height:22px;border-radius:50%;background:var(--ok);color:#fff;
|
|
1616
|
+
align-items:center;justify-content:center;font-size:12px;flex:none}
|
|
1617
|
+
.verify.fail .v-shield{background:var(--danger)}
|
|
1618
|
+
.v-stamp{margin-left:auto;font-size:11px;border:1.5px solid var(--ok);color:var(--ok);border-radius:5px;
|
|
1619
|
+
padding:1px 8px;letter-spacing:2px;flex:none}
|
|
1620
|
+
.v-stamp.bad{border-color:var(--danger);color:var(--danger)}
|
|
1621
|
+
.v-reasons{margin-top:6px;font-size:12.5px;color:var(--danger)}
|
|
1622
|
+
.v-grid{display:grid;grid-template-columns:1fr 1fr;gap:4px 20px;margin-top:10px}
|
|
1623
|
+
.vi{display:flex;gap:7px;align-items:baseline;font-size:12.5px;color:#3b3550;line-height:1.7;min-width:0}
|
|
1624
|
+
.vi .s{font-weight:800;flex:none}
|
|
1625
|
+
.vi .s.ok{color:var(--ok)}
|
|
1626
|
+
.vi .s.warn{color:var(--warn)}
|
|
1627
|
+
.vi .s.fail{color:var(--danger)}
|
|
1628
|
+
.vi .s.man{color:var(--case)}
|
|
1629
|
+
.vi .s.none{color:var(--muted)}
|
|
1630
|
+
.vi .d{color:var(--muted);min-width:0}
|
|
1631
|
+
.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}
|
|
1632
|
+
|
|
1633
|
+
/* 正文(原型复刻):章节 / 段落 / 角标 / 句后引文胶囊 */
|
|
1634
|
+
.doc-paper{background:#fff;border-radius:14px;box-shadow:var(--shadow-1);padding:26px 34px 22px;margin:0 0 16px}
|
|
1635
|
+
.chapter{margin:40px 0 0}
|
|
1636
|
+
.chapter:first-child{margin-top:6px}
|
|
1637
|
+
.ch-head{display:flex;align-items:center;gap:14px;margin-bottom:18px;scroll-margin-top:86px}
|
|
1638
|
+
.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}
|
|
1639
|
+
.ch-head::after{content:"";flex-basis:110px;height:1px;background:linear-gradient(90deg,#e9dff9,transparent);order:3;flex-grow:0;flex-shrink:0}
|
|
1640
|
+
.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}
|
|
1641
|
+
.ch-head .sec-badge.bad{color:var(--danger);background:#fdecec}
|
|
1642
|
+
@media(min-width:1000px){.ch-head::after{flex-basis:200px}}
|
|
1643
|
+
.lead{font-size:15.5px;line-height:1.95;color:var(--body-c);margin:14px 0;padding:0 2px;word-break:break-word}
|
|
1644
|
+
.para{font-size:15.5px;line-height:1.95;color:var(--body-c);margin:14px 0;padding:0 2px;word-break:break-word}
|
|
1645
|
+
.para b.kw,.lead b.kw{font-weight:600;color:var(--ink)}
|
|
1646
|
+
.doc-divider{border:0;border-top:1px solid var(--line);margin:18px 0}
|
|
1647
|
+
code{padding:1px 5px;border-radius:4px;background:#f3f4f6;color:#3f3d52;
|
|
1648
|
+
font-family:ui-monospace,Menlo,Consolas,monospace;font-size:12px}
|
|
1649
|
+
.tbl-wrap{max-width:100%;overflow-x:auto;margin:8px 0}
|
|
1650
|
+
.data-tbl{width:100%;border-collapse:collapse;border:1px solid var(--line);font-size:13px}
|
|
1651
|
+
.data-tbl th,.data-tbl td{border:1px solid var(--line);padding:8px 10px;text-align:left;vertical-align:top;line-height:1.65}
|
|
1652
|
+
.data-tbl th{background:#f5f6f8;font-weight:700;color:#3f3d52}
|
|
1653
|
+
.data-tbl.wide{min-width:560px}
|
|
1654
|
+
|
|
1655
|
+
/* 角标 */
|
|
1656
|
+
.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}
|
|
1657
|
+
.cite:hover{background:var(--brand);border-color:var(--brand);color:#fff}
|
|
1658
|
+
.cite.flash{background:var(--primary-bright);border-color:var(--primary-bright);color:#fff}
|
|
1659
|
+
.cite.unresolved{color:var(--danger);border-color:#f6c9cb;background:#fdf7f7}
|
|
1660
|
+
|
|
1661
|
+
/* 行内引文 jb(原型复刻):角标后小胶囊,点击展开块级卡(溯源原文+引文摘录) */
|
|
1662
|
+
.jb{display:inline-block;vertical-align:top;max-width:100%;margin:2px 4px 2px 0;position:relative}
|
|
1663
|
+
.jb.active{display:block;margin:12px 0 2px;max-width:none}
|
|
1664
|
+
.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}
|
|
1665
|
+
.jb-name:hover{background:#fff;border-color:var(--brand)}
|
|
1666
|
+
.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)}
|
|
1667
|
+
.jb-name .jb-txt{overflow:hidden;text-overflow:ellipsis}
|
|
1668
|
+
.jb-name svg{flex:none;transition:transform .2s}
|
|
1669
|
+
.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}
|
|
1670
|
+
.jb.active .jb-name svg{transform:rotate(180deg)}
|
|
1671
|
+
.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}
|
|
1672
|
+
.jb-src:hover{filter:brightness(1.1)}
|
|
1673
|
+
.jb-src span{max-width:210px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
1674
|
+
.jb-body{display:none}
|
|
1675
|
+
.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)}
|
|
1676
|
+
.jb-head{display:flex;align-items:center;gap:9px;flex-wrap:wrap}
|
|
1677
|
+
.jb-label{display:inline-flex;align-items:center;gap:6px;font-size:12.5px;font-weight:700;color:var(--brand);letter-spacing:.5px}
|
|
1678
|
+
.jb-label svg{flex:none}
|
|
1679
|
+
.jb-site{display:inline-flex;align-items:center;gap:6px;font-size:11.5px;color:#70678a;background:#f6f4fa;
|
|
1680
|
+
border:1px solid var(--line);border-radius:999px;padding:3.5px 10px;max-width:100%;overflow:hidden;
|
|
1681
|
+
text-overflow:ellipsis;white-space:nowrap;margin:0 0 2px}
|
|
1682
|
+
.jb-site .dot{width:6px;height:6px;border-radius:50%;background:linear-gradient(135deg,#6512ad,#8b5cf6);flex-shrink:0}
|
|
1683
|
+
.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}
|
|
1684
|
+
.jb-quote:hover{border-color:var(--brand);background:#f7f4fc}
|
|
1685
|
+
.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}
|
|
1686
|
+
.jb-quote span{font-size:12.5px;line-height:1.95;color:#4b4658;word-break:break-word;text-align:justify}
|
|
1687
|
+
.jb-quote .sc-excerpt{flex:1;min-width:0;display:block}
|
|
1688
|
+
a.jb-quote{text-decoration:none}
|
|
1689
|
+
.jb.flash{animation:cardFlash 1.6s ease}
|
|
1690
|
+
@keyframes cardFlash{0%,100%{box-shadow:none}30%{box-shadow:0 0 0 3px rgba(139,92,246,.45)}}
|
|
1691
|
+
.sc-links{display:flex;flex-wrap:wrap;gap:8px;margin-top:6px}
|
|
1692
|
+
.sc-links span{display:inline-flex}
|
|
1693
|
+
.sc-links a{display:inline-flex;align-items:center;min-height:24px;padding:3px 9px;border-radius:6px;
|
|
1694
|
+
background:var(--brand-soft);color:var(--brand);font-weight:700;text-decoration:none;font-size:12px}
|
|
1695
|
+
|
|
1696
|
+
/* ===== 材料专库视图 ===== */
|
|
1697
|
+
#view-library{padding:26px 0 30px}
|
|
1698
|
+
.lib-head{max-width:860px;margin:0 auto 16px;text-align:center}
|
|
1699
|
+
.lib-title{margin-bottom:14px}
|
|
1700
|
+
.lib-title b{font-size:17px;color:var(--navy);letter-spacing:2px}
|
|
1701
|
+
.lib-title span{display:block;font-size:12px;color:var(--muted);margin-top:2px}
|
|
1702
|
+
.lib-searchWrap{position:relative;max-width:620px;margin:0 auto}
|
|
1703
|
+
.lib-searchIcon{position:absolute;left:14px;top:50%;transform:translateY(-50%);color:#a6adbd;font-size:16px;font-weight:700}
|
|
1704
|
+
.lib-search{width:100%;padding:11px 16px 11px 38px;border:1.5px solid var(--line-strong);border-radius:999px;
|
|
1705
|
+
font-size:14px;background:#fff;box-shadow:var(--shadow-1);outline:none}
|
|
1706
|
+
.lib-search:focus{border-color:var(--brand-2);box-shadow:0 0 0 3px rgba(139,92,246,.18)}
|
|
1707
|
+
.hot-terms{display:flex;flex-wrap:wrap;justify-content:center;gap:7px;margin-top:12px;align-items:center}
|
|
1708
|
+
.hot-label{font-size:12px;color:var(--muted)}
|
|
1709
|
+
.hot-term{border:0;border-radius:999px;background:var(--brand-soft);color:var(--brand);
|
|
1710
|
+
font-size:12.3px;font-weight:700;padding:3px 13px;cursor:pointer}
|
|
1711
|
+
.hot-term:hover{background:var(--grad);color:#fff}
|
|
1712
|
+
.lib-tabs{display:flex;flex-wrap:wrap;justify-content:center;gap:6px;margin-top:14px}
|
|
1713
|
+
.lib-tabs button{border:1px solid var(--line);border-radius:999px;background:#fff;color:var(--muted);
|
|
1714
|
+
padding:4px 13px;font-size:12.3px;cursor:pointer}
|
|
1715
|
+
.lib-tabs button.on{background:var(--grad);border-color:var(--brand);color:#fff;font-weight:700}
|
|
1716
|
+
.lib-list{max-width:860px;margin:0 auto;display:grid;grid-template-columns:1fr;gap:14px}
|
|
1717
|
+
.lib-empty{max-width:860px;margin:30px auto;text-align:center;color:var(--muted);font-size:13.5px}
|
|
1718
|
+
.lib-empty.hide{display:none}
|
|
1719
|
+
.lib-foot{text-align:center;color:var(--muted);font-size:11.5px;padding:18px 0 0;line-height:1.8}
|
|
1720
|
+
|
|
1721
|
+
/* ===== 材料卡 ===== */
|
|
1722
|
+
.scard{border:1px solid var(--line);border-left-width:3px;border-radius:12px;padding:14px 18px;
|
|
1723
|
+
background:#fff;box-shadow:var(--shadow-1);transition:box-shadow .25s}
|
|
1724
|
+
.scard:hover{box-shadow:var(--shadow-2)}
|
|
1725
|
+
.scard.pol{border-left-color:var(--policy)}
|
|
1726
|
+
.scard.dat{border-left-color:var(--brand-2)}
|
|
1727
|
+
.scard.cas{border-left-color:var(--case)}
|
|
1728
|
+
.scard.ref,.scard.mat{border-left-color:var(--ref)}
|
|
1729
|
+
.scard.hl{box-shadow:0 0 0 3px rgba(139,92,246,.35),var(--shadow-2)}
|
|
1730
|
+
.scard.hide{display:none}
|
|
1731
|
+
.sc-head{display:flex;align-items:center;gap:7px;margin-bottom:6px}
|
|
1732
|
+
.sc-id{font-family:monospace;font-weight:800;font-size:11px;color:#fff;background:var(--grad);
|
|
1733
|
+
border-radius:5px;padding:1px 8px}
|
|
1734
|
+
.sc-type{font-size:11px;font-weight:700;border-radius:4px;padding:1px 8px;background:var(--ref-soft);color:var(--ref)}
|
|
1735
|
+
.scard.pol .sc-type{background:var(--policy-soft);color:var(--policy)}
|
|
1736
|
+
.scard.dat .sc-type{background:var(--brand-soft);color:var(--brand)}
|
|
1737
|
+
.scard.cas .sc-type{background:var(--case-soft);color:var(--case)}
|
|
1738
|
+
.sc-vk{margin-left:auto;font-size:11px;font-weight:800;color:var(--ok)}
|
|
1739
|
+
.sc-vk + .sc-vk{margin-left:0}
|
|
1740
|
+
.sc-vk.warn{color:var(--warn)}
|
|
1741
|
+
.sc-unused{font-size:10.5px;font-weight:800;color:var(--muted);background:#efedf4;border-radius:4px;
|
|
1742
|
+
padding:1px 7px;flex:none}
|
|
1743
|
+
.sc-conf{font-size:10.5px;font-weight:800;color:#8a5a00;background:var(--case-soft);border:1px solid #e6cf8f;
|
|
1744
|
+
border-radius:4px;padding:0 7px;flex:none}
|
|
1745
|
+
.scard h4{margin:0 0 5px;font-size:14.5px;color:var(--ink);line-height:1.55}
|
|
1746
|
+
.sc-meta{font-size:11.5px;color:var(--muted)}
|
|
1747
|
+
/* 标题链面包屑(模型生成的结构化位置,核验核心抓手)与多段分块 */
|
|
1748
|
+
.crumb{font-size:11.5px;color:var(--brand);margin:10px 0 4px;font-weight:600;line-height:1.6;
|
|
1749
|
+
padding:3px 9px;background:var(--tint);border-radius:7px;display:inline-block;max-width:100%;
|
|
1750
|
+
overflow-wrap:break-word}
|
|
1751
|
+
.crumb i{font-style:normal;color:#c9b3ec;margin:0 2px;font-weight:400}
|
|
1752
|
+
.seg-block{margin-top:8px}
|
|
1753
|
+
.seg-block:first-child{margin-top:2px}
|
|
1754
|
+
.seg-block .sc-excerpt{margin-top:5px}
|
|
1755
|
+
.sc-vnote{margin-top:5px;font-size:11.3px;color:var(--ok);line-height:1.6}
|
|
1756
|
+
.sc-excerpt{margin:8px 0 0;padding:10px 12px;border:1px solid #eceaf2;border-radius:9px;
|
|
1757
|
+
background:#faf9fd;color:#4a4260;font-size:12.3px;line-height:1.75}
|
|
1758
|
+
.sc-excerpt.rich{overflow-x:auto}
|
|
1759
|
+
.sc-excerpt.rich table{width:max-content;min-width:100%;border-collapse:collapse;background:#fff;font-size:12px}
|
|
1760
|
+
.sc-excerpt.rich td,.sc-excerpt.rich th{min-width:92px;max-width:220px;padding:7px 8px;border:1px solid var(--line);
|
|
1761
|
+
vertical-align:top;word-break:break-word}
|
|
1762
|
+
.sc-excerpt.rich thead td,.sc-excerpt.rich th{background:#f3f4f6;color:#3f3d52;font-weight:700}
|
|
1763
|
+
.scard .sc-links a{font-size:12px}
|
|
1764
|
+
.scard .sc-links{margin-top:4px}
|
|
1765
|
+
.no-link{font-size:11.5px;color:var(--muted)}
|
|
1766
|
+
.sc-links a.snap{background:#faf5ff;border-color:#d9c9f4;color:#5b21b6}
|
|
1767
|
+
.dead-link{font-size:11.5px;color:var(--warn)}
|
|
1768
|
+
|
|
1769
|
+
/* ===== PPT:原始召回存档(深知知识专库) ===== */
|
|
1770
|
+
.kb-zone{max-width:860px;margin:18px auto 0;text-align:left;border:1px dashed var(--line-strong);
|
|
1771
|
+
border-radius:12px;padding:14px 16px;background:#fff}
|
|
1772
|
+
.kb-title{font-size:13px;font-weight:800;color:var(--navy);margin-bottom:4px}
|
|
1773
|
+
.kb-desc{font-size:11.5px;color:var(--muted);line-height:1.7;margin-bottom:10px}
|
|
1774
|
+
.kb-list{display:flex;flex-wrap:wrap;gap:8px}
|
|
1775
|
+
.kb-chip{display:inline-flex;flex-direction:column;gap:2px;border:1px solid var(--line);border-radius:9px;
|
|
1776
|
+
padding:8px 12px;text-decoration:none;background:#faf9fd;max-width:100%}
|
|
1777
|
+
.kb-chip:hover{border-color:var(--brand)}
|
|
1778
|
+
.kb-label{font-size:12.5px;font-weight:700;color:var(--brand)}
|
|
1779
|
+
.kb-count{font-size:10.5px;color:var(--muted)}
|
|
1780
|
+
.kb-arrow{font-size:11px;color:var(--brand)}
|
|
1781
|
+
|
|
1782
|
+
/* ===== 章节目录(spy,长报告) ===== */
|
|
1783
|
+
.toc{position:fixed;left:calc((100vw - 1080px)/2 - 168px);top:120px;width:140px;max-height:60vh;overflow:auto;
|
|
1784
|
+
display:flex;flex-direction:column;gap:2px;font-size:12px}
|
|
1785
|
+
.toc a{color:var(--muted);text-decoration:none;padding:4px 10px;border-left:2px solid var(--line);
|
|
1786
|
+
line-height:1.5;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
1787
|
+
.toc a.on{color:var(--brand);border-left-color:var(--brand);font-weight:700}
|
|
1788
|
+
@media (max-width:1460px){.toc{display:none}}
|
|
1789
|
+
|
|
1790
|
+
.foot{text-align:center;color:var(--muted);font-size:11.5px;padding:16px 0 4px;line-height:1.8}
|
|
1791
|
+
|
|
1792
|
+
/* ===== 只看正文(纯净阅读态) ===== */
|
|
1793
|
+
body.reading .process,body.reading .verify,body.reading .jb,body.reading .sec-badge,
|
|
1794
|
+
body.reading .cite,body.reading .toc,body.reading .p-detail{display:none!important}
|
|
1795
|
+
|
|
1796
|
+
/* ===== 打印附录 ===== */
|
|
1797
|
+
.print-appendix{display:none}
|
|
1798
|
+
|
|
1799
|
+
/* ===== 移动端 ===== */
|
|
1800
|
+
.sheet-mask{display:none}
|
|
1801
|
+
.sheet{display:none}
|
|
1802
|
+
@media (max-width:680px){
|
|
1803
|
+
body{font-size:14px;line-height:1.8}
|
|
1804
|
+
.topbar{padding:7px 10px;gap:6px}
|
|
1805
|
+
.tb-stamp{font-size:11px;letter-spacing:2px;text-indent:2px}
|
|
1806
|
+
.tb-stamp::before,.tb-stamp::after{width:12px;margin:0 4px}
|
|
1807
|
+
.tb-title{display:none}
|
|
1808
|
+
.topbar .view-switch{display:none}
|
|
1809
|
+
.tb-tools button{font-size:11.5px;padding:4px 8px}
|
|
1810
|
+
.hero{padding:24px 14px 50px}
|
|
1811
|
+
.ch-head{gap:8px;margin-bottom:14px;flex-wrap:nowrap}
|
|
1812
|
+
.ch-head h2{font-size:17px;line-height:1.45}
|
|
1813
|
+
.ch-head::after{display:none}
|
|
1814
|
+
.ch-head .sec-badge{font-size:10.5px;padding:2px 7px;white-space:nowrap}
|
|
1815
|
+
.jb-name{max-width:calc(100vw - 72px)}
|
|
1816
|
+
.r-badge{font-size:13.5px;letter-spacing:6px;text-indent:6px;gap:10px}
|
|
1817
|
+
.hero h1{font-size:18.5px}
|
|
1818
|
+
.hero .meta{font-size:11.5px;line-height:1.7}
|
|
1819
|
+
.hero-switch .view-switch button{padding:6px 16px;font-size:12.5px}
|
|
1820
|
+
.process{margin-top:-30px;padding:12px 12px 11px}
|
|
1821
|
+
.p-step{flex:1 1 100%}
|
|
1822
|
+
.p-arrow{display:none}
|
|
1823
|
+
.verify{padding:13px 14px}
|
|
1824
|
+
.v-head{font-size:14px}
|
|
1825
|
+
.v-grid{grid-template-columns:1fr;gap:2px 0}
|
|
1826
|
+
.vi{flex-wrap:wrap;gap:4px 8px}
|
|
1827
|
+
.vi .d{min-width:0}
|
|
1828
|
+
.warn-box{font-size:12.5px;padding:11px 12px}
|
|
1829
|
+
.doc-paper{padding:16px 14px 10px;border-radius:10px}
|
|
1830
|
+
.data-tbl{font-size:12px}
|
|
1831
|
+
.data-tbl th,.data-tbl td{padding:6px 7px;line-height:1.55}
|
|
1832
|
+
.cite{font-size:11px;padding:0 4px}
|
|
1833
|
+
#view-library{padding:18px 0 24px}
|
|
1834
|
+
.lib-search{padding:10px 14px 10px 34px;font-size:13.5px}
|
|
1835
|
+
.lib-tabs{justify-content:flex-start;flex-wrap:nowrap;overflow-x:auto;padding-bottom:4px;
|
|
1836
|
+
-webkit-overflow-scrolling:touch;scrollbar-width:none}
|
|
1837
|
+
.lib-tabs::-webkit-scrollbar{display:none}
|
|
1838
|
+
.lib-tabs button{flex:none}
|
|
1839
|
+
.lib-list{grid-template-columns:1fr;gap:10px}
|
|
1840
|
+
.scard{padding:10px 11px}
|
|
1841
|
+
.crumb{font-size:11px}
|
|
1842
|
+
.sc-excerpt{font-size:11.5px}
|
|
1843
|
+
.kb-zone{margin:14px 12px 0}
|
|
1844
|
+
/* 移动端材料底部弹层:点角标就地弹出材料卡,不跳转打断阅读 */
|
|
1845
|
+
.sheet-mask{display:block;position:fixed;inset:0;background:rgba(11,31,58,.45);z-index:99;opacity:0;
|
|
1846
|
+
pointer-events:none;transition:opacity .2s}
|
|
1847
|
+
.sheet-mask.show{opacity:1;pointer-events:auto}
|
|
1848
|
+
.sheet{display:block;position:fixed;left:0;right:0;bottom:0;z-index:100;background:#fff;
|
|
1849
|
+
border-radius:14px 14px 0 0;box-shadow:0 -8px 30px rgba(11,31,58,.25);
|
|
1850
|
+
max-height:68vh;overflow-y:auto;-webkit-overflow-scrolling:touch;
|
|
1851
|
+
padding:10px 16px 22px;transform:translateY(105%);transition:transform .25s ease}
|
|
1852
|
+
.sheet.show{transform:translateY(0)}
|
|
1853
|
+
.sheet-grab{width:38px;height:4px;border-radius:2px;background:#c9d4e2;margin:2px auto 8px}
|
|
1854
|
+
.sheet-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px}
|
|
1855
|
+
.sheet-head b{font-size:13.5px;color:var(--navy)}
|
|
1856
|
+
.sheet-close{border:1px solid var(--line);background:#f5f3fa;border-radius:8px;color:#3b4a61;
|
|
1857
|
+
font-size:12.5px;font-weight:700;padding:5px 14px;cursor:pointer}
|
|
1858
|
+
.sheet .scard{box-shadow:none;margin-bottom:0}
|
|
1859
|
+
.sheet .sc-excerpt{display:block;-webkit-line-clamp:unset;cursor:auto}
|
|
1860
|
+
/* 正文表述 ↔ 原文原段 对照区(弹层顶部) */
|
|
1861
|
+
.cmp{margin:0 0 10px;border:1px solid var(--line);border-radius:10px;overflow:hidden}
|
|
1862
|
+
.cmp-tag{font-size:11px;font-weight:800;padding:3px 10px}
|
|
1863
|
+
.cmp-side{padding:9px 12px;font-size:12.8px;line-height:1.7}
|
|
1864
|
+
.cmp-side p{margin:0}
|
|
1865
|
+
.cmp-ai{background:#fbfaff;color:#3f3d52}
|
|
1866
|
+
.cmp-ai .cmp-tag{background:#eef1f6;color:var(--ref)}
|
|
1867
|
+
.cmp-src{background:#f4faf7;color:#2f4a3e;border-top:1px dashed var(--line-strong)}
|
|
1868
|
+
.cmp-src .cmp-tag{background:var(--policy-soft);color:#0b6e4f}
|
|
1869
|
+
.cmp-src .sc-excerpt{display:block;-webkit-line-clamp:unset;background:#fff;cursor:auto;font-size:12px;padding:8px 10px;margin:0}
|
|
1870
|
+
}
|
|
1871
|
+
|
|
1872
|
+
/* ===== 打印归档 ===== */
|
|
1873
|
+
@media print{
|
|
1874
|
+
.topbar,.process .p-detail,.hero-switch,.tb-tools,.view-switch,.lib-head,.toc,.sheet,.sheet-mask,
|
|
1875
|
+
.progress{display:none!important}
|
|
1876
|
+
#view-library{display:none!important}
|
|
1877
|
+
#view-report{display:block!important}
|
|
1878
|
+
.app[data-view="library"] #view-report{display:block!important}
|
|
1879
|
+
.hero{background:none;border:0;color:var(--ink);padding:10px 0 4px}
|
|
1880
|
+
.hero .meta{color:var(--muted)}
|
|
1881
|
+
*{-webkit-print-color-adjust:exact;print-color-adjust:exact}
|
|
1882
|
+
.process{box-shadow:none;margin:6px 0 12px}
|
|
1883
|
+
.verify{border-color:#bbb;box-shadow:none;break-inside:avoid}
|
|
1884
|
+
.doc-paper{box-shadow:none;border-radius:0;padding:0}
|
|
1885
|
+
body{background:#fff;font-size:12.5px}
|
|
1886
|
+
.sc-excerpt{display:block;-webkit-line-clamp:unset;cursor:auto}
|
|
1887
|
+
.scard{break-inside:avoid}
|
|
1888
|
+
.cite{background:none!important;color:#333!important;text-decoration:none!important}
|
|
1889
|
+
.cite::before{content:"["}.cite::after{content:"]"}
|
|
1890
|
+
.jb{display:inline!important}
|
|
1891
|
+
.jb .jb-name{border:0;background:none;padding:0;color:#333;font-weight:600}
|
|
1892
|
+
.jb .jb-name .jb-id{color:#333;background:none;border:1px solid #999;border-radius:3px}
|
|
1893
|
+
.jb .jb-body{display:none!important}
|
|
1894
|
+
.jb.active{break-inside:avoid}
|
|
1895
|
+
.jb.active .jb-body{display:block!important}
|
|
1896
|
+
.jb.active .jb-body .jb-quote{break-inside:avoid}
|
|
1897
|
+
body.reading .verify,body.reading .process,body.reading .ev-row,body.reading .sec-badge,
|
|
1898
|
+
body.reading .cite{display:none!important}
|
|
1899
|
+
.print-appendix{display:block;break-before:page}
|
|
1900
|
+
body.print-body-only .verify,body.print-body-only .process,body.print-body-only .print-appendix,
|
|
1901
|
+
body.print-body-only .jb,body.print-body-only .foot{display:none!important}
|
|
1902
|
+
.print-appendix h3{font-size:15px;color:var(--navy);border-bottom:1px solid #999;padding-bottom:6px;margin:0 0 12px}
|
|
1903
|
+
.print-appendix .scard{margin-bottom:10px}
|
|
1904
|
+
}
|
|
1905
|
+
"""
|
|
1906
|
+
|
|
1907
|
+
PAGE_JS = """
|
|
1908
|
+
(function () {
|
|
1909
|
+
"use strict";
|
|
1910
|
+
function $(sel, root) { return (root || document).querySelector(sel); }
|
|
1911
|
+
function $$(sel, root) { return Array.prototype.slice.call((root || document).querySelectorAll(sel)); }
|
|
1912
|
+
|
|
1913
|
+
var app = $(".app");
|
|
1914
|
+
var isMobile = function () { return window.matchMedia("(max-width:680px)").matches; };
|
|
1915
|
+
|
|
1916
|
+
/* ===== 1. 双视图切换(保存/恢复各自滚动位置) ===== */
|
|
1917
|
+
var savedScroll = { report: 0, library: 0 };
|
|
1918
|
+
function setView(view) {
|
|
1919
|
+
if (!app || app.getAttribute("data-view") === view) return;
|
|
1920
|
+
savedScroll[app.getAttribute("data-view") || "report"] = window.scrollY;
|
|
1921
|
+
app.setAttribute("data-view", view);
|
|
1922
|
+
$$(".view-switch button").forEach(function (b) {
|
|
1923
|
+
b.classList.toggle("on", b.getAttribute("data-view") === view);
|
|
1924
|
+
});
|
|
1925
|
+
window.scrollTo(0, Math.max(0, savedScroll[view] || 0));
|
|
1926
|
+
}
|
|
1927
|
+
$$(".view-switch button").forEach(function (b) {
|
|
1928
|
+
b.addEventListener("click", function () { setView(b.getAttribute("data-view")); });
|
|
1929
|
+
});
|
|
1930
|
+
|
|
1931
|
+
/* ===== 2. 阅读进度条 ===== */
|
|
1932
|
+
var progress = $(".progress i");
|
|
1933
|
+
function updateProgress() {
|
|
1934
|
+
if (!progress) return;
|
|
1935
|
+
var h = document.documentElement;
|
|
1936
|
+
var max = h.scrollHeight - h.clientHeight;
|
|
1937
|
+
progress.style.width = (max > 0 ? Math.min(100, (h.scrollTop / max) * 100) : 0) + "%";
|
|
1938
|
+
}
|
|
1939
|
+
window.addEventListener("scroll", updateProgress, { passive: true });
|
|
1940
|
+
updateProgress();
|
|
1941
|
+
|
|
1942
|
+
/* ===== 3. 只看正文(纯净阅读态切换) ===== */
|
|
1943
|
+
var readBtn = $("#btn-reading");
|
|
1944
|
+
if (readBtn) {
|
|
1945
|
+
readBtn.addEventListener("click", function () {
|
|
1946
|
+
var on = document.body.classList.toggle("reading");
|
|
1947
|
+
readBtn.setAttribute("aria-pressed", on ? "true" : "false");
|
|
1948
|
+
readBtn.textContent = on ? "显示核验" : "只看正文";
|
|
1949
|
+
/* 只看正文只作用于核验报告视图:正在材料专库时切回报告,专库不受影响 */
|
|
1950
|
+
if (on && app && app.getAttribute("data-view") !== "report") setView("report");
|
|
1951
|
+
});
|
|
1952
|
+
}
|
|
1953
|
+
|
|
1954
|
+
/* ===== 4. 复制全文(章节标题 + 段落 + 表格,去角标) ===== */
|
|
1955
|
+
var copyBtn = $("#btn-copy");
|
|
1956
|
+
if (copyBtn) {
|
|
1957
|
+
copyBtn.addEventListener("click", function () {
|
|
1958
|
+
var parts = [];
|
|
1959
|
+
/* 按文档流顺序收集章节标题/段落/表格;克隆后剔除引文胶囊与角标,
|
|
1960
|
+
只复制正文本身(胶囊标题/展开摘录/编号数字均不带出) */
|
|
1961
|
+
var nodes = $$("#view-report .ch-head h2, #view-report .lead, #view-report .para, #view-report .tbl-wrap");
|
|
1962
|
+
nodes.sort(function (a, b) { return (a.compareDocumentPosition(b) & 4) ? -1 : 1; });
|
|
1963
|
+
nodes.forEach(function (el) {
|
|
1964
|
+
var clone = el.cloneNode(true);
|
|
1965
|
+
clone.querySelectorAll(".jb, sup.cite").forEach(function (x) { x.remove(); });
|
|
1966
|
+
var t = clone.textContent.replace(/[ \\t]+/g, " ").trim();
|
|
1967
|
+
if (t) parts.push(t);
|
|
1968
|
+
});
|
|
1969
|
+
var text = parts.filter(Boolean).join("\\n\\n");
|
|
1970
|
+
function done(ok) {
|
|
1971
|
+
var old = copyBtn.textContent;
|
|
1972
|
+
copyBtn.textContent = ok ? "已复制 ✓" : "复制失败";
|
|
1973
|
+
setTimeout(function () { copyBtn.textContent = old; }, 1600);
|
|
1974
|
+
}
|
|
1975
|
+
if (navigator.clipboard && navigator.clipboard.writeText) {
|
|
1976
|
+
navigator.clipboard.writeText(text).then(function () { done(true); }, function () { done(fallback(text)); });
|
|
1977
|
+
} else {
|
|
1978
|
+
done(fallback(text));
|
|
1979
|
+
}
|
|
1980
|
+
function fallback(value) {
|
|
1981
|
+
try {
|
|
1982
|
+
var ta = document.createElement("textarea");
|
|
1983
|
+
ta.value = value;
|
|
1984
|
+
ta.style.position = "fixed";
|
|
1985
|
+
ta.style.opacity = "0";
|
|
1986
|
+
document.body.appendChild(ta);
|
|
1987
|
+
ta.select();
|
|
1988
|
+
var ok = document.execCommand("copy");
|
|
1989
|
+
document.body.removeChild(ta);
|
|
1990
|
+
return ok;
|
|
1991
|
+
} catch (e) { return false; }
|
|
1992
|
+
}
|
|
1993
|
+
});
|
|
1994
|
+
}
|
|
1995
|
+
|
|
1996
|
+
/* ===== 5. 打印归档(PDF):下拉双选项——只打印正文 / 完整归档 ===== */
|
|
1997
|
+
var printBtn = $("#btn-print");
|
|
1998
|
+
var printDrop = $("#print-drop");
|
|
1999
|
+
function printBy(mode) {
|
|
2000
|
+
if (mode === "body") document.body.classList.add("print-body-only");
|
|
2001
|
+
if (printDrop) printDrop.hidden = true;
|
|
2002
|
+
window.print();
|
|
2003
|
+
}
|
|
2004
|
+
if (printBtn && printDrop) {
|
|
2005
|
+
printBtn.addEventListener("click", function (e) {
|
|
2006
|
+
e.stopPropagation();
|
|
2007
|
+
printDrop.hidden = !printDrop.hidden;
|
|
2008
|
+
});
|
|
2009
|
+
printDrop.addEventListener("click", function (e) {
|
|
2010
|
+
e.stopPropagation();
|
|
2011
|
+
var t = e.target.closest("button");
|
|
2012
|
+
if (!t) return;
|
|
2013
|
+
printBy(t.id === "print-body" ? "body" : "full");
|
|
2014
|
+
});
|
|
2015
|
+
document.addEventListener("click", function () { printDrop.hidden = true; });
|
|
2016
|
+
/* 打印结束移除临时模式(浏览器打印窗口关闭后触发) */
|
|
2017
|
+
window.addEventListener("afterprint", function () { document.body.classList.remove("print-body-only"); });
|
|
2018
|
+
}
|
|
2019
|
+
|
|
2020
|
+
/* ===== 6. 材料卡索引(专库列表内,不含打印附录) ===== */
|
|
2021
|
+
var cards = $$("#lib-list .scard");
|
|
2022
|
+
var byId = {};
|
|
2023
|
+
cards.forEach(function (c) {
|
|
2024
|
+
var id = c.getAttribute("data-cite-id");
|
|
2025
|
+
if (id) byId[id] = c;
|
|
2026
|
+
});
|
|
2027
|
+
|
|
2028
|
+
/* 移动端底部弹层:正文表述 ↔ 原文原段 对照 + 材料卡 */
|
|
2029
|
+
var sheet = $(".sheet");
|
|
2030
|
+
var mask = $(".sheet-mask");
|
|
2031
|
+
function escHtml(s) {
|
|
2032
|
+
var d = document.createElement("div");
|
|
2033
|
+
d.textContent = s;
|
|
2034
|
+
return d.innerHTML;
|
|
2035
|
+
}
|
|
2036
|
+
function sentenceOf(el) {
|
|
2037
|
+
var para = el && el.closest ? el.closest(".para,.lead") : null;
|
|
2038
|
+
return para ? para.innerText.trim() : "";
|
|
2039
|
+
}
|
|
2040
|
+
function openSheet(card, sentence) {
|
|
2041
|
+
if (!sheet) return;
|
|
2042
|
+
var body = sheet.querySelector(".sheet-body");
|
|
2043
|
+
body.innerHTML = "";
|
|
2044
|
+
if (sentence) {
|
|
2045
|
+
var excerpt = card.querySelector(".sc-excerpt");
|
|
2046
|
+
var cmp = document.createElement("div");
|
|
2047
|
+
cmp.className = "cmp";
|
|
2048
|
+
cmp.innerHTML =
|
|
2049
|
+
'<div class="cmp-side cmp-ai"><div class="cmp-tag">正文表述</div><p>' + escHtml(sentence) + '</p></div>' +
|
|
2050
|
+
'<div class="cmp-side cmp-src"><div class="cmp-tag">原文原段</div>' +
|
|
2051
|
+
'<div class="sc-excerpt">' + (excerpt ? excerpt.innerHTML : "") + '</div></div>';
|
|
2052
|
+
body.appendChild(cmp);
|
|
2053
|
+
}
|
|
2054
|
+
var clone = card.cloneNode(true);
|
|
2055
|
+
clone.removeAttribute("id");
|
|
2056
|
+
clone.classList.remove("hide");
|
|
2057
|
+
clone.classList.add("open");
|
|
2058
|
+
body.appendChild(clone);
|
|
2059
|
+
sheet.classList.add("show");
|
|
2060
|
+
mask.classList.add("show");
|
|
2061
|
+
document.body.style.overflow = "hidden";
|
|
2062
|
+
sheet.scrollTop = 0;
|
|
2063
|
+
}
|
|
2064
|
+
function closeSheet() {
|
|
2065
|
+
if (!sheet) return;
|
|
2066
|
+
sheet.classList.remove("show");
|
|
2067
|
+
mask.classList.remove("show");
|
|
2068
|
+
document.body.style.overflow = "";
|
|
2069
|
+
}
|
|
2070
|
+
if (sheet && mask) {
|
|
2071
|
+
mask.addEventListener("click", closeSheet);
|
|
2072
|
+
var closeBtn = sheet.querySelector(".sheet-close");
|
|
2073
|
+
if (closeBtn) closeBtn.addEventListener("click", closeSheet);
|
|
2074
|
+
}
|
|
2075
|
+
|
|
2076
|
+
/* 行内引文 jb(原型行为):点小胶囊 toggle 展开卡;展开卡内引文条目点击进专库。
|
|
2077
|
+
未绑定角标红色警示,绝不按位置猜测。 */
|
|
2078
|
+
var JB_TABLES = {};
|
|
2079
|
+
try {
|
|
2080
|
+
var jbTablesEl = document.getElementById("jb-tables");
|
|
2081
|
+
if (jbTablesEl) JB_TABLES = JSON.parse(jbTablesEl.textContent || "{}");
|
|
2082
|
+
} catch (e) { JB_TABLES = {}; }
|
|
2083
|
+
function fillTableHolders(jb) {
|
|
2084
|
+
jb.querySelectorAll(".tbl-holder[data-tbl]").forEach(function (h) {
|
|
2085
|
+
if (h.getAttribute("data-filled")) return;
|
|
2086
|
+
var html = JB_TABLES[h.getAttribute("data-tbl")];
|
|
2087
|
+
if (html) h.innerHTML = html;
|
|
2088
|
+
h.setAttribute("data-filled", "1");
|
|
2089
|
+
});
|
|
2090
|
+
}
|
|
2091
|
+
function toggleJb(jb, forceOpen) {
|
|
2092
|
+
var open = forceOpen === true ? true : !jb.classList.contains("active");
|
|
2093
|
+
document.querySelectorAll(".jb.active").forEach(function (x) { if (x !== jb) x.classList.remove("active"); });
|
|
2094
|
+
jb.classList.toggle("active", open);
|
|
2095
|
+
if (open) fillTableHolders(jb);
|
|
2096
|
+
var name = jb.querySelector(".jb-name");
|
|
2097
|
+
if (name) name.setAttribute("aria-expanded", open ? "true" : "false");
|
|
2098
|
+
return open;
|
|
2099
|
+
}
|
|
2100
|
+
document.querySelectorAll(".jb-name").forEach(function (name) {
|
|
2101
|
+
name.addEventListener("click", function () { toggleJb(name.closest(".jb")); });
|
|
2102
|
+
});
|
|
2103
|
+
|
|
2104
|
+
/* 引文条目点击 → 材料专库定位对应卡:库内导航看完整材料;
|
|
2105
|
+
外部原文跳转只保留 jb-head 的"查看全文"按钮,动线分离 */
|
|
2106
|
+
function jumpToLibrary(id) {
|
|
2107
|
+
var card = byId[id];
|
|
2108
|
+
if (!card) return;
|
|
2109
|
+
setView("library");
|
|
2110
|
+
card.classList.remove("hide", "open");
|
|
2111
|
+
card.classList.add("hl", "open");
|
|
2112
|
+
requestAnimationFrame(function () {
|
|
2113
|
+
requestAnimationFrame(function () { card.scrollIntoView({ block: "center", behavior: "smooth" }); });
|
|
2114
|
+
});
|
|
2115
|
+
setTimeout(function () { card.classList.remove("hl"); }, 2200);
|
|
2116
|
+
}
|
|
2117
|
+
document.querySelectorAll(".jb-quote").forEach(function (q) {
|
|
2118
|
+
function go() {
|
|
2119
|
+
var jbEl = q.closest(".jb");
|
|
2120
|
+
var id = jbEl && jbEl.getAttribute("data-cite");
|
|
2121
|
+
if (isMobile()) {
|
|
2122
|
+
/* 移动端不跳视图(跳转会打断阅读),就地展开/收起当前 jb */
|
|
2123
|
+
var card = id && byId[id];
|
|
2124
|
+
if (card) { openSheet(card, sentenceOf(q)); return; }
|
|
2125
|
+
}
|
|
2126
|
+
if (id) jumpToLibrary(id);
|
|
2127
|
+
}
|
|
2128
|
+
q.addEventListener("click", go);
|
|
2129
|
+
q.addEventListener("keydown", function (e) {
|
|
2130
|
+
if (e.key === "Enter" || e.key === " ") { e.preventDefault(); go(); }
|
|
2131
|
+
});
|
|
2132
|
+
});
|
|
2133
|
+
document.querySelectorAll("sup.cite").forEach(function (btn) {
|
|
2134
|
+
/* 仅剩未绑定角标(红色数字)走到这里:点击控制台留痕 */
|
|
2135
|
+
btn.addEventListener("click", function () {
|
|
2136
|
+
if (console.error) console.error("[核验] 未绑定角标:", btn.getAttribute("data-cite"));
|
|
2137
|
+
});
|
|
2138
|
+
});
|
|
2139
|
+
|
|
2140
|
+
/* ===== 7. 材料专库:tabs + 搜索 + 热词 ===== */
|
|
2141
|
+
var cond = "";
|
|
2142
|
+
var kw = "";
|
|
2143
|
+
function applyFilter() {
|
|
2144
|
+
var visible = 0;
|
|
2145
|
+
cards.forEach(function (c) {
|
|
2146
|
+
var okCond = !cond;
|
|
2147
|
+
if (cond === "__unused__") okCond = c.getAttribute("data-unused") === "1";
|
|
2148
|
+
else if (cond) okCond = c.getAttribute("data-search") === cond;
|
|
2149
|
+
var okKw = !kw || (c.textContent || "").toLowerCase().indexOf(kw) !== -1;
|
|
2150
|
+
var show = okCond && okKw;
|
|
2151
|
+
c.classList.toggle("hide", !show);
|
|
2152
|
+
if (show) visible++;
|
|
2153
|
+
});
|
|
2154
|
+
var empty = $("#lib-empty");
|
|
2155
|
+
if (empty) empty.classList.toggle("hide", visible !== 0);
|
|
2156
|
+
}
|
|
2157
|
+
$$(".lib-tabs button").forEach(function (b) {
|
|
2158
|
+
b.addEventListener("click", function () {
|
|
2159
|
+
$$(".lib-tabs button").forEach(function (x) { x.classList.remove("on"); });
|
|
2160
|
+
b.classList.add("on");
|
|
2161
|
+
cond = b.getAttribute("data-cond") || "";
|
|
2162
|
+
applyFilter();
|
|
2163
|
+
});
|
|
2164
|
+
});
|
|
2165
|
+
var search = $(".lib-search");
|
|
2166
|
+
if (search) search.addEventListener("input", function () { kw = search.value.trim().toLowerCase(); applyFilter(); });
|
|
2167
|
+
$$(".hot-term").forEach(function (t) {
|
|
2168
|
+
t.addEventListener("click", function () {
|
|
2169
|
+
if (!search) return;
|
|
2170
|
+
search.value = t.textContent.trim();
|
|
2171
|
+
kw = search.value.toLowerCase();
|
|
2172
|
+
applyFilter();
|
|
2173
|
+
if (search.focus) search.focus();
|
|
2174
|
+
});
|
|
2175
|
+
});
|
|
2176
|
+
|
|
2177
|
+
/* ===== 8. 过程回顾条:检索步骤展开 ===== */
|
|
2178
|
+
var pStep = $("#p-step-search");
|
|
2179
|
+
var pDetail = $("#p-detail");
|
|
2180
|
+
if (pStep && pDetail) {
|
|
2181
|
+
function toggleDetail() { pDetail.classList.toggle("show"); }
|
|
2182
|
+
pStep.addEventListener("click", toggleDetail);
|
|
2183
|
+
pStep.addEventListener("keydown", function (e) {
|
|
2184
|
+
if (e.key === "Enter" || e.key === " ") { e.preventDefault(); toggleDetail(); }
|
|
2185
|
+
});
|
|
2186
|
+
}
|
|
2187
|
+
|
|
2188
|
+
/* ===== 9. 章节目录(spy) ===== */
|
|
2189
|
+
var toc = $(".toc");
|
|
2190
|
+
if (toc) {
|
|
2191
|
+
var links = $$("a", toc);
|
|
2192
|
+
var secs = links.map(function (a) { return document.querySelector(a.getAttribute("href")); });
|
|
2193
|
+
links.forEach(function (a) {
|
|
2194
|
+
a.addEventListener("click", function (e) {
|
|
2195
|
+
e.preventDefault();
|
|
2196
|
+
var target = document.querySelector(a.getAttribute("href"));
|
|
2197
|
+
if (target) target.scrollIntoView({ block: "start", behavior: "smooth" });
|
|
2198
|
+
});
|
|
2199
|
+
});
|
|
2200
|
+
function spy() {
|
|
2201
|
+
var pos = window.scrollY + 130;
|
|
2202
|
+
var current = -1;
|
|
2203
|
+
secs.forEach(function (s, i) { if (s && s.offsetTop <= pos) current = i; });
|
|
2204
|
+
links.forEach(function (a, i) { a.classList.toggle("on", i === current); });
|
|
2205
|
+
}
|
|
2206
|
+
window.addEventListener("scroll", spy, { passive: true });
|
|
2207
|
+
spy();
|
|
2208
|
+
}
|
|
2209
|
+
})();
|
|
2210
|
+
"""
|
|
2211
|
+
|
|
2212
|
+
|
|
1066
2213
|
def render_html(payload: Dict[str, Any], title: str, answer_override: str = "", question_override: str = "",
|
|
1067
2214
|
generated_at: Optional[datetime] = None, stage: str = "final") -> str:
|
|
1068
2215
|
# unwrap 会取出 content 包装;self_check / verification_checks / knowledgeBase 等
|
|
@@ -1070,14 +2217,15 @@ def render_html(payload: Dict[str, Any], title: str, answer_override: str = "",
|
|
|
1070
2217
|
raw_payload = payload
|
|
1071
2218
|
payload = unwrap(payload)
|
|
1072
2219
|
for key in ("selfCheck", "self_check", "verificationChecks", "verification_checks",
|
|
1073
|
-
"knowledgeBases", "knowledgeBase", "knowledgeBaseLabels"
|
|
2220
|
+
"knowledgeBases", "knowledgeBase", "knowledgeBaseLabels",
|
|
2221
|
+
"recalled_materials", "召回材料", "检索文章"):
|
|
1074
2222
|
if key in raw_payload and key not in payload:
|
|
1075
2223
|
payload[key] = raw_payload[key]
|
|
1076
2224
|
answer = normalize_citations(answer_override) if answer_override.strip() else extract_answer(payload)
|
|
1077
2225
|
sources = align_sources_to_answer(answer, extract_sources(payload))
|
|
1078
2226
|
used = citation_ids(answer)
|
|
1079
|
-
#
|
|
1080
|
-
#
|
|
2227
|
+
# 未引用判定双通道 = JSON 标记(recalled_materials)∪ 正文角标未引用:
|
|
2228
|
+
# 进「未引用」分组,不占角标语义,不参与核验统计。
|
|
1081
2229
|
for s in sources:
|
|
1082
2230
|
if s["id"] not in used:
|
|
1083
2231
|
s["used"] = False
|
|
@@ -1088,6 +2236,8 @@ def render_html(payload: Dict[str, Any], title: str, answer_override: str = "",
|
|
|
1088
2236
|
stage_label = STAGE_LABELS.get(stage, "成稿版")
|
|
1089
2237
|
|
|
1090
2238
|
verification = compute_verification(answer, sources, payload, generated_at)
|
|
2239
|
+
process_stats = compute_process_stats(sources, answer)
|
|
2240
|
+
hot_terms = extract_hot_terms(answer, sources)
|
|
1091
2241
|
citation_warning = ""
|
|
1092
2242
|
if sources and not used:
|
|
1093
2243
|
citation_warning = (
|
|
@@ -1096,21 +2246,31 @@ def render_html(payload: Dict[str, Any], title: str, answer_override: str = "",
|
|
|
1096
2246
|
'请修正答案文件(提纲版 _outline.md / 成稿版 _answer.txt):在关键事实后标注 [1]、[2] 等角标'
|
|
1097
2247
|
'并逐条对应素材清单,然后重新运行 render_trace_html.py 生成核验报告。</div>'
|
|
1098
2248
|
)
|
|
1099
|
-
|
|
2249
|
+
chip_map = build_chip_data(sources)
|
|
2250
|
+
blocks, _ = parse_answer_blocks(answer, {s["id"] for s in sources}, chip_map)
|
|
2251
|
+
# 胶囊内表格数据汇总(span 内静态表格会被解析器拆散,改为页尾 JSON + 展开时 JS 注入)
|
|
2252
|
+
jb_tables: Dict[str, str] = {}
|
|
2253
|
+
for cid, jb in chip_map.items():
|
|
2254
|
+
for key, tbl_html in (jb.pop("_tables", {}) or {}).items():
|
|
2255
|
+
jb_tables[key] = tbl_html
|
|
1100
2256
|
doc_title, sections = group_sections(blocks)
|
|
1101
2257
|
display_title = doc_title or title
|
|
1102
2258
|
report_label = f"{REPORT_NAME}({stage_label})"
|
|
1103
2259
|
kb_zone = render_kb_zone(kb_urls, kb_labels, len(sources))
|
|
1104
2260
|
|
|
1105
|
-
|
|
2261
|
+
jb_tables_json = json.dumps(jb_tables, ensure_ascii=False).replace("</", "<\\/")
|
|
2262
|
+
jb_tables_script = (f'<script type="application/json" id="jb-tables">{jb_tables_json}</script>\n'
|
|
2263
|
+
if jb_tables else "")
|
|
2264
|
+
|
|
1106
2265
|
meta_bits = []
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
meta_bits.append("素材:" + " · ".join(cov_bits))
|
|
2266
|
+
if process_stats["n_searches"]:
|
|
2267
|
+
meta_bits.append(f"深知检索 {process_stats['n_searches']} 次")
|
|
1110
2268
|
if sources:
|
|
1111
|
-
meta_bits.append(f"
|
|
1112
|
-
|
|
1113
|
-
|
|
2269
|
+
meta_bits.append(f"召回材料 {len(sources)} 条")
|
|
2270
|
+
if process_stats["n_cite_marks"]:
|
|
2271
|
+
meta_bits.append(f"正文引用 {process_stats['n_cite_marks']} 处")
|
|
2272
|
+
meta_bits.append(f"生成于 {generated}")
|
|
2273
|
+
meta_line = " · ".join(meta_bits)
|
|
1114
2274
|
|
|
1115
2275
|
return f"""<!doctype html>
|
|
1116
2276
|
<html lang="zh-CN">
|
|
@@ -1118,449 +2278,74 @@ def render_html(payload: Dict[str, Any], title: str, answer_override: str = "",
|
|
|
1118
2278
|
<meta charset="utf-8">
|
|
1119
2279
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
1120
2280
|
<title>{esc(display_title)} · {esc(report_label)}</title>
|
|
1121
|
-
<style>
|
|
1122
|
-
:root{{
|
|
1123
|
-
--navy:#0b1f3a; --ink:#172236; --muted:#667085; --line:#dce4ef; --line-strong:#b9c6d9;
|
|
1124
|
-
--brand:#1559c7; --brand-soft:#e8f0ff;
|
|
1125
|
-
--policy:#0c9b78; --policy-soft:#e2f6ef;
|
|
1126
|
-
--case:#b26a00; --case-soft:#fff4e0;
|
|
1127
|
-
--ref:#4b5563; --ref-soft:#eef1f6;
|
|
1128
|
-
--warn:#b26a00; --danger:#b93939; --ok:#0c9b78;
|
|
1129
|
-
}}
|
|
1130
|
-
*{{box-sizing:border-box}}
|
|
1131
|
-
body{{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;
|
|
1132
|
-
color:var(--ink);background:#f4f7fb;line-height:1.75;font-size:14.5px}}
|
|
1133
|
-
a{{color:var(--brand)}}
|
|
1134
|
-
.topbar{{position:sticky;top:0;z-index:10;display:flex;justify-content:space-between;align-items:center;gap:10px;
|
|
1135
|
-
padding:10px 22px;background:var(--navy);color:#fff;font-size:13px}}
|
|
1136
|
-
.topbar .tb-title{{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}}
|
|
1137
|
-
.topbar .tags{{display:flex;align-items:center;gap:6px;flex:none}}
|
|
1138
|
-
.topbar .tags span{{padding:2px 10px;border:1px solid rgba(255,255,255,.3);border-radius:999px;font-size:11.5px}}
|
|
1139
|
-
.layout{{display:grid;grid-template-columns:minmax(0,760px) minmax(340px,420px);gap:26px;
|
|
1140
|
-
max-width:1240px;margin:0 auto;padding:26px 18px 60px}}
|
|
1141
|
-
/* 左栏 */
|
|
1142
|
-
.report{{min-width:0}}
|
|
1143
|
-
.r-head{{padding:22px 26px;background:#fff;border:1px solid var(--line);border-radius:12px;margin-bottom:16px;text-align:center}}
|
|
1144
|
-
.r-badge{{display:inline-flex;align-items:center;gap:14px;margin:0 0 6px;color:var(--navy);
|
|
1145
|
-
font-size:16px;font-weight:800;letter-spacing:7px;text-indent:7px;line-height:1.5}}
|
|
1146
|
-
.r-badge::before,.r-badge::after{{content:"";width:64px;border-top:1px solid var(--line-strong)}}
|
|
1147
|
-
.r-head h1{{margin:0 0 8px;font-size:22px;color:var(--navy);line-height:1.5}}
|
|
1148
|
-
.r-head .sub{{color:var(--muted);font-size:12.5px}}
|
|
1149
|
-
.warn-box{{margin:0 0 16px;padding:13px 16px;border:1.5px solid var(--danger);border-radius:10px;
|
|
1150
|
-
background:#fdf3f3;color:#8f2626;font-size:13.5px;line-height:1.7}}
|
|
1151
|
-
.verify{{margin:0 0 16px;background:#fff;border:1px solid #bfe5d6;border-radius:12px;padding:16px 20px}}
|
|
1152
|
-
.verify.fail{{border-color:#f2c4c4;background:#fffafa}}
|
|
1153
|
-
.v-head{{display:flex;align-items:center;gap:9px;font-size:15px;font-weight:800;color:var(--ok)}}
|
|
1154
|
-
.verify.fail .v-head{{color:var(--danger)}}
|
|
1155
|
-
.v-shield{{display:inline-flex;width:22px;height:22px;border-radius:50%;background:var(--ok);color:#fff;
|
|
1156
|
-
align-items:center;justify-content:center;font-size:12px;flex:none}}
|
|
1157
|
-
.verify.fail .v-shield{{background:var(--danger)}}
|
|
1158
|
-
.v-stamp{{margin-left:auto;font-size:11px;border:1.5px solid var(--ok);color:var(--ok);border-radius:5px;
|
|
1159
|
-
padding:1px 8px;letter-spacing:2px;flex:none}}
|
|
1160
|
-
.v-stamp.bad{{border-color:var(--danger);color:var(--danger)}}
|
|
1161
|
-
.v-reasons{{margin-top:6px;font-size:12.5px;color:var(--danger)}}
|
|
1162
|
-
.v-grid{{display:grid;grid-template-columns:1fr 1fr;gap:4px 20px;margin-top:10px}}
|
|
1163
|
-
.vi{{display:flex;gap:7px;align-items:baseline;font-size:12.5px;color:#35445c;line-height:1.7;min-width:0}}
|
|
1164
|
-
.vi .s{{font-weight:800;flex:none}}
|
|
1165
|
-
.vi .s.ok{{color:var(--ok)}}
|
|
1166
|
-
.vi .s.warn{{color:var(--warn)}}
|
|
1167
|
-
.vi .s.fail{{color:var(--danger)}}
|
|
1168
|
-
.vi .s.man{{color:var(--case)}}
|
|
1169
|
-
.vi .s.none{{color:var(--muted)}}
|
|
1170
|
-
.vi .d{{color:var(--muted);min-width:0}}
|
|
1171
|
-
.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}}
|
|
1172
|
-
/* 正文章节卡 */
|
|
1173
|
-
.doc-sec{{background:#fff;border:1px solid var(--line);border-radius:12px;padding:20px 24px;margin-bottom:16px}}
|
|
1174
|
-
.sec-head{{display:flex;align-items:center;gap:9px;flex-wrap:wrap;margin-bottom:10px;
|
|
1175
|
-
padding-bottom:10px;border-bottom:1px solid var(--line)}}
|
|
1176
|
-
.sec-no{{display:inline-flex;width:26px;height:26px;border-radius:7px;background:var(--brand);color:#fff;
|
|
1177
|
-
align-items:center;justify-content:center;font-size:13.5px;font-weight:700;flex:none}}
|
|
1178
|
-
.sec-head h3{{margin:0;font-size:16.5px;color:var(--navy);line-height:1.5}}
|
|
1179
|
-
.sec-badge{{margin-left:auto;font-size:11.5px;color:var(--ok);background:var(--policy-soft);
|
|
1180
|
-
border-radius:6px;padding:2px 9px;font-weight:700;flex:none}}
|
|
1181
|
-
.sec-badge.bad{{color:var(--danger);background:#fdecea}}
|
|
1182
|
-
.doc-sub{{margin:16px 0 8px;color:var(--navy);font-size:14.5px;font-weight:700}}
|
|
1183
|
-
h5.doc-sub{{font-size:13.5px}}
|
|
1184
|
-
.doc-block,.doc-item{{margin:0 0 12px}}
|
|
1185
|
-
.doc-block p,.doc-item p{{margin:0;font-size:14px;line-height:1.9}}
|
|
1186
|
-
.doc-item{{display:grid;grid-template-columns:22px minmax(0,1fr);gap:8px}}
|
|
1187
|
-
.doc-item.numbered{{grid-template-columns:28px minmax(0,1fr)}}
|
|
1188
|
-
.doc-bullet{{padding-top:1px;color:#111827;font-size:15px;line-height:1.85}}
|
|
1189
|
-
.doc-divider{{border:0;border-top:1px solid var(--line);margin:18px 0}}
|
|
1190
|
-
code{{padding:1px 5px;border-radius:4px;background:#f3f4f6;color:#374151;
|
|
1191
|
-
font-family:ui-monospace,Menlo,Consolas,monospace;font-size:12px}}
|
|
1192
|
-
.tbl-wrap{{max-width:100%;overflow-x:auto;margin:8px 0}}
|
|
1193
|
-
.data-tbl{{width:100%;border-collapse:collapse;border:1px solid var(--line);font-size:13px}}
|
|
1194
|
-
.data-tbl th,.data-tbl td{{border:1px solid var(--line);padding:8px 10px;text-align:left;vertical-align:top;line-height:1.65}}
|
|
1195
|
-
.data-tbl th{{background:#f2f5fb;font-weight:700;color:#374151;white-space:nowrap}}
|
|
1196
|
-
.data-tbl tbody tr:nth-child(even) td{{background:#fafbfd}}
|
|
1197
|
-
.data-tbl.wide{{min-width:560px}}
|
|
1198
|
-
.data-tbl td .ev-row{{margin:4px 0 0}}
|
|
1199
|
-
/* 角标 */
|
|
1200
|
-
.cite{{margin:0 1px;padding:0 5px;border:0;border-radius:4px;background:var(--brand-soft);color:var(--brand);
|
|
1201
|
-
font-weight:800;font-size:10.5px;cursor:pointer;vertical-align:super;font-family:monospace}}
|
|
1202
|
-
.cite:hover,.cite:focus-visible{{background:var(--brand);color:#fff;outline:none}}
|
|
1203
|
-
.cite.unresolved{{background:#fdecea;color:var(--danger)}}
|
|
1204
|
-
/* 段落级证据 chips */
|
|
1205
|
-
.ev-row{{display:flex;flex-wrap:wrap;gap:6px;margin:6px 0 2px}}
|
|
1206
|
-
.ev-chip{{max-width:100%}}
|
|
1207
|
-
.ev-chip summary{{display:inline-flex;align-items:center;max-width:100%;border-radius:999px;padding:3px 10px;
|
|
1208
|
-
color:#4b5563;background:#f3f4f6;cursor:pointer;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
|
|
1209
|
-
list-style:none;font-size:11.5px}}
|
|
1210
|
-
.ev-chip summary::-webkit-details-marker{{display:none}}
|
|
1211
|
-
.ev-chip summary::after{{content:"核验";margin-left:7px;color:#9ca3af;font-size:10.5px}}
|
|
1212
|
-
.ev-chip[open] summary::after{{content:"收起"}}
|
|
1213
|
-
.ev-chip summary b{{color:var(--brand);margin-right:5px}}
|
|
1214
|
-
.ev-panel{{margin:7px 0 6px;padding:12px 14px;border:1px solid var(--line);border-radius:9px;background:#fbfcfe;
|
|
1215
|
-
box-shadow:0 8px 24px rgba(15,23,42,.06)}}
|
|
1216
|
-
.ev-title{{font-weight:700;font-size:13.5px;margin-bottom:4px;color:var(--navy)}}
|
|
1217
|
-
.ev-meta{{color:var(--muted);font-size:12px;margin-bottom:6px}}
|
|
1218
|
-
.ev-panel p{{margin:0 0 8px;color:#374151;font-size:12.8px;line-height:1.7}}
|
|
1219
|
-
.sc-links{{display:flex;flex-wrap:wrap;gap:8px;margin-top:6px}}
|
|
1220
|
-
.sc-links span{{display:inline-flex}}
|
|
1221
|
-
.sc-links a{{display:inline-flex;align-items:center;min-height:24px;padding:3px 9px;border-radius:6px;
|
|
1222
|
-
background:var(--brand-soft);color:var(--brand);font-weight:700;text-decoration:none;font-size:12px}}
|
|
1223
|
-
/* 右栏 核验材料 */
|
|
1224
|
-
.sources{{position:sticky;top:56px;align-self:start;max-height:calc(100vh - 76px);overflow:auto;
|
|
1225
|
-
background:#fff;border:1px solid var(--line);border-radius:12px;padding:16px 18px}}
|
|
1226
|
-
.sources h3{{margin:0 0 3px;font-size:15px;color:var(--navy)}}
|
|
1227
|
-
.src-tip{{font-size:11.5px;color:var(--muted);margin-bottom:10px}}
|
|
1228
|
-
.filters{{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:8px}}
|
|
1229
|
-
.filters button{{border:1px solid var(--line);border-radius:999px;background:#fff;color:var(--muted);
|
|
1230
|
-
padding:3px 11px;font-size:12px;cursor:pointer}}
|
|
1231
|
-
.filters button.on{{background:var(--brand);border-color:var(--brand);color:#fff;font-weight:700}}
|
|
1232
|
-
.src-search{{width:100%;padding:7px 10px;border:1px solid var(--line);border-radius:7px;font-size:12.5px;margin-bottom:12px}}
|
|
1233
|
-
.scard{{border:1px solid var(--line);border-left-width:3px;border-radius:10px;padding:11px 13px;margin-bottom:10px;
|
|
1234
|
-
background:#fff;transition:box-shadow .25s}}
|
|
1235
|
-
.scard.pol{{border-left-color:var(--policy)}}
|
|
1236
|
-
.scard.dat{{border-left-color:var(--brand)}}
|
|
1237
|
-
.scard.cas{{border-left-color:var(--case)}}
|
|
1238
|
-
.scard.ref,.scard.mat{{border-left-color:var(--ref)}}
|
|
1239
|
-
.scard.hl{{box-shadow:0 0 0 3px var(--brand)}}
|
|
1240
|
-
.scard.hide{{display:none}}
|
|
1241
|
-
.sc-head{{display:flex;align-items:center;gap:7px;margin-bottom:4px}}
|
|
1242
|
-
.sc-id{{font-family:monospace;font-weight:800;font-size:11px;color:var(--brand);background:var(--brand-soft);
|
|
1243
|
-
border-radius:4px;padding:1px 7px}}
|
|
1244
|
-
.sc-type{{font-size:11px;font-weight:700;border-radius:4px;padding:1px 8px;background:var(--ref-soft);color:var(--ref)}}
|
|
1245
|
-
.scard.pol .sc-type{{background:var(--policy-soft);color:var(--policy)}}
|
|
1246
|
-
.scard.dat .sc-type{{background:var(--brand-soft);color:var(--brand)}}
|
|
1247
|
-
.scard.cas .sc-type{{background:var(--case-soft);color:var(--case)}}
|
|
1248
|
-
.sc-vk{{margin-left:auto;font-size:11px;font-weight:800;color:var(--ok)}}
|
|
1249
|
-
.sc-vk.warn{{color:var(--warn)}}
|
|
1250
|
-
.scard h4{{margin:0 0 4px;font-size:13px;color:var(--navy);line-height:1.55}}
|
|
1251
|
-
.sc-meta{{font-size:11.5px;color:var(--muted)}}
|
|
1252
|
-
.sc-section{{font-size:11.5px;color:var(--brand);margin-top:3px;font-weight:600}}
|
|
1253
|
-
.sc-vnote{{margin-top:5px;font-size:11.3px;color:var(--ok);line-height:1.6}}
|
|
1254
|
-
.sc-excerpt{{margin:7px 0;padding:9px 10px;border-radius:7px;background:#f8fafc;color:#42566f;font-size:12px;line-height:1.7;
|
|
1255
|
-
display:-webkit-box;-webkit-line-clamp:4;-webkit-box-orient:vertical;overflow:hidden;cursor:pointer}}
|
|
1256
|
-
.scard.open .sc-excerpt{{display:block;-webkit-line-clamp:unset}}
|
|
1257
|
-
.sc-excerpt.rich{{overflow-x:auto}}
|
|
1258
|
-
.sc-excerpt.rich table{{width:max-content;min-width:100%;border-collapse:collapse;background:#fff;font-size:12px}}
|
|
1259
|
-
.sc-excerpt.rich td,.sc-excerpt.rich th{{min-width:92px;max-width:220px;padding:7px 8px;border:1px solid var(--line);
|
|
1260
|
-
vertical-align:top;word-break:break-word}}
|
|
1261
|
-
.sc-excerpt.rich thead td,.sc-excerpt.rich th{{background:#f3f4f6;color:#374151;font-weight:700}}
|
|
1262
|
-
.scard .sc-links a{{font-size:12px}}
|
|
1263
|
-
.scard .sc-links{{margin-top:4px}}
|
|
1264
|
-
.no-link{{font-size:11.5px;color:var(--muted)}}
|
|
1265
|
-
.sc-unused{{font-size:10.5px;font-weight:800;color:var(--muted);background:#eef1f6;border-radius:4px;
|
|
1266
|
-
padding:1px 7px;flex:none}}
|
|
1267
|
-
.sc-conf{{font-size:10.5px;font-weight:800;color:#8a5a00;background:var(--case-soft);border:1px solid #e8c98a;
|
|
1268
|
-
border-radius:4px;padding:0 7px;flex:none}}
|
|
1269
|
-
.sc-extag{{margin-top:8px;padding-top:7px;border-top:1px dashed var(--line-strong);font-size:11px;color:#0b6e4f;font-weight:700}}
|
|
1270
|
-
.sc-chain{{font-size:11.5px;color:var(--brand);margin-top:3px;font-weight:600;line-height:1.6;cursor:help}}
|
|
1271
|
-
.sc-more{{display:none;margin:-3px 2px 4px;text-align:right;font-size:11px;color:var(--brand);font-weight:700;cursor:pointer;user-select:none}}
|
|
1272
|
-
.scard.clampable .sc-more{{display:block}}
|
|
1273
|
-
.scard.clampable .sc-more::before{{content:"展开全文 ▾"}}
|
|
1274
|
-
.scard.clampable.open .sc-more::before{{content:"收起 ▴"}}
|
|
1275
|
-
.uncited-group{{margin-top:12px;border-top:1px dashed var(--line-strong);padding-top:10px}}
|
|
1276
|
-
.ug-title{{font-size:12.5px;color:var(--muted);font-weight:700;line-height:1.6}}
|
|
1277
|
-
.uncited-group .uncited-list{{margin-top:10px}}
|
|
1278
|
-
/* 知识专库 */
|
|
1279
|
-
.kb-zone{{margin-top:14px;border-top:1px dashed var(--line-strong);padding-top:12px}}
|
|
1280
|
-
.kb-title{{font-size:12.5px;font-weight:800;color:var(--navy)}}
|
|
1281
|
-
.kb-desc{{font-size:11.3px;color:var(--muted);line-height:1.65;margin:3px 0 8px}}
|
|
1282
|
-
.kb-list{{display:flex;flex-direction:column;gap:7px}}
|
|
1283
|
-
.kb-chip{{display:flex;align-items:center;gap:8px;padding:7px 10px;border:1px solid var(--line);border-radius:8px;
|
|
1284
|
-
background:#fbfcfe;text-decoration:none;font-size:11.5px}}
|
|
1285
|
-
.kb-chip:hover{{border-color:var(--brand);background:var(--brand-soft)}}
|
|
1286
|
-
.kb-label{{font-weight:700;color:#374151;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}}
|
|
1287
|
-
.kb-count{{padding-left:8px;border-left:1px solid var(--line);color:var(--muted);white-space:nowrap}}
|
|
1288
|
-
.kb-arrow{{margin-left:auto;color:var(--brand);font-weight:700;white-space:nowrap}}
|
|
1289
|
-
.empty{{color:var(--muted)}}
|
|
1290
|
-
.foot{{text-align:center;color:var(--muted);font-size:11.5px;padding:16px 0 4px;line-height:1.8}}
|
|
1291
|
-
.mobile-nav{{display:none}}
|
|
1292
|
-
.back-doc{{display:none}}
|
|
1293
|
-
/* 移动端材料底部弹层:点角标就地弹出材料卡,不跳转打断阅读 */
|
|
1294
|
-
.sheet-mask{{display:none}}
|
|
1295
|
-
.sheet{{display:none}}
|
|
1296
|
-
@media (max-width:680px){{
|
|
1297
|
-
body{{font-size:14px;line-height:1.8}}
|
|
1298
|
-
.layout{{grid-template-columns:1fr;padding:12px 10px 40px;gap:14px}}
|
|
1299
|
-
.topbar{{padding:8px 12px;font-size:12px;gap:4px;flex-wrap:wrap}}
|
|
1300
|
-
.topbar .tags span{{font-size:10.5px;padding:1px 8px;margin-left:4px}}
|
|
1301
|
-
.r-head{{padding:16px 14px;border-radius:10px}}
|
|
1302
|
-
.r-badge{{font-size:13.5px;letter-spacing:6px;text-indent:6px;gap:10px}}
|
|
1303
|
-
.r-badge::before,.r-badge::after{{width:40px}}
|
|
1304
|
-
.r-head h1{{font-size:18px}}
|
|
1305
|
-
.r-head .sub{{font-size:11.5px;line-height:1.6}}
|
|
1306
|
-
.verify{{padding:13px 14px;border-radius:10px}}
|
|
1307
|
-
.v-head{{font-size:14px}}
|
|
1308
|
-
.v-grid{{grid-template-columns:1fr;gap:2px 0}}
|
|
1309
|
-
.vi{{flex-wrap:wrap;gap:4px 8px}}
|
|
1310
|
-
.vi .d{{min-width:0}}
|
|
1311
|
-
.warn-box{{font-size:12.5px;padding:11px 12px}}
|
|
1312
|
-
.doc-sec{{padding:14px;border-radius:10px}}
|
|
1313
|
-
.sec-no{{width:22px;height:22px;font-size:12px;border-radius:6px}}
|
|
1314
|
-
.sec-head{{gap:7px;padding-bottom:8px;margin-bottom:8px}}
|
|
1315
|
-
.sec-head h3{{font-size:15px}}
|
|
1316
|
-
.sec-badge{{margin-left:0;font-size:11px}}
|
|
1317
|
-
.doc-block p,.doc-item p{{font-size:13.5px;line-height:1.95}}
|
|
1318
|
-
.doc-sub{{font-size:14px;margin:12px 0 6px}}
|
|
1319
|
-
.data-tbl{{font-size:12px}}
|
|
1320
|
-
.data-tbl th,.data-tbl td{{padding:6px 7px;line-height:1.55}}
|
|
1321
|
-
.cite{{font-size:11px;padding:0 4px}}
|
|
1322
|
-
.ev-chip summary{{font-size:11px}}
|
|
1323
|
-
.sources{{padding:12px;border-radius:10px}}
|
|
1324
|
-
.scard{{padding:10px 11px}}
|
|
1325
|
-
.sc-excerpt{{font-size:11.5px}}
|
|
1326
|
-
.kb-chip{{flex-wrap:wrap}}
|
|
1327
|
-
.kb-label{{white-space:normal}}
|
|
1328
|
-
.mobile-nav{{display:block;margin:0 0 14px;padding:11px 14px;border:1.5px solid var(--brand);
|
|
1329
|
-
border-radius:10px;background:var(--brand-soft);color:var(--brand);font-weight:800;
|
|
1330
|
-
font-size:13.5px;text-decoration:none;text-align:center}}
|
|
1331
|
-
.back-doc{{display:inline-block;margin:0 0 8px;font-size:12px;color:var(--brand);
|
|
1332
|
-
font-weight:700;text-decoration:none}}
|
|
1333
|
-
.sheet-mask{{display:block;position:fixed;inset:0;background:rgba(11,31,58,.45);z-index:99;opacity:0;
|
|
1334
|
-
pointer-events:none;transition:opacity .2s}}
|
|
1335
|
-
.sheet-mask.show{{opacity:1;pointer-events:auto}}
|
|
1336
|
-
.sheet{{display:block;position:fixed;left:0;right:0;bottom:0;z-index:100;background:#fff;
|
|
1337
|
-
border-radius:14px 14px 0 0;box-shadow:0 -8px 30px rgba(11,31,58,.25);
|
|
1338
|
-
max-height:68vh;overflow-y:auto;-webkit-overflow-scrolling:touch;
|
|
1339
|
-
padding:10px 16px 22px;transform:translateY(105%);transition:transform .25s ease}}
|
|
1340
|
-
.sheet.show{{transform:translateY(0)}}
|
|
1341
|
-
.sheet-grab{{width:38px;height:4px;border-radius:2px;background:#c9d4e2;margin:2px auto 8px}}
|
|
1342
|
-
.sheet-head{{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px}}
|
|
1343
|
-
.sheet-head b{{font-size:13.5px;color:var(--navy)}}
|
|
1344
|
-
.sheet-close{{border:1px solid var(--line);background:#f5f8fc;border-radius:8px;color:#3b4a61;
|
|
1345
|
-
font-size:12.5px;font-weight:700;padding:5px 14px;cursor:pointer}}
|
|
1346
|
-
.sheet .scard{{box-shadow:none;margin-bottom:0}}
|
|
1347
|
-
.sheet .sc-excerpt{{display:block;-webkit-line-clamp:unset;cursor:auto}}
|
|
1348
|
-
/* 正文表述 ↔ 原文原段 对照区(弹层顶部) */
|
|
1349
|
-
.cmp{{margin:0 0 10px;border:1px solid var(--line);border-radius:10px;overflow:hidden}}
|
|
1350
|
-
.cmp-tag{{font-size:11px;font-weight:800;padding:3px 10px}}
|
|
1351
|
-
.cmp-side{{padding:9px 12px;font-size:12.8px;line-height:1.7}}
|
|
1352
|
-
.cmp-side p{{margin:0}}
|
|
1353
|
-
.cmp-ai{{background:#fbfcfe;color:#374151}}
|
|
1354
|
-
.cmp-ai .cmp-tag{{background:#eef1f6;color:var(--ref)}}
|
|
1355
|
-
.cmp-src{{background:#f4faf7;color:#2f4a3e;border-top:1px dashed var(--line-strong)}}
|
|
1356
|
-
.cmp-src .cmp-tag{{background:var(--policy-soft);color:#0b6e4f}}
|
|
1357
|
-
.cmp-src .sc-excerpt{{display:block;-webkit-line-clamp:unset;background:#fff;cursor:auto;font-size:12px;padding:8px 10px;margin:0}}
|
|
1358
|
-
}}
|
|
1359
|
-
@media (max-width:1020px){{
|
|
1360
|
-
.layout{{grid-template-columns:1fr}}
|
|
1361
|
-
.sources{{position:static;max-height:none}}
|
|
1362
|
-
}}
|
|
1363
|
-
@media print{{
|
|
1364
|
-
.topbar,.filters,.src-search{{display:none!important}}
|
|
1365
|
-
.layout{{grid-template-columns:1fr;max-width:none;padding:0;gap:14px}}
|
|
1366
|
-
body{{background:#fff;font-size:12.5px}}
|
|
1367
|
-
.sources{{position:static;max-height:none;border:0;padding:0;overflow:visible}}
|
|
1368
|
-
.r-head,.verify,.doc-sec{{border-color:#bbb;box-shadow:none;break-inside:avoid}}
|
|
1369
|
-
.sc-excerpt{{display:block;-webkit-line-clamp:unset;cursor:auto}}
|
|
1370
|
-
.uncited-group[open] .uncited-list,.uncited-group{{break-inside:avoid}}
|
|
1371
|
-
.scard{{break-inside:avoid}}
|
|
1372
|
-
.cite{{background:#eee;color:#333}}
|
|
1373
|
-
}}
|
|
1374
|
-
</style>
|
|
2281
|
+
<style>{PAGE_CSS}</style>
|
|
1375
2282
|
</head>
|
|
1376
2283
|
<body>
|
|
1377
2284
|
|
|
1378
2285
|
<header class="topbar">
|
|
1379
|
-
<div class="tb-
|
|
1380
|
-
|
|
1381
|
-
<span
|
|
1382
|
-
<span>素材来源:深知可信搜索</span>
|
|
2286
|
+
<div class="tb-left">
|
|
2287
|
+
<span class="tb-stamp">{esc(REPORT_NAME)}</span>
|
|
2288
|
+
<span class="tb-title">{esc(display_title)}</span>
|
|
1383
2289
|
</div>
|
|
2290
|
+
<div class="tb-right">
|
|
2291
|
+
<div class="view-switch" role="tablist" aria-label="视图切换">
|
|
2292
|
+
<button class="on" data-view="report" type="button">核验报告</button>
|
|
2293
|
+
<button data-view="library" type="button">材料专库</button>
|
|
2294
|
+
</div>
|
|
2295
|
+
<div class="tb-tools">
|
|
2296
|
+
<button id="btn-reading" type="button" aria-pressed="false" title="隐藏核验元素,纯阅读正文">只看正文</button>
|
|
2297
|
+
<button id="btn-copy" type="button" title="复制正文纯文本">复制全文</button>
|
|
2298
|
+
<span class="print-menu">
|
|
2299
|
+
<button id="btn-print" type="button" aria-haspopup="true" title="浏览器打印/另存为 PDF">打印归档 ▾</button>
|
|
2300
|
+
<span class="print-drop" id="print-drop" hidden>
|
|
2301
|
+
<button id="print-body" type="button">只打印正文</button>
|
|
2302
|
+
<button id="print-full" type="button">完整归档(含核验材料)</button>
|
|
2303
|
+
</span>
|
|
2304
|
+
</span>
|
|
2305
|
+
</div>
|
|
2306
|
+
</div>
|
|
2307
|
+
<div class="progress" aria-hidden="true"><i></i></div>
|
|
1384
2308
|
</header>
|
|
1385
2309
|
|
|
1386
|
-
<div class="
|
|
1387
|
-
<
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
2310
|
+
<div class="hero">
|
|
2311
|
+
<div class="r-badge">{esc(report_label)}</div>
|
|
2312
|
+
<h1>{esc(display_title)}</h1>
|
|
2313
|
+
<div class="meta">{esc(meta_line)} | 素材来源:深知可信搜索</div>
|
|
2314
|
+
<div class="hero-switch">
|
|
2315
|
+
<div class="view-switch" role="tablist" aria-label="视图切换">
|
|
2316
|
+
<button class="on" data-view="report" type="button">核验报告</button>
|
|
2317
|
+
<button data-view="library" type="button">材料专库({len(sources)})</button>
|
|
1392
2318
|
</div>
|
|
2319
|
+
</div>
|
|
2320
|
+
</div>
|
|
2321
|
+
|
|
2322
|
+
<div class="app container" data-view="report">
|
|
2323
|
+
{render_process_bar(process_stats, verification)}
|
|
2324
|
+
|
|
2325
|
+
<main class="view" id="view-report" aria-label="核验报告正文">
|
|
1393
2326
|
{citation_warning}
|
|
1394
2327
|
{render_verify_panel(verification, stage)}
|
|
1395
|
-
<
|
|
2328
|
+
<div class="doc-paper">
|
|
1396
2329
|
{render_section_cards(sections, sources)}
|
|
1397
|
-
|
|
2330
|
+
</div>
|
|
2331
|
+
<div class="foot">深知可信PPT · 溯源核验报告 | 内容由 AI 生成,仅供参考,政策现行效力以官方发布为准</div>
|
|
1398
2332
|
</main>
|
|
1399
|
-
|
|
2333
|
+
|
|
2334
|
+
{render_library_view(sources, hot_terms, kb_zone)}
|
|
2335
|
+
{render_print_appendix(sources)}
|
|
1400
2336
|
</div>
|
|
1401
2337
|
|
|
1402
|
-
|
|
2338
|
+
{render_toc(sections)}
|
|
2339
|
+
|
|
2340
|
+
<div class="ev-panel" id="ev-pop" hidden></div>
|
|
2341
|
+
{jb_tables_script}<div class="sheet-mask" aria-hidden="true"></div>
|
|
1403
2342
|
<div class="sheet" role="dialog" aria-label="核验材料">
|
|
1404
2343
|
<div class="sheet-grab"></div>
|
|
1405
2344
|
<div class="sheet-head"><b>依据对照</b><button class="sheet-close" type="button">收起</button></div>
|
|
1406
2345
|
<div class="sheet-body"></div>
|
|
1407
2346
|
</div>
|
|
1408
2347
|
|
|
1409
|
-
<script>
|
|
1410
|
-
(function () {{
|
|
1411
|
-
"use strict";
|
|
1412
|
-
var cards = Array.prototype.slice.call(document.querySelectorAll(".scard"));
|
|
1413
|
-
var byId = {{}};
|
|
1414
|
-
cards.forEach(function (c) {{
|
|
1415
|
-
var id = c.getAttribute("data-cite-id");
|
|
1416
|
-
if (id) byId[id] = c;
|
|
1417
|
-
}});
|
|
1418
|
-
|
|
1419
|
-
/* 移动端底部弹层:点角标就地展示材料卡,不打断正文阅读 */
|
|
1420
|
-
var sheet = document.querySelector(".sheet");
|
|
1421
|
-
var mask = document.querySelector(".sheet-mask");
|
|
1422
|
-
function isMobile() {{
|
|
1423
|
-
return window.matchMedia("(max-width:680px)").matches;
|
|
1424
|
-
}}
|
|
1425
|
-
function escHtml(s) {{
|
|
1426
|
-
var d = document.createElement("div");
|
|
1427
|
-
d.textContent = s;
|
|
1428
|
-
return d.innerHTML;
|
|
1429
|
-
}}
|
|
1430
|
-
function sentenceOf(el) {{
|
|
1431
|
-
var para = el && el.closest ? el.closest(".doc-block,.doc-item") : null;
|
|
1432
|
-
return para && para.querySelector("p") ? para.querySelector("p").innerText.trim() : "";
|
|
1433
|
-
}}
|
|
1434
|
-
function openSheet(card, sentence) {{
|
|
1435
|
-
if (!sheet) return;
|
|
1436
|
-
var body = sheet.querySelector(".sheet-body");
|
|
1437
|
-
body.innerHTML = "";
|
|
1438
|
-
if (sentence) {{
|
|
1439
|
-
var excerpt = card.querySelector(".sc-excerpt");
|
|
1440
|
-
var cmp = document.createElement("div");
|
|
1441
|
-
cmp.className = "cmp";
|
|
1442
|
-
cmp.innerHTML =
|
|
1443
|
-
'<div class="cmp-side cmp-ai"><div class="cmp-tag">正文表述(AI 生成)</div><p>' + escHtml(sentence) + '</p></div>' +
|
|
1444
|
-
'<div class="cmp-side cmp-src"><div class="cmp-tag">原文原段(非 AI 生成)</div>' +
|
|
1445
|
-
'<div class="sc-excerpt">' + (excerpt ? excerpt.innerHTML : "") + '</div></div>';
|
|
1446
|
-
body.appendChild(cmp);
|
|
1447
|
-
}}
|
|
1448
|
-
var clone = card.cloneNode(true);
|
|
1449
|
-
clone.removeAttribute("id");
|
|
1450
|
-
clone.classList.remove("hide");
|
|
1451
|
-
clone.classList.add("open");
|
|
1452
|
-
var sheetMore = clone.querySelector(".sc-more");
|
|
1453
|
-
if (sheetMore) sheetMore.remove();
|
|
1454
|
-
body.appendChild(clone);
|
|
1455
|
-
sheet.classList.add("show");
|
|
1456
|
-
mask.classList.add("show");
|
|
1457
|
-
document.body.style.overflow = "hidden";
|
|
1458
|
-
sheet.scrollTop = 0;
|
|
1459
|
-
}}
|
|
1460
|
-
function closeSheet() {{
|
|
1461
|
-
if (!sheet) return;
|
|
1462
|
-
sheet.classList.remove("show");
|
|
1463
|
-
mask.classList.remove("show");
|
|
1464
|
-
document.body.style.overflow = "";
|
|
1465
|
-
}}
|
|
1466
|
-
if (sheet && mask) {{
|
|
1467
|
-
mask.addEventListener("click", closeSheet);
|
|
1468
|
-
var closeBtn = sheet.querySelector(".sheet-close");
|
|
1469
|
-
if (closeBtn) closeBtn.addEventListener("click", closeSheet);
|
|
1470
|
-
}}
|
|
1471
|
-
|
|
1472
|
-
/* 角标 → 来源卡:精确 ID 匹配,缺失即红色警示,绝不按位置猜测。
|
|
1473
|
-
手机单栏下不滚动定位(会跳到页面底部打断阅读),改为底部弹层就地查看。 */
|
|
1474
|
-
document.querySelectorAll(".data-cite,[data-cite]").forEach(function (btn) {{
|
|
1475
|
-
if (btn.classList.contains("sheet-close")) return;
|
|
1476
|
-
btn.addEventListener("click", function () {{
|
|
1477
|
-
var card = byId[btn.getAttribute("data-cite")];
|
|
1478
|
-
if (!card) {{
|
|
1479
|
-
btn.classList.add("unresolved");
|
|
1480
|
-
if (console.error) console.error("[核验] 未绑定角标:", btn.getAttribute("data-cite"));
|
|
1481
|
-
return;
|
|
1482
|
-
}}
|
|
1483
|
-
if (isMobile()) {{
|
|
1484
|
-
openSheet(card, sentenceOf(btn));
|
|
1485
|
-
return;
|
|
1486
|
-
}}
|
|
1487
|
-
card.classList.remove("hide", "open");
|
|
1488
|
-
card.classList.add("hl", "open");
|
|
1489
|
-
card.scrollIntoView({{ block: "center", behavior: "smooth" }});
|
|
1490
|
-
setTimeout(function () {{ card.classList.remove("hl"); }}, 2200);
|
|
1491
|
-
}});
|
|
1492
|
-
}});
|
|
1493
|
-
|
|
1494
|
-
/* 摘录折叠:按渲染实测高度判断是否截断(超 4 行),仅实际截断的卡片显示「展开全文」;
|
|
1495
|
-
点摘录或「展开全文」切换;展开时滚动回卡片顶部。 */
|
|
1496
|
-
cards.forEach(function (c) {{
|
|
1497
|
-
var ex = c.querySelector(".sc-excerpt");
|
|
1498
|
-
if (!ex) return;
|
|
1499
|
-
if (ex.scrollHeight > ex.clientHeight + 4) c.classList.add("clampable");
|
|
1500
|
-
function toggleExcerpt() {{ c.classList.toggle("open"); }}
|
|
1501
|
-
ex.addEventListener("click", function (e) {{
|
|
1502
|
-
if (e.target.closest("a")) return;
|
|
1503
|
-
toggleExcerpt();
|
|
1504
|
-
}});
|
|
1505
|
-
var more = c.querySelector(".sc-more");
|
|
1506
|
-
if (more) {{
|
|
1507
|
-
more.addEventListener("click", toggleExcerpt);
|
|
1508
|
-
more.addEventListener("keydown", function (e) {{
|
|
1509
|
-
if (e.key === "Enter" || e.key === " ") {{ e.preventDefault(); toggleExcerpt(); }}
|
|
1510
|
-
}});
|
|
1511
|
-
}}
|
|
1512
|
-
}});
|
|
1513
|
-
|
|
1514
|
-
/* 证据 chips(灰框):桌面端点击就地展开并高亮右栏来源卡;手机端不就地展开,点击直接弹出底部材料弹层 */
|
|
1515
|
-
document.querySelectorAll(".ev-chip").forEach(function (chip) {{
|
|
1516
|
-
var summary = chip.querySelector("summary");
|
|
1517
|
-
if (summary) {{
|
|
1518
|
-
summary.addEventListener("click", function (e) {{
|
|
1519
|
-
if (isMobile()) {{
|
|
1520
|
-
e.preventDefault();
|
|
1521
|
-
var card = byId[chip.getAttribute("data-cite")];
|
|
1522
|
-
if (card) openSheet(card, sentenceOf(chip));
|
|
1523
|
-
return;
|
|
1524
|
-
}}
|
|
1525
|
-
var y = window.scrollY;
|
|
1526
|
-
var restore = function () {{ window.scrollTo(0, y); }};
|
|
1527
|
-
requestAnimationFrame(function () {{ restore(); requestAnimationFrame(restore); }});
|
|
1528
|
-
}});
|
|
1529
|
-
}}
|
|
1530
|
-
chip.addEventListener("toggle", function () {{
|
|
1531
|
-
if (!chip.open || isMobile()) return;
|
|
1532
|
-
var card = byId[chip.getAttribute("data-cite")];
|
|
1533
|
-
if (!card) return;
|
|
1534
|
-
cards.forEach(function (c) {{ c.classList.remove("hl"); }});
|
|
1535
|
-
card.classList.add("hl");
|
|
1536
|
-
setTimeout(function () {{ card.classList.remove("hl"); }}, 2200);
|
|
1537
|
-
}});
|
|
1538
|
-
}});
|
|
1539
|
-
|
|
1540
|
-
/* 检索分组筛选(单选 + 全部 + 未引用,胶囊样式)+ 关键字搜索叠加 */
|
|
1541
|
-
var cond = "";
|
|
1542
|
-
var kw = "";
|
|
1543
|
-
function apply() {{
|
|
1544
|
-
cards.forEach(function (c) {{
|
|
1545
|
-
var okCond = !cond;
|
|
1546
|
-
if (cond === "__unused__") okCond = c.getAttribute("data-unused") === "1";
|
|
1547
|
-
else if (cond) okCond = c.getAttribute("data-search") === cond;
|
|
1548
|
-
var okKw = !kw || (c.textContent || "").toLowerCase().indexOf(kw) !== -1;
|
|
1549
|
-
c.classList.toggle("hide", !(okCond && okKw));
|
|
1550
|
-
}});
|
|
1551
|
-
}}
|
|
1552
|
-
document.querySelectorAll(".filters button").forEach(function (b) {{
|
|
1553
|
-
b.addEventListener("click", function () {{
|
|
1554
|
-
document.querySelectorAll(".filters button").forEach(function (x) {{ x.classList.remove("on"); }});
|
|
1555
|
-
b.classList.add("on");
|
|
1556
|
-
cond = b.getAttribute("data-cond") || "";
|
|
1557
|
-
apply();
|
|
1558
|
-
}});
|
|
1559
|
-
}});
|
|
1560
|
-
var search = document.querySelector(".src-search");
|
|
1561
|
-
if (search) search.addEventListener("input", function () {{ kw = search.value.trim().toLowerCase(); apply(); }});
|
|
1562
|
-
}})();
|
|
1563
|
-
</script>
|
|
2348
|
+
<script>{PAGE_JS}</script>
|
|
1564
2349
|
</body>
|
|
1565
2350
|
</html>"""
|
|
1566
2351
|
|
|
@@ -1593,17 +2378,37 @@ def main() -> None:
|
|
|
1593
2378
|
parser.add_argument("--question", default="", help="用户需求,用于自动生成文件名。")
|
|
1594
2379
|
parser.add_argument("--stage", choices=["outline", "final"], default="final",
|
|
1595
2380
|
help="报告版本:outline 提纲版(确认门前事前核验)/ final 成稿版(交付时事后溯源),默认 final。")
|
|
2381
|
+
parser.add_argument("--skip-link-check", action="store_true",
|
|
2382
|
+
help="跳过原文链接活性检测(默认检测:404/410 含软 404 标记失效)")
|
|
2383
|
+
parser.add_argument("--disable-snapshot", action="store_true",
|
|
2384
|
+
help="关闭快照兜底展示(默认启用:原文失效时以存档快照回看)")
|
|
1596
2385
|
args = parser.parse_args()
|
|
2386
|
+
if args.disable_snapshot:
|
|
2387
|
+
global SNAPSHOT_ENABLED
|
|
2388
|
+
SNAPSHOT_ENABLED = False
|
|
1597
2389
|
|
|
1598
2390
|
payload = load_json(_safe_input_path(args.input_json, {".json"}))
|
|
1599
2391
|
answer_override = ""
|
|
1600
2392
|
if args.answer_file:
|
|
1601
2393
|
answer_override = _safe_input_path(args.answer_file, {".txt", ".md"}).read_text(encoding="utf-8")
|
|
1602
2394
|
question = args.question.strip() or extract_question(unwrap(payload))
|
|
2395
|
+
unwrapped = unwrap(payload)
|
|
2396
|
+
|
|
2397
|
+
# 原文链接活性检测 + 快照兜底(就地改写原始材料 dict:链接失效=True / 快照链接 规范化)
|
|
2398
|
+
raw_articles = collect_raw_articles(unwrapped)
|
|
2399
|
+
if not args.skip_link_check and raw_articles:
|
|
2400
|
+
dead = mark_dead_links(raw_articles)
|
|
2401
|
+
if dead:
|
|
2402
|
+
print(f"链接检测:{dead} 条原文链接已失效(404/410),将改用存档快照或如实标注")
|
|
2403
|
+
if SNAPSHOT_ENABLED and raw_articles:
|
|
2404
|
+
fixed, dropped = apply_snapshots(raw_articles)
|
|
2405
|
+
total_snap = sum(1 for a in raw_articles if (a.get("快照链接") or "").strip())
|
|
2406
|
+
if total_snap or fixed or dropped:
|
|
2407
|
+
print(f"快照校验:{total_snap} 条路径合法放行(补全 /A/ {fixed} 条)/ 弃用 {dropped} 条非法路径(不做网络检测)")
|
|
1603
2408
|
|
|
1604
2409
|
# 生成前硬校验:有素材而正文无角标时拒绝生成,杜绝产出无核验对应的报告
|
|
1605
|
-
pre_answer = normalize_citations(answer_override) if answer_override.strip() else extract_answer(
|
|
1606
|
-
pre_sources = extract_sources(
|
|
2410
|
+
pre_answer = normalize_citations(answer_override) if answer_override.strip() else extract_answer(unwrapped)
|
|
2411
|
+
pre_sources = extract_sources(unwrapped)
|
|
1607
2412
|
if pre_sources and not citation_ids(pre_answer):
|
|
1608
2413
|
print("生成检查未通过:答案正文没有任何 [N] 来源角标,无法建立\"结论-素材\"核验对应。", file=sys.stderr)
|
|
1609
2414
|
print(f"请修正答案文件({'提纲版 _outline.md:页面规划表事实要点' if args.stage == 'outline' else '成稿版 _answer.txt:页面级结论文本'}"
|