bug: only show tool tokens if > 0 (#985)

This commit is contained in:
Abhi 2025-06-12 15:31:17 -04:00 committed by GitHub
parent 6bb3f27f6c
commit 32da693b91
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 17 additions and 6 deletions

View File

@ -66,6 +66,17 @@ describe('<StatsColumn />', () => {
);
expect(lastFrame()).toMatchSnapshot();
});
it('hides the tool use row when there are no tool use tokens', () => {
const statsWithNoToolUse: FormattedStats = {
...mockStats,
toolUseTokens: 0,
};
const { lastFrame } = render(
<StatsColumn title="Test Stats" stats={statsWithNoToolUse} />,
);
expect(lastFrame()).not.toContain('Tool Use Tokens');
});
});
describe('<DurationColumn />', () => {

View File

@ -66,10 +66,12 @@ export const StatsColumn: React.FC<{
label="Output Tokens"
value={stats.outputTokens.toLocaleString()}
/>
<StatRow
label="Tool Use Tokens"
value={stats.toolUseTokens.toLocaleString()}
/>
{stats.toolUseTokens > 0 && (
<StatRow
label="Tool Use Tokens"
value={stats.toolUseTokens.toLocaleString()}
/>
)}
<StatRow
label="Thoughts Tokens"
value={stats.thoughtsTokens.toLocaleString()}

View File

@ -32,7 +32,6 @@ exports[`<SessionSummaryDisplay /> > renders zero state correctly 1`] = `
│ │
│ Input Tokens 0 │
│ Output Tokens 0 │
│ Tool Use Tokens 0 │
│ Thoughts Tokens 0 │
│ Cached Tokens 0 │
│ ────────────────────────── │

View File

@ -30,7 +30,6 @@ exports[`<StatsDisplay /> > renders zero state correctly 1`] = `
│ │
│ Input Tokens 0 Input Tokens 0 │
│ Output Tokens 0 Output Tokens 0 │
│ Tool Use Tokens 0 Tool Use Tokens 0 │
│ Thoughts Tokens 0 Thoughts Tokens 0 │
│ Cached Tokens 0 Cached Tokens 0 │
│ ───────────────────────────────────────────── ───────────────────────────────────────────── │