fix: #410 can not stop response

This commit is contained in:
Yidadaa
2023-04-06 03:19:33 +08:00
parent c2b37f811b
commit 8e560d2b2e
5 changed files with 57 additions and 32 deletions

View File

@@ -53,6 +53,9 @@ export async function POST(req: NextRequest) {
return new Response(stream);
} catch (error) {
console.error("[Chat Stream]", error);
return new Response(
["```json\n", JSON.stringify(error, null, " "), "\n```"].join(""),
);
}
}