fix(core): honor Codex input limits
This commit is contained in:
parent
80865407e0
commit
b1a61aaf55
10 changed files with 112 additions and 15 deletions
|
|
@ -29,9 +29,10 @@ export function contextUsage(
|
|||
last.tokens.input + last.tokens.output + last.tokens.reasoning + last.tokens.cache.read + last.tokens.cache.write
|
||||
if (tokens <= 0) return
|
||||
const model = models?.find((model) => model.providerID === last.model.providerID && model.id === last.model.id)
|
||||
const limit = model?.limit.input ?? model?.limit.context
|
||||
return {
|
||||
tokens,
|
||||
percent: model?.limit.context ? Math.round((tokens / model.limit.context) * 100) : undefined,
|
||||
percent: limit ? Math.round((tokens / limit) * 100) : undefined,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue