mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-02-23 17:59:49 +08:00
feat: update payload config
This commit is contained in:
parent
49fc75235a
commit
1161adaa9f
@ -4,7 +4,7 @@ import { NextRequest } from "next/server";
|
||||
|
||||
const apiKey = process.env.OPENAI_API_KEY;
|
||||
|
||||
async function createStream(payload: string) {
|
||||
async function createStream(payload: ReadableStream<Uint8Array>) {
|
||||
const encoder = new TextEncoder();
|
||||
const decoder = new TextDecoder();
|
||||
|
||||
@ -52,8 +52,7 @@ async function createStream(payload: string) {
|
||||
export async function POST(req: NextRequest) {
|
||||
try {
|
||||
console.log("Request", req);
|
||||
const body = await req.text();
|
||||
const stream = await createStream(body);
|
||||
const stream = await createStream(req.body!);
|
||||
return new Response(stream);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
|
Loading…
Reference in New Issue
Block a user