fix(audit): keep token usage when media input is present - #934
Open
buddhism5080 wants to merge 2 commits into
Open
fix(audit): keep token usage when media input is present#934buddhism5080 wants to merge 2 commits into
buddhism5080 wants to merge 2 commits into
Conversation
Media-bearing chat/image/video rows replaced the 输入/缓存/输出/推理 grid with Media Input counts. Show both, and use an em dash when token usage was not reported.
Keep the media row distinct from the token 输出 cell.
realotz
pushed a commit
to realotz/grok2api
that referenced
this pull request
Aug 15, 2026
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.
Summary
Audit list rows with media input no longer replace the token grid.
Media Input/outputstay on the first row;输入/输出/缓存/推理stay below.Missing token usage (
usageSource === "none") shows—; reported zeros still show0.带 media 输入的审计行不再整块换成 Media Usage。
第一行保留
Media Input/output;下面仍显示输入/输出/缓存/推理。未上报 token(
usageSource === "none")用—占位;已上报的0仍显示数字。Context
Chat/image/video rows with
mediaInputImages > 0previously swapped the whole usage cell toMediaUsage, so token counts disappeared even when the backend already stored them.只要
mediaInputImages > 0(带图 chat 也会中招),UsageDetails会整块换成MediaUsage,后端已有的 token 用量在列表里看不见。Test plan
node --experimental-strip-types --test frontend/src/features/audits/audit-usage.test.ts(6/6)Sabotage run: dropping token items on media rows fails the new tests; restore passes
pnpm exec tsc -bUI: media chat row shows 3×2 grid (
Media Input/output, then token four-pack)UI: missing token usage shows
—; reported0still shows0UI: plain chat without media stays 2×2
视图模型单测 6/6 通过
破坏验证:有 media 时去掉 token 四格会红;恢复后转绿
tsc -b通过界面:带图 chat 显示 3 行 2 列
界面:缺 token 显示
—;已上报的0仍是数字界面:无 media 的普通 chat 仍是 2×2