feat(llm): console_log.llm 控制可读单行流程日志,并追踪路由 AI 决策

autoreply.Service 增加 consoleLog 字段和 logf 辅助;processMessage 中
原本的 printJSON map dump 全部替换为 [llm] 前缀的单行 key=value 输出。
关闭开关时整条链路静默。

把原本传 nil 给 toolrouter.RunAgentToolLoop 的 emit 接进来,将
stream.Frame trace 帧渲染为可读行,区分三类来源:

- 主 AI:main_model / completion / 最终 reply
- 路由 AI:router=<model> prepare/decide iter=N → call_tools=[...] / no_tool
- 工具调用:tool=<name> args=... / result(Nms)=... / ERROR ...

ai.Config 增加 ConsoleLog 字段,由 main.go 传入 cfg.ConsoleLog.LLM,
再透传给 autoreply.NewService。

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-06-19 17:45:21 +08:00
co-authored by Claude
parent 49a287e6e7
commit 8bbe40c230
3 changed files with 105 additions and 87 deletions
+1
View File
@@ -386,6 +386,7 @@ func run(cfg *configpkg.Config) error {
LLMProviders: providerConfigs,
DataDir: cfg.AI.DataDir,
Enabled: cfg.AI.Enabled,
ConsoleLog: cfg.ConsoleLog.LLM,
ToolConfigStore: store,
}, store.DB(), botSenderAdapter)
if err != nil {