diff --git a/style.css b/style.css index b7348e8..89f720d 100644 --- a/style.css +++ b/style.css @@ -1246,6 +1246,10 @@ flex-shrink: 0; } +.bme-memory-list-filters .bme-filter-select { + flex: 0 0 auto; +} + .bme-memory-list-scroll { flex: 1; overflow-y: auto; diff --git a/ui/panel.js b/ui/panel.js index 779053c..4dec443 100644 --- a/ui/panel.js +++ b/ui/panel.js @@ -1371,23 +1371,21 @@ function _refreshTaskPipelineOverview() { const el = document.getElementById("bme-task-pipeline"); if (!el) return; - const debug = _getRuntimeDebugSnapshot?.() || {}; - const rd = debug.runtimeDebug || {}; const graph = _getGraph?.() || {}; - const historyState = graph.runtimeState?.historyState || {}; - const graphPersistenceState = graph.graphPersistenceState || {}; + const historyState = graph.runtimeState?.historyState || graph.historyState || {}; + const loadInfo = _getGraphPersistenceSnapshot(); - const extraction = _resolvePipelineStatus(rd.lastExtractionStatus); - const vector = _resolvePipelineStatus(rd.lastVectorStatus); - const recall = _resolvePipelineStatus(rd.lastRecallStatus); - const persistLevel = graphPersistenceState.loadState === "loaded" ? "info" : graphPersistenceState.loadState === "loading" ? "info" : "warn"; + const extraction = _resolvePipelineStatus(_getLastExtractionStatus?.()); + const vector = _resolvePipelineStatus(_getLastVectorStatus?.()); + const recall = _resolvePipelineStatus(_getLastRecallStatus?.()); + const persistLevel = loadInfo.loadState === "loaded" ? "info" : loadInfo.loadState === "loading" ? "info" : "warn"; const persistence = _resolvePipelineStatus({ - text: graphPersistenceState.loadState || "unknown", - meta: `rev ${graphPersistenceState.lastAcceptedRevision || 0}`, + text: loadInfo.loadState || "unknown", + meta: `rev ${loadInfo.revision || 0}`, level: persistLevel, }); - const batchStatus = historyState.lastBatchStatus || {}; + const batchStatus = _getLatestBatchStatusSnapshot() || {}; const stages = [ { key: "core", label: "Core" }, { key: "structural", label: "结构" }, @@ -1670,49 +1668,41 @@ function _refreshTaskInjectionPreview() { const el = document.getElementById("bme-task-injection"); if (!el) return; - const debug = _getRuntimeDebugSnapshot?.() || {}; - const rd = debug.runtimeDebug || {}; - const injection = rd?.injections?.recall || null; - - if (!injection) { - el.innerHTML = '
暂无注入数据
'; + const injectionText = String(_getLastInjection?.() || "").trim(); + if (!injectionText) { + el.innerHTML = '
暂无注入数据——等待第一次召回注入后显示。
'; return; } - const totalTokens = injection.tokenCount || 0; - const budgetTokens = injection.budgetTokens || totalTokens || 1; - const pct = Math.min(100, Math.round((totalTokens / budgetTokens) * 100)); + const debug = _getRuntimeDebugSnapshot?.() || {}; + const rd = debug.runtimeDebug || {}; + const recallSnap = rd?.injections?.recall || {}; + const totalTokens = recallSnap.tokenCount || 0; + const budgetTokens = recallSnap.budgetTokens || totalTokens || 1; + const pct = totalTokens > 0 ? Math.min(100, Math.round((totalTokens / budgetTokens) * 100)) : 0; - const sections = Array.isArray(injection.sections) ? injection.sections : []; - const injectionText = injection.text || injection.injectionText || ""; - - const cardsHtml = sections.length - ? sections.map((s) => ` -
-
- ${_escHtml(s.title || s.type || "section")} - ${typeof s.tokenCount === "number" ? `${s.tokenCount} tok` : ""} -
-
${_escHtml(s.text || s.content || "")}
-
- `).join("") - : `
-
- Full Injection - ${totalTokens} tok -
-
${_escHtml(injectionText.slice(0, 2000))}${injectionText.length > 2000 ? "…" : ""}
-
`; - - el.innerHTML = ` + const tokenBarHtml = totalTokens > 0 ? `
${totalTokens} / ${budgetTokens} tok
${pct}% +
` : ""; + + const previewText = injectionText.length > 3000 ? injectionText.slice(0, 3000) + "…" : injectionText; + + el.innerHTML = ` + ${tokenBarHtml} +
+
+
+ Recall Injection + ${totalTokens > 0 ? `${totalTokens} tok` : ""} +
+
${_escHtml(previewText)}
+
-
${cardsHtml}
`; } @@ -1734,18 +1724,16 @@ function _refreshTaskPersistence() { if (!el) return; const graph = _getGraph?.() || {}; - const ps = graph.graphPersistenceState || {}; + const ps = _getGraphPersistenceSnapshot(); const rs = graph.runtimeState || {}; const kvs = [ ["Load State", ps.loadState || "unknown"], - ["Storage Tier", ps.acceptedStorageTier || "—"], - ["Last Accepted Rev", ps.lastAcceptedRevision ?? "—"], - ["Commit Marker", ps.currentCommitMarker ? "present" : "none"], - ["Blocked Reason", ps.blockedReason || "—"], - ["IDB Snapshot Rev", ps.indexedDbSnapshotRevision ?? "—"], - ["Chat State Rev", ps.chatStateSnapshotRevision ?? "—"], - ["Shadow Snapshot", ps.hasShadowSnapshot ? "yes" : "no"], + ["Storage Tier", ps.acceptedStorageTier || ps.storageTier || "—"], + ["Revision", ps.revision ?? "—"], + ["Commit Marker", ps.commitMarker ? "present" : "none"], + ["Blocked Reason", ps.blockedReason || ps.reason || "—"], + ["Shadow Snapshot", ps.shadowSnapshotUsed ? "yes" : "no"], ]; const kvHtml = kvs.map(([k, v]) => `
${_escHtml(k)}${_escHtml(String(v))}
`).join("");