refactor(memory): 完全移除旧记忆系统,全面切换到新记忆图系统
重大变更: - 移除 default_generator.py 中对旧增强记忆系统的所有调用 - 移除 prompt.py 中的记忆构建函数 - 记忆检索全面使用新记忆图系统 - 禁用旧记忆系统的自动存储逻辑 记忆构建流程: - 记忆创建: LLM 通过 create_memory 工具主动创建 - 记忆检索: default_generator.py 自动检索 - 记忆传递: 通过 pre_built_params 传入 prompt 工具可用性: - CreateMemoryTool: available_for_llm = True - LinkMemoriesTool: available_for_llm = False - SearchMemoriesTool: available_for_llm = False 技术细节: - 提高记忆检索数量 top_k=10 - 降低重要性阈值 min_importance=0.3 - 修复类型错误和警告
This commit is contained in:
@@ -107,7 +107,7 @@ class LinkMemoriesTool(BaseTool):
|
||||
("strength", ToolParamType.FLOAT, "关系强度(0.0-1.0),默认0.7", False, None),
|
||||
]
|
||||
|
||||
available_for_llm = True
|
||||
available_for_llm = False # 暂不对 LLM 开放
|
||||
|
||||
async def execute(self, function_args: dict[str, Any]) -> dict[str, Any]:
|
||||
"""执行关联记忆"""
|
||||
@@ -166,7 +166,7 @@ class SearchMemoriesTool(BaseTool):
|
||||
("min_importance", ToolParamType.FLOAT, "最低重要性阈值(0.0-1.0),只返回重要性不低于此值的记忆", False, None),
|
||||
]
|
||||
|
||||
available_for_llm = True
|
||||
available_for_llm = False # 暂不对 LLM 开放,记忆检索在提示词构建时自动执行
|
||||
|
||||
async def execute(self, function_args: dict[str, Any]) -> dict[str, Any]:
|
||||
"""执行搜索记忆"""
|
||||
@@ -183,7 +183,7 @@ class SearchMemoriesTool(BaseTool):
|
||||
query = function_args.get("query", "")
|
||||
top_k = function_args.get("top_k", 5)
|
||||
min_importance_raw = function_args.get("min_importance")
|
||||
min_importance = float(min_importance_raw) if min_importance_raw is not None else None
|
||||
min_importance = float(min_importance_raw) if min_importance_raw is not None else 0.0
|
||||
|
||||
# 搜索记忆
|
||||
memories = await manager.search_memories(
|
||||
|
||||
Reference in New Issue
Block a user