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