Repository navigation
feat(web): show each bot chat's model and tool usage - #146
Merged
Merged
Conversation
A bot's details list the tokens and cost of every model and tool its bot chat has used, with a total. Job panes now include the tools bucket in their cost. Closes #105
|
React Doctor found 1 new issue in 1 file · 1 warning · score 85 / 100 (Great) · 0 fixed · vs 1 warning
Reviewed by React Doctor for commit |
# Conflicts: # CHANGELOG.md
| <Row key={`${row.kind}:${row.name}`} row={row} /> | ||
| ))} | ||
| </ul> | ||
| {total && ( |
There was a problem hiding this comment.
React Doctor · react-doctor/rendering-conditional-render (warning)
Your users see a stray '0' on screen when a number before && is zero, so use value > 0, Boolean(value), or a ternary instead.
Fix → Use {items.length > 0 && <List />}, or a ternary like {items.length ? <List /> : null}.
This was referenced Nov 17, 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
A bot's details panel in the web chat has a Usage section listing the tokens and cost of each model and tool its bot chat has used, with a total. The job pane's cost now includes the
toolsbucket too.usageDocument(contract/tool-details.ts) now readstotalTokensand thetoolsbucket. This is a client-side parser only. The snapshot'susagestaysunknownin the OpenAPI spec, so the API doesn't change.usage.tsreplacescostLineinjobs.tsx. Models show by model ID, tools by name with "(tool)", and tokens use the compact format ("12K tokens"). A zero cost isn't shown, as before. The section shows "No usage yet" before the first request.jobs.test.tsmoved tochat/usage.test.tswith the helper.Closes #105
Why
Chat usage, including vision model costs, reached the chat snapshot API, but the web showed none of it. The job pane's cost left out the
toolsbucket, where intent-check costs are recorded.Evidence
bun run checkpasses on the branch: lint, format, typecheck,openapi:check, and 1318 tests, 0 failing. Theapps/docscheck passes.usage.test.tscase:costLinecounts the tools bucket ($3.0000for one model and one tool at $1.50 each; the oldcostLinereturned$1.5000). Further cases cover row order, a document that doesn't parse, and token formatting.chat-usage.dom.test.tsx: rows with tokens, cost, and total; tokens without a cost for a provider that reports zero; "No usage yet".Risk and rollback
Reversibility: Reversible.
Blast radius: The web bot details panel and sheet, and the cost in the job pane subtitle.