Skip to content

Commit

Permalink
fix(stream-text): text decode in stream mode (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
iseki0 authored Jan 18, 2025
1 parent 34970df commit e0ea738
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/stream-text/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const streamText = async (options: StreamTextOptions): Promise<StreamText
// null body handled by import('@xsai/shared-chat').chat()
const rawChunkStream = res.body!.pipeThrough(new TransformStream({
transform: async (chunk, controller) => {
buffer += decoder.decode(chunk)
buffer += decoder.decode(chunk, { stream: true })
const lines = buffer.split('\n\n')
buffer = lines.pop() || ''

Expand Down

0 comments on commit e0ea738

Please sign in to comment.