feat: 重构聊天系统的内存处理与格式化功能

- 更新了DefaultReplyer,采用新的内存格式化工具以提供更优质的内存描述。
- 已移除 Config 类中已弃用的内存配置。
- 在主系统中增强内存系统初始化检查,确保配置正确。
- 优化了MemoryManager,使其可直接使用全局配置进行内存设置。
- 新增了一个内存格式化工具,用于将内存对象转换为自然语言描述。
- 更新了内存工具,提供了更清晰的内存创建与管理指南。
- 精炼插件工具与使用提示,提升用户交互体验与记忆准确性。
- 根据内存系统结构的变化调整了机器人配置模板。
This commit is contained in:
Windpicker-owo
2025-11-06 08:47:18 +08:00
parent 7bb0248ca2
commit b6a693895b
13 changed files with 691 additions and 118 deletions

View File

@@ -251,7 +251,7 @@ class MainSystem:
# 停止增强记忆系统
try:
if global_config.memory.enable_memory:
if global_config.memory and getattr(global_config.memory, 'enable', False):
cleanup_tasks.append(("增强记忆系统", self.memory_manager.shutdown()))
except Exception as e:
logger.error(f"准备停止增强记忆系统时出错: {e}")
@@ -469,7 +469,7 @@ MoFox_Bot(第三方修改版)
task.add_done_callback(_background_tasks.discard)
# 初始化增强记忆系统
if global_config.memory.enable_memory:
if global_config.memory and getattr(global_config.memory, 'enable', False):
from src.chat.memory_system.memory_system import initialize_memory_system
await self._safe_init("增强记忆系统", initialize_memory_system)()
await self._safe_init("记忆管理器", self.memory_manager.initialize)()