From c8101a3e541a8a011a3dddffcc01785410f5d361 Mon Sep 17 00:00:00 2001 From: newbie Date: Wed, 25 Nov 2026 15:17:49 +0800 Subject: [PATCH] feat(ui): show diagnostics log state in the Brain overview --- client/index.js | 6 +++++- lib/routes.js | 1 + src-client/panel/Overview.tsx | 2 ++ src/routes.ts | 1 + 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/client/index.js b/client/index.js index 5936aeb..5a2984f 100644 --- a/client/index.js +++ b/client/index.js @@ -4320,7 +4320,11 @@ window.__ModuleLoader__.load({ label: "记忆", value: settings.memoryEnabled === true ? "开" : "关", tone: settings.memoryEnabled === true ? "ok" : "muted" - })), status?.lastCheck === null || status?.lastCheck === void 0 ? null : h$5("p", { className: BrainPanel_module_css_default.hint }, "最近检查:" + formatTime(status.lastCheck.at) + " · " + String(status.lastCheck.status ?? ""))), h$5(Card, { title: "五个 bundle 开关态" }, h$5("div", { className: BrainPanel_module_css_default.pills }, bundleKeys.map((key) => h$5(Pill, { + }), h$5(Pill, { + label: "诊断日志", + value: settings.diagnosticsEnabled === false ? "关" : "开", + tone: settings.diagnosticsEnabled === false ? "muted" : "ok" + })), h$5("p", { className: BrainPanel_module_css_default.hint }, "诊断日志位置:$DSH_HOME/brain/logs(全局)与 <项目>/.dsh/brain/logs(项目)"), status?.lastCheck === null || status?.lastCheck === void 0 ? null : h$5("p", { className: BrainPanel_module_css_default.hint }, "最近检查:" + formatTime(status.lastCheck.at) + " · " + String(status.lastCheck.status ?? ""))), h$5(Card, { title: "五个 bundle 开关态" }, h$5("div", { className: BrainPanel_module_css_default.pills }, bundleKeys.map((key) => h$5(Pill, { key, label: BUNDLE_LABELS[key] ?? key, value: bundles[key] === true ? "启用" : bundles[key] === false ? "停用" : "未知", diff --git a/lib/routes.js b/lib/routes.js index f34d10f..5df888f 100644 --- a/lib/routes.js +++ b/lib/routes.js @@ -89,6 +89,7 @@ export function buildStatusPayload(deps) { autoSummaryEnabled: view.autoSummaryEnabled, autoProfileEnabled: view.autoProfileEnabled, localMemoryK: view.localMemoryK, + diagnosticsEnabled: view.diagnosticsEnabled, }; return { ok: true, diff --git a/src-client/panel/Overview.tsx b/src-client/panel/Overview.tsx index 2491284..0906466 100644 --- a/src-client/panel/Overview.tsx +++ b/src-client/panel/Overview.tsx @@ -85,7 +85,9 @@ export function Overview(props: { active?: boolean }): any { h(Pill, { label: '服务', value: settings.baseUrlConfigured === false ? '未配置' : (settings.baseUrlOrigin || '已配置'), tone: settings.baseUrlConfigured === false ? 'warn' : 'muted' }), h(Pill, { label: '上报', value: settings.activityEnabled === true ? '开' : '关', tone: settings.activityEnabled === true ? 'ok' : 'muted' }), h(Pill, { label: '记忆', value: settings.memoryEnabled === true ? '开' : '关', tone: settings.memoryEnabled === true ? 'ok' : 'muted' }), + h(Pill, { label: '诊断日志', value: settings.diagnosticsEnabled === false ? '关' : '开', tone: settings.diagnosticsEnabled === false ? 'muted' : 'ok' }), ), + h('p', { className: styles.hint }, '诊断日志位置:$DSH_HOME/brain/logs(全局)与 <项目>/.dsh/brain/logs(项目)'), status?.lastCheck === null || status?.lastCheck === undefined ? null : h('p', { className: styles.hint }, '最近检查:' + formatTime(status.lastCheck.at) + ' · ' + String(status.lastCheck.status ?? '')), ), h(Card, { title: '五个 bundle 开关态' }, diff --git a/src/routes.ts b/src/routes.ts index 1b40e40..bf21a5d 100644 --- a/src/routes.ts +++ b/src/routes.ts @@ -183,6 +183,7 @@ export function buildStatusPayload(deps: RouteDeps): Record { autoSummaryEnabled: view.autoSummaryEnabled, autoProfileEnabled: view.autoProfileEnabled, localMemoryK: view.localMemoryK, + diagnosticsEnabled: view.diagnosticsEnabled, } return { ok: true,