mirror of
https://github.com/sst/opencode.git
synced 2025-12-23 10:11:41 +00:00
fix: timeout param that allows user to disable provider timeout (#3443)
This commit is contained in:
parent
187a5fe301
commit
ae62bc8b1f
1 changed files with 2 additions and 2 deletions
|
|
@ -422,14 +422,14 @@ export namespace Provider {
|
|||
const modPath =
|
||||
provider.id === "google-vertex-anthropic" ? `${installedPath}/dist/anthropic/index.mjs` : installedPath
|
||||
const mod = await import(modPath)
|
||||
if (options["timeout"] !== undefined) {
|
||||
if (options["timeout"] !== undefined && options["timeout"] !== null) {
|
||||
// Only override fetch if user explicitly sets timeout
|
||||
options["fetch"] = async (input: any, init?: BunFetchRequestInit) => {
|
||||
const { signal, ...rest } = init ?? {}
|
||||
|
||||
const signals: AbortSignal[] = []
|
||||
if (signal) signals.push(signal)
|
||||
signals.push(AbortSignal.timeout(options["timeout"]))
|
||||
if (options["timeout"] !== false) signals.push(AbortSignal.timeout(options["timeout"]))
|
||||
|
||||
const combined = signals.length > 1 ? AbortSignal.any(signals) : signals[0]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue