From 70306295eb0a16b0e0515202bf40bab71fa39144 Mon Sep 17 00:00:00 2001 From: allen Date: Mon, 24 Jul 2023 11:55:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3Content-type=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20(#135)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit charset-utf-8应该为charset=utf-8,会导致部分三方优先判断Content-type错误null Co-authored-by: liukai --- client/src/pages/api/openapi/v1/chat/completions.ts | 2 +- client/src/service/utils/chat/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/src/pages/api/openapi/v1/chat/completions.ts b/client/src/pages/api/openapi/v1/chat/completions.ts index b0f7a4f85..0bcda9e66 100644 --- a/client/src/pages/api/openapi/v1/chat/completions.ts +++ b/client/src/pages/api/openapi/v1/chat/completions.ts @@ -223,7 +223,7 @@ export default withNextCors(async function handler(req: NextApiRequest, res: Nex } = await (async () => { if (stream) { // 创建响应流 - res.setHeader('Content-Type', 'text/event-stream;charset-utf-8'); + res.setHeader('Content-Type', 'text/event-stream;charset=utf-8'); res.setHeader('Access-Control-Allow-Origin', '*'); res.setHeader('Transfer-Encoding', 'chunked'); res.setHeader('X-Accel-Buffering', 'no'); diff --git a/client/src/service/utils/chat/index.ts b/client/src/service/utils/chat/index.ts index 22d66c71e..2b67cf2d5 100644 --- a/client/src/service/utils/chat/index.ts +++ b/client/src/service/utils/chat/index.ts @@ -122,7 +122,7 @@ export const resStreamResponse = async ({ model: ChatModelType; }) => { // 创建响应流 - res.setHeader('Content-Type', 'text/event-stream;charset-utf-8'); + 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');