update fetch urls & web search show view

This commit is contained in:
duanfuxiang
2025-04-01 18:56:11 +08:00
parent 7642cc1410
commit c8d03bf799
25 changed files with 156 additions and 4967 deletions

View File

@@ -65,34 +65,33 @@ export class DBManager {
// })
// }
private async loadExistingDatabase() {
try {
const databaseFileExists = await this.app.vault.adapter.exists(
this.dbPath,
)
if (!databaseFileExists) {
return null
}
const fileBuffer = await this.app.vault.adapter.readBinary(this.dbPath)
const fileBlob = new Blob([fileBuffer], { type: 'application/x-gzip' })
const { fsBundle, wasmModule, vectorExtensionBundlePath } =
await this.loadPGliteResources()
this.db = await PGlite.create({
loadDataDir: fileBlob,
fsBundle: fsBundle,
wasmModule: wasmModule,
extensions: {
vector: vectorExtensionBundlePath,
live
},
})
// return drizzle(this.pgClient)
} catch (error) {
console.error('Error loading database:', error)
console.log(this.dbPath)
return null
}
}
// private async loadExistingDatabase() {
// try {
// const databaseFileExists = await this.app.vault.adapter.exists(
// this.dbPath,
// )
// if (!databaseFileExists) {
// return null
// }
// const fileBuffer = await this.app.vault.adapter.readBinary(this.dbPath)
// const fileBlob = new Blob([fileBuffer], { type: 'application/x-gzip' })
// const { fsBundle, wasmModule, vectorExtensionBundlePath } =
// await this.loadPGliteResources()
// this.db = await PGlite.create({
// loadDataDir: fileBlob,
// fsBundle: fsBundle,
// wasmModule: wasmModule,
// extensions: {
// vector: vectorExtensionBundlePath,
// live
// },
// })
// // return drizzle(this.pgClient)
// } catch (error) {
// console.error('Error loading database:', error)
// return null
// }
// }
// private async migrateDatabase(): Promise<void> {
// if (!this.db) {
@@ -115,7 +114,7 @@ export class DBManager {
// }
async save(): Promise<void> {
console.log("need remove")
console.warn("need remove")
}
async cleanup() {

View File

@@ -162,10 +162,6 @@ export class VectorRepository {
}
}
const queryVectorLength = `SELECT count(1) FROM "${tableName}"`;
const queryVectorLengthResult = await this.db.query(queryVectorLength)
console.log('queryVectorLengthResult, ', queryVectorLengthResult)
const query = `
SELECT
id, path, mtime, content, metadata,