From a484315699d61e831b7c54119583600153cdce17 Mon Sep 17 00:00:00 2001 From: Louis Date: Thu, 4 Apr 2024 06:37:06 +0700 Subject: [PATCH] fix: wrong response header for non streamed responses (#2606) --- core/src/node/api/restful/helper/builder.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/node/api/restful/helper/builder.ts b/core/src/node/api/restful/helper/builder.ts index 01ab26394..d0247c64c 100644 --- a/core/src/node/api/restful/helper/builder.ts +++ b/core/src/node/api/restful/helper/builder.ts @@ -353,7 +353,7 @@ export const chatCompletions = async (request: any, reply: any) => { reply.code(400).send(response) } else { reply.raw.writeHead(200, { - 'Content-Type': 'text/event-stream', + 'Content-Type': request.body.stream === true ? 'text/event-stream' : 'application/json', 'Cache-Control': 'no-cache', 'Connection': 'keep-alive', 'Access-Control-Allow-Origin': '*',