From a35cda68730a938a04a7d68c00c06d4d97f9bc25 Mon Sep 17 00:00:00 2001 From: archer <545436317@qq.com> Date: Fri, 24 Mar 2023 14:39:25 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20destroy=E5=90=8E=E4=BB=8D=E6=9C=89push?= =?UTF-8?q?=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/api/chat/chatGpt.ts | 1 + 1 file changed, 1 insertion(+) 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);