Skip to content

Commit

Permalink
Merge pull request #322 from thivy/main
Browse files Browse the repository at this point in the history
close stream on error and abort
  • Loading branch information
thivy authored Feb 12, 2024
2 parents 6ff8264 + 6bfaba9 commit 55dbe1e
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export const OpenAIStream = (props: {
response: "Chat aborted",
};
streamResponse(response.type, JSON.stringify(response));
controller.close();
})
.on("error", async (error) => {
console.log("🔴 error", error);
Expand All @@ -87,6 +88,7 @@ export const OpenAIStream = (props: {
});

streamResponse(response.type, JSON.stringify(response));
controller.close();
})
.on("finalContent", async (content: string) => {
await CreateChatMessage({
Expand Down

0 comments on commit 55dbe1e

Please sign in to comment.