mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-10-06 02:47:54 +00:00
made pageToMemory work
This commit is contained in:
parent
439032568a
commit
d70c0887d5
1 changed files with 10 additions and 6 deletions
|
|
@ -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({
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue