Skip to content

Commit

Permalink
Merge pull request anse-app#128 from LyuLumos/main
Browse files Browse the repository at this point in the history
fix: Chinese characters decoder bug
  • Loading branch information
ddiu8081 committed Jan 22, 2024
2 parents d61b5c6 + df03d34 commit 1c019ea
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/logics/stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const convertReadableStreamToAccessor = async(stream: ReadableStream, set
while (!done) {
const { value, done: readerDone } = await reader.read()
if (value) {
const char = decoder.decode(value)
const char = decoder.decode(value, { stream: true })
if (char) {
text += char
setter(text)
Expand Down
2 changes: 1 addition & 1 deletion src/providers/azure/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const parseStream = (rawResponse: Response) => {
controller.close()
return
}
parser.feed(decoder.decode(value))
parser.feed(decoder.decode(value, { stream: true }))
}
},
})
Expand Down
2 changes: 1 addition & 1 deletion src/providers/google/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const parseStream = (rawResponse: Response) => {
controller.close()
return
}
parser.feed(decoder.decode(value))
parser.feed(decoder.decode(value, { stream: true }))
}
},
})
Expand Down
2 changes: 1 addition & 1 deletion src/providers/openai/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const parseStream = (rawResponse: Response) => {
controller.close()
return
}
parser.feed(decoder.decode(value))
parser.feed(decoder.decode(value, { stream: true }))
}
},
})
Expand Down

0 comments on commit 1c019ea

Please sign in to comment.