19 lines
444 B
TypeScript
19 lines
444 B
TypeScript
export async function POST(req: Request) {
|
|
const body = await req.json();
|
|
|
|
const response = await fetch("http://backend:8000/api/chat", {
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
},
|
|
body: JSON.stringify(body),
|
|
});
|
|
|
|
return new Response(response.body, {
|
|
headers: {
|
|
"Content-Type": "text/event-stream",
|
|
"Cache-Control": "no-cache",
|
|
"X-Accel-Buffering": "no",
|
|
},
|
|
});
|
|
} |