Repository navigation
Calculate AI usage costs with cached token pricing - #929
Conversation
seafile-dev
left a comment
There was a problem hiding this comment.
结论:未发现缓存 token 采集消费、折扣计价或持久化的阻断缺陷;有一项测试接入警告,见行内评论。审查绑定 head 44663bc。
新增四项单元测试手动执行全部通过。使用真实生产源码消费四种 provider × 三种调用路径生成的 usage payload,在 MariaDB 11.4 三张实际 schema 上验证缓存子集、折扣费用及重复 flush 汇总正确;配置缺省和显式零价均有单元测试覆盖。探针替代了 Redis、归属查询和 SQLAlchemy 传输,不是生产部署 E2E。
当前 head 的 build 检查 131658550946 和 Actions 运行 43356150142 成功,但日志只显示原有 6 项 SQL 与 16 项 webhook 测试,未执行新增缓存计价测试;combined status 仍显示 pending。发布前必须先完成三张表的 schema 升级,并协调 AI 生产端及价格配置。未提供设计文档。
| @@ -0,0 +1,93 @@ | |||
| """Exercise statistics without initializing deployment config, Redis or MySQL.""" | |||
There was a problem hiding this comment.
[Warning] 新计价测试未接入 CI
影响:当前工作流仅调用 test.sh 的 SQL 测试和 dtable_events.webhook.tests,不会发现此目录的四项新测试;本次成功的 CI 日志也只有原有 6 项和 16 项测试。因此缓存扣费、默认价格及三表写入回归仍可能在 CI 全绿时漏过。
建议修复:在工作流或 run_tests 中显式执行 python -m unittest discover -s tests -p test_cached_tokens.py -v,并让失败退出码传递给 Actions。
No description provided.