tweak: compaction check (#13214)
This commit is contained in:
@@ -41,7 +41,9 @@ export namespace SessionCompaction {
|
|||||||
|
|
||||||
const reserved =
|
const reserved =
|
||||||
config.compaction?.reserved ?? Math.min(COMPACTION_BUFFER, ProviderTransform.maxOutputTokens(input.model))
|
config.compaction?.reserved ?? Math.min(COMPACTION_BUFFER, ProviderTransform.maxOutputTokens(input.model))
|
||||||
const usable = input.model.limit.input ? input.model.limit.input - reserved : context - reserved
|
const usable = input.model.limit.input
|
||||||
|
? input.model.limit.input - reserved
|
||||||
|
: context - ProviderTransform.maxOutputTokens(input.model)
|
||||||
return count >= usable
|
return count >= usable
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user