From cc053b148d6487c83a2dd647059e0cfa7314fe16 Mon Sep 17 00:00:00 2001 From: Yifei Zhang Date: Mon, 17 Apr 2023 11:27:31 +0800 Subject: [PATCH 1/3] fix: #853 fetch duplex errors --- app/api/common.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/app/api/common.ts b/app/api/common.ts index 53ab18ed6..089dbf02a 100644 --- a/app/api/common.ts +++ b/app/api/common.ts @@ -25,5 +25,6 @@ export async function requestOpenai(req: NextRequest) { }, method: req.method, body: req.body, + duplex: !!req.body, }); } From 76ef5ef9a9872e1d3f30e9d201d9ac2546010156 Mon Sep 17 00:00:00 2001 From: Yifei Zhang Date: Mon, 17 Apr 2023 11:34:33 +0800 Subject: [PATCH 2/3] fixup --- app/api/common.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/api/common.ts b/app/api/common.ts index 089dbf02a..65870ee91 100644 --- a/app/api/common.ts +++ b/app/api/common.ts @@ -25,6 +25,6 @@ export async function requestOpenai(req: NextRequest) { }, method: req.method, body: req.body, - duplex: !!req.body, + duplex: !!req.body ? "half" : "", }); } From b79845fcaa5fce0da272b88564bf02d8252570c0 Mon Sep 17 00:00:00 2001 From: Yifei Zhang Date: Mon, 17 Apr 2023 11:36:32 +0800 Subject: [PATCH 3/3] fixup --- app/api/common.ts | 1 - app/api/openai/route.ts | 6 +++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/api/common.ts b/app/api/common.ts index 65870ee91..53ab18ed6 100644 --- a/app/api/common.ts +++ b/app/api/common.ts @@ -25,6 +25,5 @@ export async function requestOpenai(req: NextRequest) { }, method: req.method, body: req.body, - duplex: !!req.body ? "half" : "", }); } diff --git a/app/api/openai/route.ts b/app/api/openai/route.ts index 261c20a85..0ac94bdd5 100644 --- a/app/api/openai/route.ts +++ b/app/api/openai/route.ts @@ -17,7 +17,7 @@ async function makeRequest(req: NextRequest) { }, { status: 500, - }, + } ); } } @@ -29,3 +29,7 @@ export async function POST(req: NextRequest) { export async function GET(req: NextRequest) { return makeRequest(req); } + +export const config = { + runtime: "edge", +};