From 020d96cf03946a630e62b8dc8f0317d424775a4a Mon Sep 17 00:00:00 2001 From: Louis Jordan Date: Sat, 14 Dec 2024 13:26:48 +0000 Subject: [PATCH] fix: apply fix manually --- src/core/streaming-fetcher/Stream.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/core/streaming-fetcher/Stream.ts b/src/core/streaming-fetcher/Stream.ts index dccdb79..62db6ce 100644 --- a/src/core/streaming-fetcher/Stream.ts +++ b/src/core/streaming-fetcher/Stream.ts @@ -90,9 +90,14 @@ export class Stream implements AsyncIterable { return; } - // Otherwise, yield message from the prefix to the terminator - const message = await this.parse(JSON.parse(line)); - yield message; + // (Louis custom fix do not override) Trim whitespace and check if line is not empty + // Reason: ElevenLabs occasionally returns empty chunks + const trimmedLine = line.trim(); + if (trimmedLine) { + const message = await this.parse(JSON.parse(trimmedLine)); + yield message; + } + prefixSeen = false; } }