/** * PostgresVectorStore - PostgreSQL 向量存储实现(使用 pgvector 扩展) * * 使用 pgvector 扩展进行高性能向量搜索: * - 向量表命名:quint_vec_{hash(modelId)} * - 利用 <=> 运算符(余弦距离)进行近似最近邻搜索 * - 支持 IVFFlat 和 HNSW 索引 */ import type { Finalizable, Initializable } from '@solid/community-server'; import { VectorStore } from './VectorStore'; import type { VectorRecord, VectorSearchOptions, VectorSearchResult, VectorStoreOptions } from './types'; export declare class PostgresVectorStore extends VectorStore implements Initializable, Finalizable { protected readonly connectionString: string; /** @ignored */ private pool; /** @ignored */ private db; constructor(options: VectorStoreOptions); initialize(): Promise; finalize(): Promise; open(): Promise; close(): Promise; private ensureOpen; private getDb; protected getTableName(modelId: string): string; private getCountTableCandidates; 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 parseEmbedding; }