mirror of
https://github.com/Youzini-afk/ST-Bionic-Memory-Ecology.git
synced 2026-05-15 22:30:38 +08:00
feat: improve retrieval recall and maintenance undo
This commit is contained in:
87
panel.js
87
panel.js
@@ -78,6 +78,7 @@ const GRAPH_WRITE_ACTION_IDS = [
|
||||
"bme-act-sleep",
|
||||
"bme-act-synopsis",
|
||||
"bme-act-evolve",
|
||||
"bme-act-undo-maintenance",
|
||||
"bme-act-import",
|
||||
"bme-act-rebuild",
|
||||
"bme-act-vector-rebuild",
|
||||
@@ -1255,6 +1256,7 @@ function _bindActions() {
|
||||
"bme-act-import": "import",
|
||||
"bme-act-rebuild": "rebuild",
|
||||
"bme-act-evolve": "evolve",
|
||||
"bme-act-undo-maintenance": "undoMaintenance",
|
||||
"bme-act-vector-rebuild": "rebuildVectorIndex",
|
||||
"bme-act-vector-reembed": "reembedDirect",
|
||||
};
|
||||
@@ -1268,6 +1270,7 @@ function _bindActions() {
|
||||
import: "导入图谱",
|
||||
rebuild: "重建图谱",
|
||||
evolve: "强制进化",
|
||||
undoMaintenance: "撤销最近维护",
|
||||
rebuildVectorIndex: "重建向量",
|
||||
reembedDirect: "直连重嵌",
|
||||
};
|
||||
@@ -1434,6 +1437,14 @@ function _refreshConfigTab() {
|
||||
"bme-setting-recall-multi-intent-enabled",
|
||||
settings.recallEnableMultiIntent ?? true,
|
||||
);
|
||||
_setCheckboxValue(
|
||||
"bme-setting-recall-context-query-blend-enabled",
|
||||
settings.recallEnableContextQueryBlend ?? true,
|
||||
);
|
||||
_setCheckboxValue(
|
||||
"bme-setting-recall-lexical-boost-enabled",
|
||||
settings.recallEnableLexicalBoost ?? true,
|
||||
);
|
||||
_setCheckboxValue(
|
||||
"bme-setting-recall-temporal-links-enabled",
|
||||
settings.recallEnableTemporalLinks ?? true,
|
||||
@@ -1506,6 +1517,18 @@ function _refreshConfigTab() {
|
||||
"bme-setting-recall-multi-intent-max-segments",
|
||||
settings.recallMultiIntentMaxSegments ?? 4,
|
||||
);
|
||||
_setInputValue(
|
||||
"bme-setting-recall-context-assistant-weight",
|
||||
settings.recallContextAssistantWeight ?? 0.2,
|
||||
);
|
||||
_setInputValue(
|
||||
"bme-setting-recall-context-previous-user-weight",
|
||||
settings.recallContextPreviousUserWeight ?? 0.1,
|
||||
);
|
||||
_setInputValue(
|
||||
"bme-setting-recall-lexical-weight",
|
||||
settings.recallLexicalWeight ?? 0.18,
|
||||
);
|
||||
_setInputValue(
|
||||
"bme-setting-recall-teleport-alpha",
|
||||
settings.recallTeleportAlpha ?? 0.15,
|
||||
@@ -1578,6 +1601,10 @@ function _refreshConfigTab() {
|
||||
"bme-setting-forget-threshold",
|
||||
settings.forgetThreshold ?? 0.5,
|
||||
);
|
||||
_setInputValue(
|
||||
"bme-setting-maintenance-auto-min-new-nodes",
|
||||
settings.maintenanceAutoMinNewNodes ?? 3,
|
||||
);
|
||||
_setInputValue("bme-setting-sleep-every", settings.sleepEveryN ?? 10);
|
||||
_setInputValue(
|
||||
"bme-setting-prob-recall-chance",
|
||||
@@ -1689,6 +1716,12 @@ function _bindConfigControls() {
|
||||
bindCheckbox("bme-setting-recall-multi-intent-enabled", (checked) => {
|
||||
_patchSettings({ recallEnableMultiIntent: checked });
|
||||
});
|
||||
bindCheckbox("bme-setting-recall-context-query-blend-enabled", (checked) => {
|
||||
_patchSettings({ recallEnableContextQueryBlend: checked });
|
||||
});
|
||||
bindCheckbox("bme-setting-recall-lexical-boost-enabled", (checked) => {
|
||||
_patchSettings({ recallEnableLexicalBoost: checked });
|
||||
});
|
||||
bindCheckbox("bme-setting-recall-temporal-links-enabled", (checked) => {
|
||||
_patchSettings({ recallEnableTemporalLinks: checked });
|
||||
});
|
||||
@@ -1760,6 +1793,23 @@ function _bindConfigControls() {
|
||||
8,
|
||||
(value) => _patchSettings({ recallMultiIntentMaxSegments: value }),
|
||||
);
|
||||
bindFloat(
|
||||
"bme-setting-recall-context-assistant-weight",
|
||||
0.2,
|
||||
0,
|
||||
1,
|
||||
(value) => _patchSettings({ recallContextAssistantWeight: value }),
|
||||
);
|
||||
bindFloat(
|
||||
"bme-setting-recall-context-previous-user-weight",
|
||||
0.1,
|
||||
0,
|
||||
1,
|
||||
(value) => _patchSettings({ recallContextPreviousUserWeight: value }),
|
||||
);
|
||||
bindFloat("bme-setting-recall-lexical-weight", 0.18, 0, 1, (value) =>
|
||||
_patchSettings({ recallLexicalWeight: value }),
|
||||
);
|
||||
bindFloat("bme-setting-recall-teleport-alpha", 0.15, 0, 1, (value) =>
|
||||
_patchSettings({ recallTeleportAlpha: value }),
|
||||
);
|
||||
@@ -1843,6 +1893,13 @@ function _bindConfigControls() {
|
||||
bindFloat("bme-setting-forget-threshold", 0.5, 0.1, 1, (value) =>
|
||||
_patchSettings({ forgetThreshold: value }),
|
||||
);
|
||||
bindNumber(
|
||||
"bme-setting-maintenance-auto-min-new-nodes",
|
||||
3,
|
||||
1,
|
||||
50,
|
||||
(value) => _patchSettings({ maintenanceAutoMinNewNodes: value }),
|
||||
);
|
||||
bindNumber("bme-setting-sleep-every", 10, 1, 200, (value) =>
|
||||
_patchSettings({ sleepEveryN: value }),
|
||||
);
|
||||
@@ -2903,6 +2960,7 @@ function _renderTaskDebugTab(state) {
|
||||
const promptBuild = runtimeDebug?.taskPromptBuilds?.[state.taskType] || null;
|
||||
const llmRequest = runtimeDebug?.taskLlmRequests?.[state.taskType] || null;
|
||||
const recallInjection = runtimeDebug?.injections?.recall || null;
|
||||
const maintenanceDebug = runtimeDebug?.maintenance || null;
|
||||
const graphPersistence = runtimeDebug?.graphPersistence || null;
|
||||
|
||||
return `
|
||||
@@ -2923,6 +2981,9 @@ function _renderTaskDebugTab(state) {
|
||||
<div class="bme-config-card">
|
||||
${_renderTaskDebugGraphPersistenceCard(graphPersistence)}
|
||||
</div>
|
||||
<div class="bme-config-card">
|
||||
${_renderTaskDebugMaintenanceCard(maintenanceDebug)}
|
||||
</div>
|
||||
<div class="bme-config-card">
|
||||
${_renderTaskDebugPromptCard(state.taskType, promptBuild)}
|
||||
</div>
|
||||
@@ -2937,6 +2998,32 @@ function _renderTaskDebugTab(state) {
|
||||
`;
|
||||
}
|
||||
|
||||
function _renderTaskDebugMaintenanceCard(maintenanceDebug) {
|
||||
const lastAction = maintenanceDebug?.lastAction || null;
|
||||
const lastUndoResult = maintenanceDebug?.lastUndoResult || null;
|
||||
|
||||
if (!lastAction && !lastUndoResult) {
|
||||
return `
|
||||
<div class="bme-config-card-title">维护账本状态</div>
|
||||
<div class="bme-config-help">当前还没有最近维护或撤销快照。</div>
|
||||
`;
|
||||
}
|
||||
|
||||
return `
|
||||
<div class="bme-config-card-head">
|
||||
<div>
|
||||
<div class="bme-config-card-title">维护账本状态</div>
|
||||
<div class="bme-config-card-subtitle">
|
||||
最近一次维护记录和最近一次撤销结果。
|
||||
</div>
|
||||
</div>
|
||||
<span class="bme-task-pill">${_escHtml(lastAction?.action || lastUndoResult?.action || "maintenance")}</span>
|
||||
</div>
|
||||
${_renderDebugDetails("最近维护", lastAction)}
|
||||
${_renderDebugDetails("最近撤销", lastUndoResult)}
|
||||
`;
|
||||
}
|
||||
|
||||
function _renderTaskDebugGraphPersistenceCard(graphPersistence) {
|
||||
if (!graphPersistence) {
|
||||
return `
|
||||
|
||||
Reference in New Issue
Block a user