mirror of
https://github.com/sst/opencode.git
synced 2025-08-24 15:04:10 +00:00
fix: calculate max output tokens based on budget thinking tokens
This commit is contained in:
parent
50fb337270
commit
bc85f92232
1 changed files with 7 additions and 1 deletions
|
@ -947,7 +947,13 @@ export namespace Session {
|
||||||
},
|
},
|
||||||
maxRetries: 3,
|
maxRetries: 3,
|
||||||
activeTools: Object.keys(tools).filter((x) => x !== "invalid"),
|
activeTools: Object.keys(tools).filter((x) => x !== "invalid"),
|
||||||
maxOutputTokens: outputLimit,
|
maxOutputTokens: Math.max(
|
||||||
|
1,
|
||||||
|
outputLimit -
|
||||||
|
(input.providerID === "anthropic"
|
||||||
|
? ((params.options as { thinking?: { budgetTokens?: number } } | undefined)?.thinking?.budgetTokens ?? 0)
|
||||||
|
: 0),
|
||||||
|
),
|
||||||
abortSignal: abort.signal,
|
abortSignal: abort.signal,
|
||||||
stopWhen: async ({ steps }) => {
|
stopWhen: async ({ steps }) => {
|
||||||
if (steps.length >= 1000) {
|
if (steps.length >= 1000) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue