From 60be949c23cd83badd5da7cca6973984eb4e2452 Mon Sep 17 00:00:00 2001 From: Nate Date: Wed, 11 Dec 2024 07:17:00 -0800 Subject: [PATCH] ts-ignore to fix type error --- core/llm/stream.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/core/llm/stream.ts b/core/llm/stream.ts index b51f1fd36..0a014d931 100644 --- a/core/llm/stream.ts +++ b/core/llm/stream.ts @@ -1,10 +1,15 @@ -async function* toAsyncIterable(nodeReadable: NodeJS.ReadableStream): AsyncGenerator { +async function* toAsyncIterable( + nodeReadable: NodeJS.ReadableStream, +): AsyncGenerator { for await (const chunk of nodeReadable) { + // @ts-ignore yield chunk as Uint8Array; } } -export async function* streamResponse(response: Response): AsyncGenerator { +export async function* streamResponse( + response: Response, +): AsyncGenerator { if (response.status !== 200) { throw new Error(await response.text()); } @@ -19,7 +24,9 @@ export async function* streamResponse(response: Response): AsyncGenerator= 20) { // Use the new API for Node 20 and above const stream = (ReadableStream as any).from(response.body); - for await (const chunk of stream.pipeThrough(new TextDecoderStream("utf-8"))) { + for await (const chunk of stream.pipeThrough( + new TextDecoderStream("utf-8"), + )) { yield chunk; } } else {