mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-07-09 17:19:02 +00:00
fix(cli): count only tool groups with real output for compaction
Co-authored-by: Shaojin Wen <shaojin.wensj@alibaba-inc.com>
This commit is contained in:
parent
7f081bc576
commit
595701096f
1 changed files with 11 additions and 4 deletions
|
|
@ -150,15 +150,22 @@ export function useHistory(): UseHistoryManagerReturn {
|
|||
let toolGroupsCompacted = 0;
|
||||
|
||||
let totalThoughts = 0;
|
||||
let totalToolGroups = 0;
|
||||
let totalToolGroupsWithOutput = 0;
|
||||
for (const item of prev) {
|
||||
if (
|
||||
item.type === 'gemini_thought' ||
|
||||
item.type === 'gemini_thought_content'
|
||||
) {
|
||||
totalThoughts++;
|
||||
} else if (item.type === 'tool_group') {
|
||||
totalToolGroups++;
|
||||
} else if (
|
||||
item.type === 'tool_group' &&
|
||||
item.tools.some(
|
||||
(t) =>
|
||||
t.resultDisplay != null &&
|
||||
t.resultDisplay !== UI_COMPACT_CLEARED_MESSAGE,
|
||||
)
|
||||
) {
|
||||
totalToolGroupsWithOutput++;
|
||||
}
|
||||
}
|
||||
const thoughtsToDrop = Math.max(
|
||||
|
|
@ -167,7 +174,7 @@ export function useHistory(): UseHistoryManagerReturn {
|
|||
);
|
||||
const toolGroupsToCompact = Math.max(
|
||||
0,
|
||||
totalToolGroups - UI_COMPACT_KEEP_RECENT,
|
||||
totalToolGroupsWithOutput - UI_COMPACT_KEEP_RECENT,
|
||||
);
|
||||
let thoughtsDropped = 0;
|
||||
let toolGroupsSeen = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue