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]
|
[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(
|
const userMessageTokens = useMemo(
|
||||||
() => newUserMessageInjections.reduce((sum, inj) => sum + inj.estimatedTokens, 0),
|
() => newUserMessageInjections.reduce((sum, inj) => sum + inj.estimatedTokens, 0),
|
||||||
[newUserMessageInjections]
|
[newUserMessageInjections]
|
||||||
|
|
@ -478,10 +489,7 @@ export const ContextBadge = ({
|
||||||
{newToolOutputInjections.length > 0 && (
|
{newToolOutputInjections.length > 0 && (
|
||||||
<PopoverSection
|
<PopoverSection
|
||||||
title="Tool Outputs"
|
title="Tool Outputs"
|
||||||
count={newToolOutputInjections.reduce(
|
count={toolOutputCount}
|
||||||
(sum, inj) => sum + inj.toolBreakdown.length,
|
|
||||||
0
|
|
||||||
)}
|
|
||||||
tokenCount={toolOutputTokens}
|
tokenCount={toolOutputTokens}
|
||||||
>
|
>
|
||||||
{newToolOutputInjections.map((injection) =>
|
{newToolOutputInjections.map((injection) =>
|
||||||
|
|
@ -504,10 +512,7 @@ export const ContextBadge = ({
|
||||||
{newTaskCoordinationInjections.length > 0 && (
|
{newTaskCoordinationInjections.length > 0 && (
|
||||||
<PopoverSection
|
<PopoverSection
|
||||||
title="Task Coordination"
|
title="Task Coordination"
|
||||||
count={newTaskCoordinationInjections.reduce(
|
count={taskCoordinationCount}
|
||||||
(sum, inj) => sum + inj.breakdown.length,
|
|
||||||
0
|
|
||||||
)}
|
|
||||||
tokenCount={taskCoordinationTokens}
|
tokenCount={taskCoordinationTokens}
|
||||||
>
|
>
|
||||||
{newTaskCoordinationInjections.map((injection) =>
|
{newTaskCoordinationInjections.map((injection) =>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue