mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
Fix incorrect reserved tokens calculation on OpenRouter (#3626)
fix: improve token reservation logic in calculateTokenDistribution
This commit is contained in:
parent
05777d3bfd
commit
74dcedd35b
1 changed files with 2 additions and 1 deletions
|
|
@ -100,7 +100,8 @@ export const calculateTokenDistribution = (
|
|||
|
||||
// Get the actual max tokens value from the model
|
||||
// If maxTokens is valid, use it, otherwise reserve 20% of the context window as a default
|
||||
const reservedForOutput = maxTokens && maxTokens > 0 ? maxTokens : Math.ceil(safeContextWindow * 0.2)
|
||||
const reservedForOutput =
|
||||
maxTokens && maxTokens > 0 && maxTokens !== safeContextWindow ? maxTokens : Math.ceil(safeContextWindow * 0.2)
|
||||
|
||||
// Calculate sizes directly without buffer display
|
||||
const availableSize = Math.max(0, safeContextWindow - safeContextTokens - reservedForOutput)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue