diff --git a/src/features/chat-page/chat-services/chat-api/open-ai-stream.ts b/src/features/chat-page/chat-services/chat-api/open-ai-stream.ts index 54f0b7363..55f2805f6 100644 --- a/src/features/chat-page/chat-services/chat-api/open-ai-stream.ts +++ b/src/features/chat-page/chat-services/chat-api/open-ai-stream.ts @@ -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); @@ -87,6 +88,7 @@ export const OpenAIStream = (props: { }); streamResponse(response.type, JSON.stringify(response)); + controller.close(); }) .on("finalContent", async (content: string) => { await CreateChatMessage({