mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
Sliding window fix
This commit is contained in:
parent
4c5045dd92
commit
1d67f88aba
1 changed files with 4 additions and 2 deletions
|
|
@ -55,13 +55,15 @@ export function truncateConversationIfNeeded(
|
|||
/**
|
||||
* Calculates the maximum allowed tokens for models that support prompt caching.
|
||||
*
|
||||
* The maximum is computed as the greater of (contextWindow - 40000) and 80% of the contextWindow.
|
||||
* The maximum is computed as the greater of (contextWindow - buffer) and 80% of the contextWindow.
|
||||
*
|
||||
* @param {ModelInfo} modelInfo - The model information containing the context window size.
|
||||
* @returns {number} The maximum number of tokens allowed for prompt caching models.
|
||||
*/
|
||||
function getMaxTokensForPromptCachingModels(modelInfo: ModelInfo): number {
|
||||
return Math.max(modelInfo.contextWindow - 40_000, modelInfo.contextWindow * 0.8)
|
||||
// The buffer needs to be at least as large as `modelInfo.maxTokens`.
|
||||
const buffer = modelInfo.maxTokens ? Math.max(40_000, modelInfo.maxTokens) : 40_000
|
||||
return Math.max(modelInfo.contextWindow - buffer, modelInfo.contextWindow * 0.8)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue