Merge pull request #45 from Psypeal/main
fix: correct context badge count to sum actual items instead of injection objects (#2)
This commit is contained in:
commit
60b0364ab9
1 changed files with 13 additions and 8 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,10 +489,7 @@ export const ContextBadge = ({
|
|||
{newToolOutputInjections.length > 0 && (
|
||||
<PopoverSection
|
||||
title="Tool Outputs"
|
||||
count={newToolOutputInjections.reduce(
|
||||
(sum, inj) => sum + inj.toolBreakdown.length,
|
||||
0
|
||||
)}
|
||||
count={toolOutputCount}
|
||||
tokenCount={toolOutputTokens}
|
||||
>
|
||||
{newToolOutputInjections.map((injection) =>
|
||||
|
|
@ -504,10 +512,7 @@ export const ContextBadge = ({
|
|||
{newTaskCoordinationInjections.length > 0 && (
|
||||
<PopoverSection
|
||||
title="Task Coordination"
|
||||
count={newTaskCoordinationInjections.reduce(
|
||||
(sum, inj) => sum + inj.breakdown.length,
|
||||
0
|
||||
)}
|
||||
count={taskCoordinationCount}
|
||||
tokenCount={taskCoordinationTokens}
|
||||
>
|
||||
{newTaskCoordinationInjections.map((injection) =>
|
||||
|
|
|
|||
Loading…
Reference in a new issue