mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-05-05 23:40:57 +00:00
Another Failed Attempt at streaming
This commit is contained in:
parent
f28f566473
commit
a7cca293a6
3 changed files with 48 additions and 39 deletions
|
|
@ -3,6 +3,8 @@ import { ensureAuth } from "../ensureAuth";
|
|||
|
||||
export const runtime = "edge";
|
||||
|
||||
// ERROR #2 - This the the next function that calls the backend, I sometimes think this is redundency, but whatever
|
||||
// I have commented the auth code, It should not work in development, but it still does sometimes
|
||||
export async function POST(request: NextRequest) {
|
||||
// const d = await ensureAuth(request);
|
||||
// if (!d) {
|
||||
|
|
@ -11,10 +13,17 @@ export async function POST(request: NextRequest) {
|
|||
const res : {context: string, request: string} = await request.json()
|
||||
|
||||
try {
|
||||
const response = await fetch(`${process.env.BACKEND_BASE_URL}/api/editorai?context=${res.context}&request=${res.request}`);
|
||||
return new Response(response.body, { status: 200 });
|
||||
// const result = await response.json();
|
||||
// return new Response(JSON.stringify(result));
|
||||
const resp = await fetch(`${process.env.BACKEND_BASE_URL}/api/editorai?context=${res.context}&request=${res.request}`);
|
||||
// this just checks if there are erros I am keeping it commented for you to better understand the important pieces
|
||||
// if (resp.status !== 200 || !resp.ok) {
|
||||
// const errorData = await resp.text();
|
||||
// console.log(errorData);
|
||||
// return new Response(
|
||||
// JSON.stringify({ message: "Error in CF function", error: errorData }),
|
||||
// { status: resp.status },
|
||||
// );
|
||||
// }
|
||||
return new Response(resp.body, { status: 200 });
|
||||
} catch (error) {
|
||||
return new Response(`Error, ${error}`)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue