Repository navigation
修复:请求日志的积分列一直为空(记账时漏拷 snapshot.credit) - #493
Closed
wocaoniubi123 wants to merge 1 commit into
Closed
wocaoniubi123 wants to merge 1 commit into
wocaoniubi123 wants to merge 1 commit into
Conversation
`RequestTelemetry::snapshot()` 已从上游 usage 解析出 credit(WorkBuddy 的 `usage.credit`、Loomy 的 `points_consumed`),但 `record_entry` 只拷了 token 四件套,漏了 credit,于是 `NewRequestEntry.credit` 恒为 None、落库 NULL,界面显示「上游没有返回积分消耗」。实测原始报文里 `usage.credit=0.58`,同一条请求 token 记对了、credit 是 NULL。修后自建 3.4.2 包验证:库内 credit 落 0.05/0.15/0.44/0.54。
Owner
|
感谢反馈,这个问题我已在本地修复,将于下个版本推出更新解决。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
修什么
请求日志的「积分」列一直是空的。成因不是上游不给,而是记账时漏拷:
RequestTelemetry::snapshot()已经从上游usage里解析出credit,但record_entry只拷了 token 四件套,credit没拷,于是NewRequestEntry.credit恒为None→ 落库 NULL → 界面显示「上游没有返回积分消耗」。一行修复:
影响哪些家(实测,不是推断)
修复前用调试流量抓原始 SSE 报文逐家核对
usage里到底有没有积分类字段:usage里的积分CREDIT_KEYS里"credit":0.58credit0.58)"points_consumed":1points_consumed1)——cache_*/cluster—trae/stream.rs把上游usage整个.cloned()透传,所以下发给客户端的就是上游原件 —— 上游确实没给。复现与验证
"usage":{…,"credit":0.58,…};同一条请求 token 记对了(662444)、credit是 NULL。credit落了0.05/0.15/0.44/0.54,界面正常显示。ui/未动 ——frontend-artifacts那道闸不受影响。没做什么
normalize/finalize_interrupted仍然清掉失败请求的用量,这是既有契约)。—的 tooltip 还写着「上游没有返回积分消耗」,对"插件没透传积分"的那几家措辞偏绝对。改它要动 6 语言 i18n,如需要可以另开一个小 PR。🤖 本条回复由 AI Agent 生成