fix(agent): correct soft-trim head/tail budget allocation when tail is important (#723)

Co-authored-by: quxy5 <quxy5@outlook.com>
This commit is contained in:
QuXiangyuandquxy5 authored and GitHub committed 2026-04-08 15:52:37 +07:00
1 parent 7fcf03273e
commit 7ef6d1d17a
1 file changed
+2 -2
+2 -2
View File
@@ -205,8 +205,8 @@ func pruneContextMessages(msgs []providers.Message, contextWindowTokens int, cfg
tailChars := settings.softTrimTailChars
if hasImportantTail(msg.Content) {
totalBudget := headChars + tailChars
headChars = totalBudget * 7 / 10
tailChars = totalBudget - headChars
tailChars = totalBudget * 7 / 10
headChars = totalBudget - tailChars
}
head := takeHead(msg.Content, headChars)
tail := takeTail(msg.Content, tailChars)