fix: wrong response header for non streamed responses (#2606)

This commit is contained in:
Louis 2024-04-04 06:37:06 +07:00 committed by GitHub
parent d579d8a45c
commit a484315699
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -353,7 +353,7 @@ export const chatCompletions = async (request: any, reply: any) => {
reply.code(400).send(response) reply.code(400).send(response)
} else { } else {
reply.raw.writeHead(200, { reply.raw.writeHead(200, {
'Content-Type': 'text/event-stream', 'Content-Type': request.body.stream === true ? 'text/event-stream' : 'application/json',
'Cache-Control': 'no-cache', 'Cache-Control': 'no-cache',
'Connection': 'keep-alive', 'Connection': 'keep-alive',
'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Origin': '*',