Skip to content

Commit

Permalink
chore: override stream.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
louisjoecodes committed Dec 14, 2024
1 parent f8c4476 commit b2ce3df
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/core/streaming-fetcher/Stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,13 @@ export class Stream<T> implements AsyncIterable<T> {
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;
}
}
Expand Down

0 comments on commit b2ce3df

Please sign in to comment.