feat(memory-graph): Step 1 - 集成记忆工具到插件系统
完成记忆系统工具的插件化集成: 1. 创建记忆工具适配器 (memory_plugin_tools.py) - CreateMemoryTool: 创建新记忆 - LinkMemoriesTool: 关联两条记忆 - SearchMemoriesTool: 搜索相关记忆 - 适配 BaseTool 接口,支持 LLM 调用 2. 创建全局 MemoryManager 单例 (manager_singleton.py) - initialize_memory_manager(): 初始化全局实例 - get_memory_manager(): 获取单例实例 - shutdown_memory_manager(): 关闭管理器 - 线程安全的单例模式 3. 创建记忆系统插件 (plugins/memory_graph_plugin/) - MemoryGraphPlugin: 插件主类 - 自动注册3个记忆工具到系统 - on_plugin_loaded(): 初始化 MemoryManager - on_unload(): 清理资源 4. 修复类型问题 - ToolParamType.OBJECT STRING (JSON格式) - ToolParamType.NUMBER FLOAT - attributes 参数支持 JSON 字符串解析 - 修复 min_importance None 比较错误 5. 添加集成测试 (test_plugin_integration.py) - 测试工具导入和定义 - 测试 MemoryManager 初始化 - 测试工具执行(创建、搜索记忆) - 测试单例模式 测试结果: 所有测试通过 LLM 现在可以通过工具调用主动管理记忆!
This commit is contained in:
@@ -362,7 +362,7 @@ class MemoryManager:
|
||||
continue
|
||||
|
||||
# 重要性过滤
|
||||
if memory.importance < min_importance:
|
||||
if min_importance is not None and memory.importance < min_importance:
|
||||
continue
|
||||
|
||||
# 遗忘状态过滤
|
||||
|
||||
Reference in New Issue
Block a user