diff --git a/core/super-memory/bindings.js b/core/super-memory/bindings.js index ceba3b1..7590126 100644 --- a/core/super-memory/bindings.js +++ b/core/super-memory/bindings.js @@ -3,6 +3,7 @@ import { extension_settings } from "/scripts/extensions.js"; import { saveSettingsDebounced } from "/script.js"; import { initializeSuperMemory, purgeSuperMemory } from "./manager.js"; import { defaultSettings as ragDefaultSettings } from "../rag-settings.js"; +import { getMemoryState } from "../table-system/manager.js"; const RAG_MODULE_NAME = 'hanlinyuan-rag-core'; @@ -30,6 +31,8 @@ export function bindSuperMemoryEvents() { // 处理 Checkbox 变更 panel.on('change', 'input[type="checkbox"]', function() { + if ($(this).hasClass('sm-table-setting-check')) return; // Skip table settings checks here + if (!extension_settings[extensionName]) extension_settings[extensionName] = {}; const id = this.id; @@ -82,11 +85,83 @@ export function bindSuperMemoryEvents() { console.log(`[Amily2-SuperMemory] Input updated: ${id} = ${this.value}`); }); + // 绑定刷新表格列表按钮 + panel.on('click', '#sm-refresh-table-list', function() { + renderTableSettingsList(); + }); + + // 绑定表格专属配置的 Checkbox + panel.on('change', '.sm-table-setting-check', function() { + if (!extension_settings[extensionName]) extension_settings[extensionName] = {}; + if (!extension_settings[extensionName].superMemory_tableSettings) { + extension_settings[extensionName].superMemory_tableSettings = {}; + } + + const tableName = $(this).data('table'); + const type = $(this).data('type'); // 'sync' or 'constant' + const checked = this.checked; + + if (!extension_settings[extensionName].superMemory_tableSettings[tableName]) { + extension_settings[extensionName].superMemory_tableSettings[tableName] = {}; + } + + extension_settings[extensionName].superMemory_tableSettings[tableName][type] = checked; + saveSettingsDebounced(); + console.log(`[Amily2-SuperMemory] Table setting updated: ${tableName}.${type} = ${checked}`); + }); + loadSuperMemorySettings(); console.log('[Amily2-SuperMemory] Events bound successfully.'); } +function renderTableSettingsList() { + const container = $('#sm-table-settings-list'); + container.html('