mirror of
https://github.com/Cola-Echo/memory-manager-concurrent.git
synced 2026-06-13 15:55:50 +00:00
feat: add RMA (Relationship Memory Architecture) module v0.6.0
Complete RMA system for tracking relationship dynamics in roleplay: - 10 new modules in src/rma/ (analyzer, memory-store, phase-manager, worldbook-sync, float-panel, confirmation-ui, timeline-view, etc.) - Three-layer model: phases → memories (4 types) → emotional texture - Post-processing AI analysis via CHARACTER_MESSAGE_RENDERED hook - Dynamic world book entry toggling/rewriting - Floating panel UI with 3 states (expanded/half/minimized) - User confirmation flow (every_turn/important_only/auto modes) - Settings panel integration with independent API config - chat_metadata.cola_rma persistence Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
63
src/index.js
63
src/index.js
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* 记忆管理并发系统 - 主入口
|
||||
* @version 0.4.9
|
||||
* @version 0.6.0
|
||||
* @author 可乐、繁华
|
||||
* @license CC BY-NC-ND 4.0
|
||||
* @see https://github.com/Cola-Echo/memory-manager-concurrent
|
||||
@@ -69,6 +69,7 @@ import {
|
||||
setMessageProgressPanel,
|
||||
setOpenIndexMergeConfigModalFunction,
|
||||
setOpenPlotOptimizeConfigModalFunction,
|
||||
setOpenRmaConfigModalFunction,
|
||||
setPlotPanelProgressTracker,
|
||||
setPromptEditorFunctions,
|
||||
setRefreshAIConfigListFunction,
|
||||
@@ -96,6 +97,8 @@ import {
|
||||
// 模型显示更新
|
||||
updateIndexMergeModelDisplay,
|
||||
updatePlotOptimizeModelDisplay,
|
||||
// RMA 关系记忆
|
||||
updateRmaModelDisplay,
|
||||
// 总结世界书拆分配置弹窗
|
||||
setSummaryPartConfigModalFunction,
|
||||
showSummaryPartConfigModal,
|
||||
@@ -129,8 +132,19 @@ import {
|
||||
// 表格填表模块
|
||||
import { initTableFiller } from "@table-filler/index";
|
||||
|
||||
// RMA 关系记忆系统
|
||||
import {
|
||||
isRmaEnabled,
|
||||
hasRmaConfig,
|
||||
initRmaState,
|
||||
getCurrentRmaConfig,
|
||||
registerRmaEventListeners,
|
||||
initRmaPanel,
|
||||
showRmaPanel,
|
||||
} from "@rma";
|
||||
|
||||
// 版本信息
|
||||
const VERSION = "0.4.9";
|
||||
const VERSION = "0.6.0";
|
||||
|
||||
// 面板状态
|
||||
let isPanelVisible = false;
|
||||
@@ -252,6 +266,9 @@ async function initPlugin() {
|
||||
setOpenPlotOptimizeConfigModalFunction(() =>
|
||||
showConfigModal("剧情优化", "plot"),
|
||||
);
|
||||
setOpenRmaConfigModalFunction(() =>
|
||||
showConfigModal("RMA分析", "rma"),
|
||||
);
|
||||
|
||||
// 设置更新列表清空函数
|
||||
setClearUpdatesListFunction(clearUpdatesList);
|
||||
@@ -264,6 +281,7 @@ async function initPlugin() {
|
||||
updateIndexMergeModelDisplay,
|
||||
updatePlotOptimizeModelDisplay,
|
||||
refreshAIConfigList,
|
||||
updateRmaModelDisplay,
|
||||
);
|
||||
|
||||
// 设置总结世界书拆分配置弹窗函数
|
||||
@@ -359,6 +377,13 @@ async function initUI() {
|
||||
});
|
||||
}, 3000);
|
||||
|
||||
// 初始化 RMA 关系记忆系统(延迟以确保角色数据加载完成)
|
||||
setTimeout(() => {
|
||||
initRmaModule().catch((e) => {
|
||||
Logger.debug("RMA 模块初始化失败:", e);
|
||||
});
|
||||
}, 2000);
|
||||
|
||||
Logger.log("UI 初始化完成");
|
||||
} catch (error) {
|
||||
Logger.error("UI 初始化失败:", error);
|
||||
@@ -431,6 +456,9 @@ function registerEventListeners() {
|
||||
}
|
||||
|
||||
Logger.log("已注册事件监听");
|
||||
|
||||
// 注册 RMA 事件监听(MESSAGE_RECEIVED / MESSAGE_DELETED)
|
||||
registerRmaEventListeners();
|
||||
} else {
|
||||
Logger.warn("事件系统不可用,使用延迟初始化");
|
||||
// 延迟安装钩子
|
||||
@@ -442,6 +470,37 @@ function registerEventListeners() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化 RMA 关系记忆系统
|
||||
*/
|
||||
async function initRmaModule() {
|
||||
try {
|
||||
if (!isRmaEnabled()) {
|
||||
Logger.debug("RMA 未启用");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!hasRmaConfig()) {
|
||||
Logger.debug("当前角色无 RMA 配置");
|
||||
return;
|
||||
}
|
||||
|
||||
const config = getCurrentRmaConfig();
|
||||
if (config) {
|
||||
// 初始化 RMA 状态(如果首次使用)
|
||||
initRmaState(config);
|
||||
|
||||
// 初始化悬浮面板
|
||||
await initRmaPanel();
|
||||
showRmaPanel();
|
||||
|
||||
Logger.log("RMA 模块初始化完成");
|
||||
}
|
||||
} catch (e) {
|
||||
Logger.debug("RMA 模块初始化失败:", e);
|
||||
}
|
||||
}
|
||||
|
||||
// 启动插件
|
||||
if (typeof jQuery !== "undefined") {
|
||||
jQuery(async () => {
|
||||
|
||||
Reference in New Issue
Block a user