From 4ad7ef84a4357e57232dd9a7db5a9e5be0335c74 Mon Sep 17 00:00:00 2001 From: Arman Ordookhani Date: Fri, 26 Apr 2024 15:45:29 +0200 Subject: [PATCH] add else --- src/lib/apis/streaming/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/apis/streaming/index.ts b/src/lib/apis/streaming/index.ts index a0d12c31a..3023cd6f4 100644 --- a/src/lib/apis/streaming/index.ts +++ b/src/lib/apis/streaming/index.ts @@ -31,7 +31,7 @@ async function* openAIStreamToIterator( console.log(line); if (line === 'data: [DONE]') { yield { done: true, value: '' }; - } if (line.startsWith(':')) { + } else if (line.startsWith(':')) { // Events starting with : are comments https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#event_stream_format // OpenRouter sends heartbeats like ": OPENROUTER PROCESSING" continue