feat: LLM 调用日志 + ModelSelector 优化 + devtools.bat 编码修复

- 新增 call_log.go: 全局环形缓冲区记录每次 LLM 调用(模型/Token/耗时/错误)
- OpenAIProvider.doChat/ChatStreamWithTools 自动记录调用日志
- ai-core 暴露 GET /api/v1/llm-calls 端点, DevTools 代理 + UI 面板
- ModelSelector.envProvider 改为单例缓存, 避免重复创建 HTTP Client
- 新增 PurposeToolCalling 适配器, 后台思考工具调用走专用路由
- envFallback 超时 120s→180s, 显式设置 MaxRetries
- devtools.bat 全英文, 解决 Windows CMD GBK 编码乱码问题

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-24 15:44:53 +08:00
parent 7eb5e984c2
commit 47f9de2409
8 changed files with 266 additions and 22 deletions
+2 -2
View File
@@ -2,7 +2,7 @@
setlocal enabledelayedexpansion
:: ========================================
:: Cyrene DevTools CLI (Windows CMD)
:: 用法: devtools.bat [命令] [选项]
:: Usage: devtools.bat [command] [options]
:: ========================================
set "SCRIPT_DIR=%~dp0"
@@ -13,7 +13,7 @@ set "LOG_DIR=%DEVTOOLS_DIR%\logs"
set "LOG_FILE=%LOG_DIR%\sh.log"
set "DB_COMPOSE_FILE=%ROOT%docker-compose.dev.db.yml"
:: 解析第一个参数作为命令
:: Parse first argument as command
set CMD=%1
if "%CMD%"=="" set CMD=start
if "%CMD%"=="help" goto :help