fix: correct context badge count to sum actual items instead of injection objects (#2)
This commit is contained in:
parent
4ec272758c
commit
6e9c6219b2
2 changed files with 15 additions and 4 deletions
|
|
@ -215,6 +215,17 @@ export const ContextBadge = ({
|
|||
[newTaskCoordinationInjections]
|
||||
);
|
||||
|
||||
// Compute actual item counts (not injection-object counts) for accurate badge display
|
||||
const toolOutputCount = useMemo(
|
||||
() => newToolOutputInjections.reduce((sum, inj) => sum + inj.toolCount, 0),
|
||||
[newToolOutputInjections]
|
||||
);
|
||||
|
||||
const taskCoordinationCount = useMemo(
|
||||
() => newTaskCoordinationInjections.reduce((sum, inj) => sum + inj.breakdown.length, 0),
|
||||
[newTaskCoordinationInjections]
|
||||
);
|
||||
|
||||
const userMessageTokens = useMemo(
|
||||
() => newUserMessageInjections.reduce((sum, inj) => sum + inj.estimatedTokens, 0),
|
||||
[newUserMessageInjections]
|
||||
|
|
@ -478,7 +489,7 @@ export const ContextBadge = ({
|
|||
{newToolOutputInjections.length > 0 && (
|
||||
<PopoverSection
|
||||
title="Tool Outputs"
|
||||
count={newToolOutputInjections.length}
|
||||
count={toolOutputCount}
|
||||
tokenCount={toolOutputTokens}
|
||||
>
|
||||
{newToolOutputInjections.map((injection) =>
|
||||
|
|
@ -501,7 +512,7 @@ export const ContextBadge = ({
|
|||
{newTaskCoordinationInjections.length > 0 && (
|
||||
<PopoverSection
|
||||
title="Task Coordination"
|
||||
count={newTaskCoordinationInjections.length}
|
||||
count={taskCoordinationCount}
|
||||
tokenCount={taskCoordinationTokens}
|
||||
>
|
||||
{newTaskCoordinationInjections.map((injection) =>
|
||||
|
|
|
|||
|
|
@ -836,13 +836,13 @@ function computeContextStats(params: ComputeContextStatsParams): ContextStats {
|
|||
newCounts.mentionedFiles++;
|
||||
break;
|
||||
case 'tool-output':
|
||||
newCounts.toolOutputs++;
|
||||
newCounts.toolOutputs += (injection).toolCount;
|
||||
break;
|
||||
case 'thinking-text':
|
||||
newCounts.thinkingText++;
|
||||
break;
|
||||
case 'task-coordination':
|
||||
newCounts.taskCoordination++;
|
||||
newCounts.taskCoordination += (injection).breakdown.length;
|
||||
break;
|
||||
case 'user-message':
|
||||
newCounts.userMessages++;
|
||||
|
|
|
|||
Loading…
Reference in a new issue