Skip to content

Commit

Permalink
Ensure decoder.decode handle cases where the input ends in the midd…
Browse files Browse the repository at this point in the history
…le of non-English character (#28)

Ensure that the decoder.decode function can properly handle instances
where the input stream ends mid-way through a multi-byte, non-English
character. For more details, refer to the discussion at [Issue #184 on
the encoding GitHub
page](whatwg/encoding#184 (comment)).
  • Loading branch information
blrchen committed Jan 20, 2024
1 parent 16eeb74 commit 50d05e1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/v1/chat/completions/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ async function chat(apiKey: string, body: any) {
if (done) {
controller.close()
}
let data = decoder.decode(value)
let data = decoder.decode(value, { stream: true })
if (isFirstEventData) {
isFirstEventData = false
if (shouldRetry(data)) {
Expand Down

0 comments on commit 50d05e1

Please sign in to comment.