This commit is contained in:
yxshv 2024-04-14 14:57:22 +05:30
parent 5b759b2c29
commit fef159cdcb
2 changed files with 10 additions and 4 deletions

View file

@ -424,7 +424,7 @@ export async function updateMemory(
console.log("adding with:", `${updated.url}-${user.email}`)
// Add to vectorDB
const res = (await Promise.race([
fetch("https://cf-ai-backend.dhravya.workers.dev/edit?uniqueUrl="+updated.url , {
fetch("https://cf-ai-backend.dhravya.workers.dev/edit", {
method: "POST",
headers: {
"X-Custom-Auth-Key": env.BACKEND_SECURITY_KEY,
@ -434,6 +434,7 @@ export async function updateMemory(
title: updated.title,
url: updated.url,
user: user.email,
uniqueUrl: updated.url,
}),
}),
new Promise((_, reject) =>
@ -520,11 +521,15 @@ export async function deleteMemory(id: number) {
console.log("adding with:", `${deleted.url}-${user.email}`)
const res = (await Promise.race([
fetch(`https://cf-ai-backend.dhravya.workers.dev/delete?websiteUrl=${deleted.url}&user=${user.email}` , {
fetch(`https://cf-ai-backend.dhravya.workers.dev/delete` , {
method: "DELETE",
headers: {
"X-Custom-Auth-Key": env.BACKEND_SECURITY_KEY,
}
},
body: JSON.stringify({
websiteUrl: deleted.url,
user: user.email
})
}),
new Promise((_, reject) =>
setTimeout(() => reject(new Error("Request timed out")), 40000),

View file

@ -185,7 +185,8 @@ export default function Main({ sidebarOpen }: { sidebarOpen: boolean }) {
}),
},
);
console.log("sources", sourcesResponse)
const sourcesInJson = getIdsFromSource(((await sourcesResponse.json()) as {
ids: string[]