wunianxiao
|
dcfaf47809
|
fix: token统计+聊天记录入库静默失败, 列名/类型/去重不匹配
根因:insert_llm_usage / insert_chat_record 因旧 iPet 遗留列 (kind/entry NOT NULL,
context_token_present boolean→context_token text) 导致 INSERT 静默失败,
四个调用点 let _ = 吞掉错误。ias usage 显示 token 总量为 0。
修复:
- llm_usage: 迁移 0010 ADD COLUMN IF NOT EXISTS + 条件 DROP NOT NULL,
insert_llm_usage 写入 kind/entry 默认值
- chat_records: 迁移 0011 列名 context_token_present→context_token 类型转换+重命名,
迁移 0012 清理存量重复→partial UNIQUE index→恢复 ON CONFLICT
- main.rs: 所有 let _ = insert_* 改为 if let Err(e) 日志输出,
message_id 缺失时归为 '' 而非 '0'
|
2026-06-02 16:31:48 +08:00 |
|