mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-09-07 08:26:15 +00:00
migrated the search to API v4
This commit is contained in:
parent
4dab6100b9
commit
cfee509950
2 changed files with 8 additions and 5 deletions
|
|
@ -127,11 +127,14 @@ export default defineBackground(() => {
|
|||
try {
|
||||
const responseData = await searchMemories(data)
|
||||
const response = responseData as {
|
||||
results?: Array<{ chunks?: Array<{ content?: string }> }>
|
||||
results?: Array<{ memory?: string }>
|
||||
}
|
||||
const content = response.results?.[0]?.chunks?.[0]?.content
|
||||
console.log("Content:", content)
|
||||
return { success: true, data: content }
|
||||
let memories = "";
|
||||
response.results?.forEach((result, index) => {
|
||||
memories += `[${index + 1}] ${result.memory} `
|
||||
})
|
||||
console.log("Memories:", memories)
|
||||
return { success: true, data: memories }
|
||||
} catch (error) {
|
||||
return {
|
||||
success: false,
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ export async function saveMemory(payload: MemoryPayload): Promise<unknown> {
|
|||
*/
|
||||
export async function searchMemories(query: string): Promise<unknown> {
|
||||
try {
|
||||
const response = await makeAuthenticatedRequest<unknown>("/v3/search", {
|
||||
const response = await makeAuthenticatedRequest<unknown>("/v4/search", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ q: query }),
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue