GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: Allow provider timeout override (#1982) · meSingh/opencode@aaff1aa

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages/opencode/src
    • config
      • config.ts
    • provider
      • provider.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/opencode/src/config/config.ts‎

Copy file name to clipboardExpand all lines: packages/opencode/src/config/config.ts
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,21 @@ export namespace Config {
392392
.object({
393393
apiKey: z.string().optional(),
394394
baseURL: z.string().optional(),
395+
timeout: z
396+
.union([
397+
z
398+
.number()
399+
.int()
400+
.positive()
401+
.describe(
402+
"Timeout in milliseconds for requests to this provider. Default is 300000 (5 minutes). Set to false to disable timeout.",
403+
),
404+
z.literal(false).describe("Disable timeout for this provider entirely."),
405+
])
406+
.optional()
407+
.describe(
408+
"Timeout in milliseconds for requests to this provider. Default is 300000 (5 minutes). Set to false to disable timeout.",
409+
),
395410
})
396411
.catchall(z.any())
397412
.optional(),
Collapse file

‎packages/opencode/src/provider/provider.ts‎

Copy file name to clipboardExpand all lines: packages/opencode/src/provider/provider.ts
+8-1Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,9 +320,16 @@ export namespace Provider {
320320
const pkg = provider.npm ?? provider.id
321321
const mod = await import(await BunProc.install(pkg, "latest"))
322322
const fn = mod[Object.keys(mod).find((key) => key.startsWith("create"))!]
323+
let options = { ...s.providers[provider.id]?.options }
324+
if (options["timeout"] !== undefined) {
325+
// Only override fetch if user explicitly sets timeout
326+
options["fetch"] = async (input: any, init?: any) => {
327+
return await fetch(input, { ...init, timeout: options["timeout"] })
328+
}
329+
}
323330
const loaded = fn({
324331
name: provider.id,
325-
...s.providers[provider.id]?.options,
332+
...options,
326333
})
327334
s.sdk.set(provider.id, loaded)
328335
return loaded as SDK

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.