fix: bug fix

This commit is contained in:
n4ze3m
2025-01-25 15:19:28 +05:30
parent 7b6b6751cc
commit 51804bc9ae
29 changed files with 133 additions and 136 deletions

View File

@@ -85,7 +85,6 @@ export class PageAssistVectorStore extends VectorStore {
metadata: documents[idx].metadata,
file_id: this.file_id
}))
console.log(`vector:${this.knownledge_id}`)
await insertVector(`vector:${this.knownledge_id}`, memoryVectors)
}
@@ -118,7 +117,6 @@ export class PageAssistVectorStore extends VectorStore {
const data = await getVector(`vector:${this.knownledge_id}`)
const pgVector = [...data.vectors]
const filteredMemoryVectors = pgVector.filter(filterFunction)
console.log(filteredMemoryVectors)
const searches = filteredMemoryVectors
.map((vector, index) => ({
similarity: this.similarity(query, vector.embedding),
@@ -126,7 +124,6 @@ export class PageAssistVectorStore extends VectorStore {
}))
.sort((a, b) => (a.similarity > b.similarity ? -1 : 0))
.slice(0, k)
console.log(searches)
const result: [Document, number][] = searches.map((search) => [
new Document({
metadata: filteredMemoryVectors[search.index].metadata,

View File

@@ -52,7 +52,7 @@ export const getDataFromCurrentTab = async () => {
resolve(data[0].result)
}
} catch (e) {
console.log("error", e)
console.error("error", e)
// this is a weird method but it works
if (import.meta.env.BROWSER === "firefox") {
// all I need is to get the pdf url but somehow

View File

@@ -41,9 +41,9 @@ export const getAllOpenAIModels = async (baseUrl: string, apiKey?: string) => {
return data.data
} catch (e) {
if (e instanceof DOMException && e.name === 'AbortError') {
console.log('Request timed out')
console.error('Request timed out')
} else {
console.log(e)
console.error(e)
}
return []
}

View File

@@ -47,7 +47,7 @@ export function parseReasoning(text: string): { type: 'reasoning' | 'text', cont
return result
} catch (e) {
console.log(`Error parsing reasoning: ${e}`)
console.error(`Error parsing reasoning: ${e}`)
return [
{
type: 'text',

View File

@@ -7,14 +7,12 @@ export const sendNotification = async (title: string, message: string) => {
"sendNotificationAfterIndexing"
)
if (sendNotificationAfterIndexing) {
console.log("Sending notification")
browser.notifications.create({
type: "basic",
iconUrl: browser.runtime.getURL("/icon/128.png"),
title,
message
})
console.log("Notification sent")
}
} catch (error) {
console.error(error)