feat: 第四轮功能增强 - LLM 思维记忆优化、DevTools 记忆UI、9个新工具、5分钟自我思考

- 优化 LLM 思维方式和记忆方法(类别/重要性/关键词/相似度合并/衰减)
- DevTools 记忆查询 UI 重新设计(类别筛选/排序/星标/搜索)
- 新增 9 个 LLM 工具:calculator, datetime, file_ops, http_request, json_ops, text, random, crypto, markdown
- 管理员主对话 5 分钟自我思考增强(工具调用/记忆提取/记忆维护)
This commit is contained in:
2026-05-18 12:13:49 +08:00
parent 07781eda0e
commit b6ec36886c
20 changed files with 4654 additions and 320 deletions
+29 -2
View File
@@ -97,6 +97,19 @@ func main() {
if getEnvBool("ENABLE_TOOLS", true) {
toolRegistry.Register(tools.NewWebFetchTool())
toolRegistry.Register(tools.NewWebSearchTool())
toolRegistry.Register(tools.NewCalculatorTool())
toolRegistry.Register(tools.NewDateTimeTool())
toolRegistry.Register(tools.NewHTTPTool())
toolRegistry.Register(tools.NewJSONTool())
toolRegistry.Register(tools.NewTextTool())
toolRegistry.Register(tools.NewRandomTool())
toolRegistry.Register(tools.NewCryptoTool())
toolRegistry.Register(tools.NewMarkdownTool())
// File tool uses DATA_DIR or defaults to /tmp/cyrene_data
dataDir := getEnv("DATA_DIR", "/tmp/cyrene_data")
toolRegistry.Register(tools.NewFileTool(dataDir))
if iotClient != nil {
toolRegistry.Register(tools.NewIoTQueryTool(iotClient))
toolRegistry.Register(tools.NewIoTControlTool(iotClient))
@@ -104,9 +117,23 @@ func main() {
log.Printf("工具注册中心已就绪: %d 个工具 (%v)", len(toolRegistry.ListTools()), toolRegistry.ListTools())
}
// 初始化后台思考器
// 初始化后台思考器(增强版:支持工具调用和记忆管理)
thinkerCfg := background.DefaultThinkerConfig()
thinker := background.NewThinker(thinkerCfg, personaLoader, memRetriever, llmAdapter, iotClient)
adminUserID := "admin_admin"
adminSessionID := "admin-session-main"
thinker := background.NewThinker(
thinkerCfg,
personaLoader,
memRetriever,
llmAdapter,
iotClient,
memStore,
memExtractor,
toolRegistry,
convStore,
adminUserID,
adminSessionID,
)
thinker.Start()
defer thinker.Stop()