diff --git a/src/pages/api/chat/chatGpt.ts b/src/pages/api/chat/chatGpt.ts index 948fd00b3..1d1ee9390 100644 --- a/src/pages/api/chat/chatGpt.ts +++ b/src/pages/api/chat/chatGpt.ts @@ -141,6 +141,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) console.log('pipe error', error); } // close stream + !stream.destroyed && stream.push(null); stream.destroy(); const promptsLen = formatPrompts.reduce((sum, item) => sum + item.content.length, 0);