feat(memory): 增加瞬时记忆系统的独立开关
在配置文件中为基于LLM的瞬时记忆和基于向量的瞬时记忆增加了独立的启用开关。这允许用户根据需要更灵活地控制每种记忆类型。 同时,将记忆系统初始化日志的级别从DEBUG提升到INFO,使其在默认配置下可见,便于问题排查。
This commit is contained in:
@@ -33,7 +33,7 @@ class AsyncInstantMemoryWrapper:
|
|||||||
try:
|
try:
|
||||||
from src.chat.memory_system.instant_memory import InstantMemory
|
from src.chat.memory_system.instant_memory import InstantMemory
|
||||||
self.llm_memory = InstantMemory(self.chat_id)
|
self.llm_memory = InstantMemory(self.chat_id)
|
||||||
logger.debug(f"LLM瞬时记忆系统已初始化: {self.chat_id}")
|
logger.info(f"LLM瞬时记忆系统已初始化: {self.chat_id}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(f"LLM瞬时记忆系统初始化失败: {e}")
|
logger.warning(f"LLM瞬时记忆系统初始化失败: {e}")
|
||||||
self.llm_memory_enabled = False # 初始化失败则禁用
|
self.llm_memory_enabled = False # 初始化失败则禁用
|
||||||
@@ -44,7 +44,7 @@ class AsyncInstantMemoryWrapper:
|
|||||||
try:
|
try:
|
||||||
from src.chat.memory_system.vector_instant_memory import VectorInstantMemoryV2
|
from src.chat.memory_system.vector_instant_memory import VectorInstantMemoryV2
|
||||||
self.vector_memory = VectorInstantMemoryV2(self.chat_id)
|
self.vector_memory = VectorInstantMemoryV2(self.chat_id)
|
||||||
logger.debug(f"向量瞬时记忆系统已初始化: {self.chat_id}")
|
logger.info(f"向量瞬时记忆系统已初始化: {self.chat_id}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(f"向量瞬时记忆系统初始化失败: {e}")
|
logger.warning(f"向量瞬时记忆系统初始化失败: {e}")
|
||||||
self.vector_memory_enabled = False # 初始化失败则禁用
|
self.vector_memory_enabled = False # 初始化失败则禁用
|
||||||
|
|||||||
@@ -251,6 +251,8 @@ consolidation_similarity_threshold = 0.7 # 相似度阈值
|
|||||||
consolidation_check_percentage = 0.05 # 检查节点比例
|
consolidation_check_percentage = 0.05 # 检查节点比例
|
||||||
|
|
||||||
enable_instant_memory = false # 是否启用即时记忆,测试功能,可能存在未知问题
|
enable_instant_memory = false # 是否启用即时记忆,测试功能,可能存在未知问题
|
||||||
|
enable_llm_instant_memory = true # 是否启用基于LLM的瞬时记忆
|
||||||
|
enable_vector_instant_memory = true # 是否启用基于向量的瞬时记忆
|
||||||
|
|
||||||
#不希望记忆的词,已经记忆的不会受到影响,需要手动清理
|
#不希望记忆的词,已经记忆的不会受到影响,需要手动清理
|
||||||
memory_ban_words = [ "表情包", "图片", "回复", "聊天记录" ]
|
memory_ban_words = [ "表情包", "图片", "回复", "聊天记录" ]
|
||||||
|
|||||||
Reference in New Issue
Block a user