fix(memory_recall): add jieba keyword extraction for natural language queries

This commit is contained in:
root
2026-07-25 18:27:36 +08:00
parent 634c3ff4ad
commit db4844c6c6

View File

@ -115,7 +115,12 @@ func (a *Agent) executeMemoryTool(tc agentAPI.ToolCall) string {
if query == "" {
return "请输入查询关键词"
}
result, err := a.memory.Recall(strings.Split(query, ","), nil, int(depth), "")
// 关键词提取:支持逗号分隔和自然语言
keywords := strings.Split(query, ",")
if len(keywords) == 1 {
keywords = memory.ExtractKeywords(query)
}
result, err := a.memory.Recall(keywords, nil, int(depth), "")
if err != nil {
return fmt.Sprintf("记忆检索失败: %v", err)
}