mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-20 20:31:37 -05:00
Update max allowed size
This commit is contained in:
@@ -1318,7 +1318,7 @@ ${this.customInstructions.trim()}
|
|||||||
)
|
)
|
||||||
const totalTokens = (tokensIn || 0) + (tokensOut || 0) + (cacheWrites || 0) + (cacheReads || 0)
|
const totalTokens = (tokensIn || 0) + (tokensOut || 0) + (cacheWrites || 0) + (cacheReads || 0)
|
||||||
const contextWindow = this.api.getModel().info.contextWindow
|
const contextWindow = this.api.getModel().info.contextWindow
|
||||||
const maxAllowedSize = Math.max(contextWindow - 20_000, contextWindow * 0.8)
|
const maxAllowedSize = Math.max(contextWindow - 40_000, contextWindow * 0.8)
|
||||||
if (totalTokens >= maxAllowedSize) {
|
if (totalTokens >= maxAllowedSize) {
|
||||||
const truncatedMessages = truncateHalfConversation(this.apiConversationHistory)
|
const truncatedMessages = truncateHalfConversation(this.apiConversationHistory)
|
||||||
await this.overwriteApiConversationHistory(truncatedMessages)
|
await this.overwriteApiConversationHistory(truncatedMessages)
|
||||||
|
|||||||
Reference in New Issue
Block a user