From eab623d5b580efedbc819f865d0f74dd49c6c8f4 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Fri, 24 Jul 2026 16:17:39 +0800 Subject: [PATCH] =?UTF-8?q?fix(web):=20kb=20=E6=9D=A1=E7=9B=AE=E4=B8=8E?= =?UTF-8?q?=E5=8D=95=E7=AF=87=E9=A1=B5=E8=A1=A5=E6=98=BE=E5=8E=9F=E4=BB=B6?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 已入库条目此前只把 source 用于查看/下载按钮,原件名(含后缀)无处显示。 标题后加灰色小字原件名(悬停提示同步带上),单篇页头部加「原件: xxx」, 新增 .kb-src-name 样式两处共用;不破坏单行精简版式。 Co-Authored-By: Claude Fable 5 --- web/static/dev.html | 1 + web/static/js/kb.js | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/web/static/dev.html b/web/static/dev.html index 6f4bb44..945ec2f 100644 --- a/web/static/dev.html +++ b/web/static/dev.html @@ -506,6 +506,7 @@ } .kb-ingest-err { margin-top: 8px; font-size: 12px; color: #b45309; } .kb-pending { padding: 3px 0; font-size: 12px; color: var(--muted); } + .kb-src-name { font-weight: 400; font-size: 11px; color: var(--muted); margin-left: 6px; } .kb-entry { display: flex; align-items: flex-start; gap: 6px; padding: 6px 0; border-bottom: 1px dashed var(--border); } .kb-entry-main { flex: 1; min-width: 0; cursor: pointer; } /* 标题/摘要各压一行省略(sk-item 的省略规则只覆盖左栏,这里单列);全文在悬停 title */ diff --git a/web/static/js/kb.js b/web/static/js/kb.js index 20a171b..1957194 100644 --- a/web/static/js/kb.js +++ b/web/static/js/kb.js @@ -135,11 +135,11 @@ function renderDetail(d) { const doc = e.doc.replace(/^docs\//, ""); const src = (e.source || "").replace(/^sources\//, ""); if (src) _docSources[doc] = src; - // 行内只留标题 + 单行摘要(CSS 省略);完整摘要/关键词进 title 悬停提示,不占行高 - const tip = e.summary + (e.keywords ? "\n关键词: " + e.keywords : ""); + // 行内只留标题(+原件名小字)+ 单行摘要(CSS 省略);完整摘要/关键词进 title 悬停提示,不占行高 + const tip = e.summary + (e.keywords ? "\n关键词: " + e.keywords : "") + (src ? "\n原件: " + src : ""); return `
-
${escapeHtml(e.title)}
+
${escapeHtml(e.title)}${src ? `${escapeHtml(src)}` : ""}
${escapeHtml(e.summary)}
${src ? ` @@ -166,6 +166,7 @@ async function showDoc(filename) { detail.innerHTML = `
${escapeHtml(filename)} + ${src ? `原件: ${escapeHtml(src)}` : ""} ${src ? ` ` : ""}