diff --git a/src/vs/workbench/contrib/void/electron-main/llmMessage/sendLLMMessage.impl.ts b/src/vs/workbench/contrib/void/electron-main/llmMessage/sendLLMMessage.impl.ts index 0402dbd6..15033341 100644 --- a/src/vs/workbench/contrib/void/electron-main/llmMessage/sendLLMMessage.impl.ts +++ b/src/vs/workbench/contrib/void/electron-main/llmMessage/sendLLMMessage.impl.ts @@ -76,8 +76,14 @@ const openAICompatibleErrorMessageFromParsedBody = (parsed: unknown, rawText: st return `HTTP ${status}` } -const openAITolerantFetch: typeof fetch = async (input, init) => { - const res = await globalThis.fetch(input, init as RequestInit) +type OpenAIClientFetchArgs = Parameters> + +/** OpenAI typings use node-fetch shapes in Node; Electron uses global fetch — bridge with explicit casts. */ +const openAITolerantFetch = (async (url: OpenAIClientFetchArgs[0], init?: OpenAIClientFetchArgs[1]) => { + const res = await globalThis.fetch( + url as string | URL | Request, + init as Parameters[1], + ) if (res.ok) return res const rawText = await res.text().catch(() => '') @@ -93,7 +99,7 @@ const openAITolerantFetch: typeof fetch = async (input, init) => { statusText: res.statusText, headers: res.headers, }) -} +}) as unknown as NonNullable // ------------ OPENAI-COMPATIBLE (HELPERS) ------------