forked from XiaoMo/ChatGPT-Next-Web
api: set Content-Type to json
This avoids issues in browsers like WeChat where the encoding is incorrect and the summary feature does not work if it contains zh-CN characters.
This commit is contained in:
parent
0385f6ede9
commit
83cea2adb8
@ -3,8 +3,10 @@ import { requestOpenai } from "../common";
|
||||
|
||||
async function makeRequest(req: NextRequest) {
|
||||
try {
|
||||
const res = await requestOpenai(req);
|
||||
return new Response(res.body);
|
||||
const api = await requestOpenai(req);
|
||||
const res = new NextResponse(api.body);
|
||||
res.headers.set('Content-Type', 'application/json');
|
||||
return res;
|
||||
} catch (e) {
|
||||
console.error("[OpenAI] ", req.body, e);
|
||||
return NextResponse.json(
|
||||
|
Loading…
Reference in New Issue
Block a user