From d70c0887d55356f745c985bb6a834a0fe9c06f30 Mon Sep 17 00:00:00 2001 From: Dhravya Date: Sat, 13 Apr 2024 20:23:22 -0700 Subject: [PATCH] made pageToMemory work --- apps/web/src/actions/db.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/apps/web/src/actions/db.ts b/apps/web/src/actions/db.ts index 23f9a7ad..4d55d185 100644 --- a/apps/web/src/actions/db.ts +++ b/apps/web/src/actions/db.ts @@ -250,6 +250,8 @@ export async function addMemory( const data = await resp.text(); + console.log(data); + content.content = data; } @@ -257,6 +259,8 @@ export async function addMemory( return null; } + console.log({ ...content, user: user.email }); + // Add to vectorDB const res = (await Promise.race([ fetch("https://cf-ai-backend.dhravya.workers.dev/add", { @@ -264,18 +268,18 @@ export async function addMemory( headers: { "X-Custom-Auth-Key": env.BACKEND_SECURITY_KEY, }, - body: JSON.stringify({ ...content, user: user.email }), + body: JSON.stringify({ + pageContent: content.content, + url: content.url, + spaces, + user: user.email, + }), }), new Promise((_, reject) => setTimeout(() => reject(new Error("Request timed out")), 40000), ), ])) as Response; - if (res.status !== 200) { - console.log(res.status, res.statusText); - return null; - } - const [addedMemory] = await db .insert(storedContent) .values({