From a28acb0bc0e2a212ff062eecbd2162952b1f540b Mon Sep 17 00:00:00 2001 From: Youzini-afk <13153778771cx@gmail.com> Date: Thu, 23 Apr 2026 14:01:25 +0800 Subject: [PATCH] refactor: remove redundant task monitor UI --- runtime/settings-defaults.js | 1 - tests/default-settings.mjs | 1 - ui/panel.html | 39 ---------- ui/panel.js | 147 +---------------------------------- 4 files changed, 2 insertions(+), 186 deletions(-) diff --git a/runtime/settings-defaults.js b/runtime/settings-defaults.js index 69708b7..0fd41f6 100644 --- a/runtime/settings-defaults.js +++ b/runtime/settings-defaults.js @@ -76,7 +76,6 @@ export const defaultSettings = { enableRegionScopedObjective: true, enableCognitiveMemory: true, enableSpatialAdjacency: true, - enableAiMonitor: false, injectLowConfidenceObjectiveMemory: false, enableStoryTimeline: true, injectStoryTimeLabel: true, diff --git a/tests/default-settings.mjs b/tests/default-settings.mjs index 474b2a6..4560502 100644 --- a/tests/default-settings.mjs +++ b/tests/default-settings.mjs @@ -50,7 +50,6 @@ assert.equal(defaultSettings.injectUserPovMemory, true); assert.equal(defaultSettings.injectObjectiveGlobalMemory, true); assert.equal(defaultSettings.enableCognitiveMemory, true); assert.equal(defaultSettings.enableSpatialAdjacency, true); -assert.equal(defaultSettings.enableAiMonitor, false); assert.equal(defaultSettings.injectLowConfidenceObjectiveMemory, false); assert.equal(defaultSettings.enableStoryTimeline, true); assert.equal(defaultSettings.injectStoryTimeLabel, true); diff --git a/ui/panel.html b/ui/panel.html index 3d3a1cb..b1f4cca 100644 --- a/ui/panel.html +++ b/ui/panel.html @@ -291,14 +291,6 @@ -
-
任务监视器
-
- 默认跟随调试总开关;开启后展示最近的记忆任务流水。 -
- -
-
最近提取
@@ -573,10 +565,6 @@ 空间控制台
-
- 任务监视器 -
-
@@ -682,10 +670,6 @@ 空间控制台
-
- 任务监视器 -
-
@@ -1444,29 +1428,6 @@ -
-
-
-
任务监视器
-
- 记录最近的提取、召回、压缩等任务流水;默认关闭,建议配合调试开关一起使用。 -
-
-
- -
-
diff --git a/ui/panel.js b/ui/panel.js index b68380d..f656b8b 100644 --- a/ui/panel.js +++ b/ui/panel.js @@ -2963,7 +2963,6 @@ function _refreshMobileCognitionFull() { _renderCogOwnerList(graph, canRender, document.getElementById("bme-mobile-cog-owner-list")); _renderCogOwnerDetail(graph, loadInfo, canRender, document.getElementById("bme-mobile-cog-owner-detail")); _renderCogSpaceTools(graph, loadInfo, canRender, document.getElementById("bme-mobile-cog-space-tools")); - _renderCogMonitorMini(document.getElementById("bme-mobile-cog-monitor-mini")); } function _refreshMobileSummaryFull() { @@ -3087,7 +3086,6 @@ function _refreshCognitionWorkspace() { _renderCogOwnerList(graph, canRender); _renderCogOwnerDetail(graph, loadInfo, canRender); _renderCogSpaceTools(graph, loadInfo, canRender); - _renderCogMonitorMini(); } function _renderCogStatusStrip(graph, loadInfo, canRender, targetEl) { @@ -3134,19 +3132,6 @@ function _renderCogStatusStrip(graph, loadInfo, canRender, targetEl) {
当前场景锚点
${_escHtml( activeOwnerLabels.length > 0 - ? activeOwnerLabels.join(" / ") - : activeOwner - ? _getOwnerDisplayInfo(activeOwner, collisionIndex).title - : activeOwnerKey || "—", - )}
-
-
-
当前地区
-
${_escHtml(activeRegionLabel)}
-
-
-
邻接地区
-
${_escHtml(adjacentRegions.length > 0 ? adjacentRegions.join(" / ") : "—")}
认知角色数
@@ -3451,52 +3436,6 @@ function _renderCogSpaceTools(graph, loadInfo, canRender, targetEl) { `; } -function _renderCogMonitorMini(targetEl) { - const el = targetEl || document.getElementById("bme-cog-monitor-mini"); - if (!el) return; - - const settings = _getSettings?.() || {}; - if (settings.enableAiMonitor !== true) { - el.innerHTML = `
任务监视器已关闭
`; - return; - } - - const runtimeDebug = _getRuntimeDebugSnapshot?.() || {}; - const timeline = Array.isArray(runtimeDebug?.runtimeDebug?.taskTimeline) - ? runtimeDebug.runtimeDebug.taskTimeline : []; - - if (!timeline.length) { - el.innerHTML = `
暂无任务流水
`; - return; - } - - el.innerHTML = timeline - .slice(-8) - .reverse() - .map((entry) => { - const status = String(entry?.status || "").toLowerCase(); - const statusClass = status.includes("error") || status.includes("fail") ? "is-error" - : status.includes("run") ? "is-running" : "is-success"; - const taskType = String(entry?.taskType || "unknown"); - const route = - _getMonitorRouteLabel(entry?.route) || - _getMonitorRouteLabel(entry?.llmConfigSourceLabel) || - String(entry?.model || "").trim(); - const durationMs = Number(entry?.durationMs); - const durationText = Number.isFinite(durationMs) && durationMs > 0 - ? durationMs >= 1000 ? `${(durationMs / 1000).toFixed(1)}s` : `${Math.round(durationMs)}ms` - : "—"; - return ` -
- ${_escHtml(_getMonitorTaskTypeLabel(taskType))} - ${_escHtml(route || _getMonitorStatusLabel(entry?.status) || "—")} - ${_escHtml(durationText)} -
`; - }) - .join(""); -} - - function _formatSummaryEntryCard(entry = {}) { const messageRange = Array.isArray(entry?.dialogueRange) ? entry.dialogueRange @@ -3681,7 +3620,6 @@ function _refreshDashboard() { _getGraphLoadLabel(loadInfo), ); _refreshCognitionDashboard(graph, loadInfo); - _refreshAiMonitorDashboard(); return; } @@ -3753,32 +3691,10 @@ function _refreshDashboard() { _setText("bme-status-last-recall", recallStatus.meta || "尚未执行召回"); _refreshCognitionDashboard(graph); - _refreshAiMonitorDashboard(); _renderRecentList("bme-recent-extract", _getLastExtract?.() || []); _renderRecentList("bme-recent-recall", _getLastRecall?.() || []); } -function _renderMiniRecentList(elementId, entries = [], emptyText = "暂无数据") { - const listEl = document.getElementById(elementId); - if (!listEl) return; - listEl.innerHTML = ""; - - if (!Array.isArray(entries) || entries.length === 0) { - const li = document.createElement("li"); - li.className = "bme-recent-item"; - li.textContent = emptyText; - listEl.appendChild(li); - return; - } - - for (const entry of entries) { - const li = document.createElement("li"); - li.className = "bme-recent-item"; - li.textContent = String(entry || ""); - listEl.appendChild(li); - } -} - function _setInputValueIfIdle(elementId, value = "") { const input = document.getElementById(elementId); if (!input) return; @@ -4240,49 +4156,6 @@ function _refreshCognitionDashboard( } } -function _refreshAiMonitorDashboard() { - const settings = _getSettings?.() || {}; - if (settings.enableAiMonitor !== true) { - _renderMiniRecentList( - "bme-ai-monitor-list", - [], - "任务监视器已关闭", - ); - return; - } - - const runtimeDebug = _getRuntimeDebugSnapshot?.() || {}; - const timeline = Array.isArray(runtimeDebug?.runtimeDebug?.taskTimeline) - ? runtimeDebug.runtimeDebug.taskTimeline - : []; - _renderMiniRecentList( - "bme-ai-monitor-list", - timeline - .slice(-6) - .reverse() - .map((entry) => { - const route = - _getMonitorRouteLabel(entry?.route) || - _getMonitorRouteLabel(entry?.llmConfigSourceLabel) || - ""; - const model = String(entry?.model || "").trim(); - const durationText = - Number.isFinite(Number(entry?.durationMs)) && Number(entry.durationMs) > 0 - ? `${Math.round(Number(entry.durationMs))}ms` - : ""; - return [ - _getMonitorTaskTypeLabel(entry?.taskType), - _getMonitorStatusLabel(entry?.status), - route || model ? `${route || model}` : "", - durationText, - ] - .filter(Boolean) - .join(" · "); - }), - "暂无任务流水", - ); -} - function _renderRecentList(elementId, items) { const listEl = document.getElementById(elementId); if (!listEl) return; @@ -6696,10 +6569,6 @@ function _refreshConfigTab() { "bme-setting-debug-logging-enabled", settings.debugLoggingEnabled ?? false, ); - _setCheckboxValue( - "bme-setting-ai-monitor-enabled", - settings.enableAiMonitor ?? true, - ); _setCheckboxValue( "bme-setting-graph-native-force-disable", settings.graphNativeForceDisable === true, @@ -7176,10 +7045,6 @@ function _bindConfigControls() { bindCheckbox("bme-setting-debug-logging-enabled", (checked) => { _patchSettings({ debugLoggingEnabled: checked }); }); - bindCheckbox("bme-setting-ai-monitor-enabled", (checked) => { - _patchSettings({ enableAiMonitor: checked }); - _refreshDashboard(); - }); bindCheckbox("bme-setting-graph-native-force-disable", (checked) => { _patchSettings({ graphNativeForceDisable: checked }); }); @@ -8954,18 +8819,10 @@ function _buildMonitorMessagesPreview(messages = []) { function _renderAiMonitorTraceCard(state) { const timeline = Array.isArray(state.taskTimeline) ? state.taskTimeline : []; - if (state.settings?.enableAiMonitor !== true) { - return ` -
任务监视器流水
-
- 任务监视器当前已关闭。打开后,这里会保留最近的提取 / 召回 / 维护任务快照,便于排查到底发了什么、用了哪套模型、做了哪些清洗。 -
- `; - } if (!timeline.length) { return ` -
任务监视器流水
+
最近任务快照
还没有任务流水。等提取、召回或维护任务跑过一轮后,这里就会出现最近记录。
@@ -9061,7 +8918,7 @@ function _renderAiMonitorTraceCard(state) { return `
-
任务监视器流水
+
最近任务快照
最近 ${Math.min(timeline.length, 8)} 条任务快照 · 点击展开查看详情