/** * SqliteVectorStore - SQLite 向量存储实现(使用 sqlite-vec 扩展) * * 设计思路: * - sqlite-vec 的 vec0 表使用 rowid 作为主键 * - rowid 直接与 quints 表的 rowid 对应,无需额外映射 * - 通过 rowid JOIN quints 表即可关联业务数据 */ import type { Finalizable, Initializable } from '@solid/community-server'; import { VectorStore } from './VectorStore'; import type { VectorRecord, VectorSearchOptions, VectorSearchResult, VectorStoreOptions } from './types'; export declare class SqliteVectorStore extends VectorStore implements Initializable, Finalizable { /** @ignored */ private db; private readonly filename; private readonly sqliteRuntime; constructor(options: VectorStoreOptions); initialize(): Promise; finalize(): Promise; open(): Promise; close(): Promise; private ensureOpen; private getTableName; private getCountTableCandidates; private getDimension; ensureVectorTable(modelId: string): Promise; dropVectorTable(modelId: string): Promise; hasVectorTable(modelId: string): Promise; listVectorTables(): Promise; upsertVector(modelId: string, id: number, embedding: number[]): Promise; batchUpsertVectors(modelId: string, records: { id: number; embedding: number[]; }[]): Promise; getVector(modelId: string, id: number): Promise; deleteVector(modelId: string, id: number): Promise; batchDeleteVectors(modelId: string, ids: number[]): Promise; search(modelId: string, queryEmbedding: number[], options?: VectorSearchOptions): Promise; countVectors(modelId: string): Promise; getVectorIds(modelId: string, options?: { limit?: number; afterId?: number; }): Promise; private rowToVector; private deserializeEmbedding; }