From be69cfb9668a1a436e816f99a7d8c32e546af781 Mon Sep 17 00:00:00 2001 From: Archer <545436317@qq.com> Date: Tue, 14 Mar 2023 15:13:22 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=AF=B7=E6=B1=82=E5=A4=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/api/chat/chatGpt.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/pages/api/chat/chatGpt.ts b/src/pages/api/chat/chatGpt.ts index 9fb3fdb8d..9d9cf768e 100644 --- a/src/pages/api/chat/chatGpt.ts +++ b/src/pages/api/chat/chatGpt.ts @@ -80,6 +80,11 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) ); // 创建响应流 + res.setHeader('Content-Type', 'text/event-stream;charset-utf-8'); + res.setHeader('Access-Control-Allow-Origin', '*'); + res.setHeader('X-Accel-Buffering', 'no'); + res.setHeader('Cache-Control', 'no-cache, no-transform'); + const pass = new PassThrough(); pass.pipe(res);