fix: 三层记忆/知识库数据泄漏修复 + 系统提示词动态化

问题修复:
- distiller: Append 添加 memDB==nil 守卫,避免数据泄漏
- indexer: 启动时立即 Sync(),消除前30分钟空窗期
- 系统提示词: 移除硬编码的13项工具列表,改为动态分类说明
- doc_query: 消去 Query+Consume 重复搜索,改为 Consume 一次完成
- extractKeyTriples: 从原文 dump 改为规则提取(姓名/居住地/喜好/年龄/职业)
This commit is contained in:
root
2026-07-03 20:55:51 +08:00
parent d4956c23f0
commit 6d1b6b15d6
3 changed files with 188 additions and 28 deletions

View File

@ -986,12 +986,10 @@ func (a *Agent) executeDocTool(tc agentAPI.ToolCall) string {
if query == "" {
return "请输入查询内容"
}
docs := a.docStore.Query(query, topK)
docs := a.docStore.Consume(query, topK)
if len(docs) == 0 {
return "未找到相关文档记忆"
}
// 返回内容后从冷层移除,避免后续自动注入重复
a.docStore.Consume(query, topK)
var parts []string
for i, d := range docs {
parts = append(parts, fmt.Sprintf("[%d] %s (来源: %s)", i+1, d.Summary, d.Source))