From 7404817f795234939141a93e14831a690c9cd2bb Mon Sep 17 00:00:00 2001 From: JianFeeeee <109188060+JianFeeeee@users.noreply.github.com> Date: Mon, 14 Sep 2026 16:16:14 +0800 Subject: [PATCH] =?UTF-8?q?fix(webui):=20=E6=80=BB=E8=A7=88=E6=94=B9?= =?UTF-8?q?=E9=9D=99=E6=80=81=E9=AA=A8=E6=9E=B6=20+=20=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=20KPI=EF=BC=8C=E5=BD=BB=E5=BA=95=E5=8E=BB=E6=8E=89=E6=95=B4?= =?UTF-8?q?=E9=A1=B5=E9=87=8D=E5=BB=BA=E7=9A=84=E9=97=AA=E7=83=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit jianf:仍严重闪烁;应彻底摒弃增量重建,用动态图标 + api 数据展示;主页文字太多。 - renderOverview 从「每次 innerHTML 重建整页(含运行态面板)」改成**首帧建一次 静态骨架**,之后 renderAll(每 15s 一次)只 updateOverview —— 只写 textContent 与类名,一个节点都不重建。实测连续两次 renderAll 后 #ov-kpis / #ov-status / #rt-panel 仍是同一批 DOM 节点,这是"不再闪"的直接判据。 - 主页文字大幅收缩:删掉「系统概览 / LLM 状态 / 记忆状态 / 运行时」四张 kv 文字卡, 改成一排 8 个图标 KPI(状态/运行/插件/版本/LLM/记忆/文档/运行时),状态用彩色 圆点表达,其余只留数字 + 两字标签。 - 运行态面板不再被 renderOverview 清空(去掉 _rtSig=null 与重建),保持连续更新。 --- internal/plugins/webui/dashboard.css | 71 ++++++++ internal/plugins/webui/dashboard.js | 243 ++++++++++++--------------- 2 files changed, 183 insertions(+), 131 deletions(-) diff --git a/internal/plugins/webui/dashboard.css b/internal/plugins/webui/dashboard.css index bc43e3f4..e829b4c0 100644 --- a/internal/plugins/webui/dashboard.css +++ b/internal/plugins/webui/dashboard.css @@ -2740,3 +2740,74 @@ border-color: var(--text-primary); box-shadow: 0 0 0 2px var(--accent-bg); } + + /* ===== 总览 KPI(图标 + 数字,静态骨架)===== + 节点只在首帧建一次,刷新只改值与类名 —— 这是总览页不再闪的前提。 */ + .ov-kpis { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); + gap: 10px; + } + .ov-kpi { + display: flex; + flex-direction: column; + gap: 5px; + padding: 12px 14px 11px; + border-radius: var(--radius-md); + background: var(--bg-input); + border: 1px solid var(--border-color); + min-width: 0; + } + .ov-ico svg { + width: 18px; + height: 18px; + fill: none; + stroke: var(--accent); + stroke-width: 1.7; + stroke-linecap: round; + stroke-linejoin: round; + display: block; + } + .ov-val { + display: flex; + align-items: center; + gap: 6px; + font-size: 18px; + font-weight: 700; + line-height: 1.15; + min-width: 0; + } + .ov-val b { + font-weight: 700; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + .ov-lab { + font-size: 10px; + letter-spacing: 0.05em; + text-transform: uppercase; + color: var(--text-muted); + } + .ov-dot { + flex: 0 0 auto; + width: 8px; + height: 8px; + border-radius: 50%; + background: var(--text-muted); + } + .ov-dot.ok { + background: var(--success); + box-shadow: 0 0 8px rgba(23, 169, 100, 0.55); + } + .ov-dot.warn { + background: var(--warning); + } + .ov-dot.bad { + background: var(--error); + } + .ov-foot { + margin-top: 10px; + font-size: 11px; + color: var(--text-muted); + } diff --git a/internal/plugins/webui/dashboard.js b/internal/plugins/webui/dashboard.js index 77f89202..bc045a4c 100644 --- a/internal/plugins/webui/dashboard.js +++ b/internal/plugins/webui/dashboard.js @@ -567,12 +567,12 @@ function startUptimeTicker() { if (uptimeTick) clearInterval(uptimeTick); uptimeTick = setInterval(function () { - var el = document.querySelector("#uptime-val"); + var el = document.querySelector("#ov-uptime"); if (el && state.startedAt) { var now = Date.now(); el.textContent = fmtUptime(now - state.startedAt); } else if (!state.startedAt) { - var el2 = document.querySelector("#uptime-val"); + var el2 = document.querySelector("#ov-uptime"); if (el2) el2.textContent = "-"; } }, 1000); @@ -1180,140 +1180,121 @@ }, 3000); } + // ===== Overview ===== + // + // 总览页是**静态骨架 + 数据绑定**:DOM 只在首帧建一次,之后所有刷新只改 + // 文本/类名,绝不重建节点。此前 renderAll 每 15s 把整个总览(含运行态面板) + // innerHTML 重建一遍 —— 那是页面上最刺眼的周期性闪烁的来源。 + // + // 文字也压到最少:状态用彩色圆点表达,其余只留数字与两字标签,不再堆 + // 「未初始化 / 不可用」这类整句描述。 + var OV_ICONS = { + activity: + '', + clock: + '', + puzzle: + '', + tag: + '', + brain: + '', + db: + '', + file: + '', + cpu: + '', + }; + + function ovKpi(id, icon, label, dot) { + return ( + '