import type { VectorRecord, VectorSearchOptions, VectorSearchResult } from './types'; /** * 计算 modelId 的 short hash */ export declare function hashModelId(modelId: string): string; /** * 向量存储抽象基类 * * 提供公共工具方法,子类实现具体的数据库操作 */ export declare abstract class VectorStore { /** 默认向量维度 */ protected readonly defaultDimension: number; abstract open(): Promise; abstract close(): Promise; abstract ensureVectorTable(modelId: string): Promise; abstract dropVectorTable(modelId: string): Promise; abstract hasVectorTable(modelId: string): Promise; abstract listVectorTables(): Promise; abstract upsertVector(modelId: string, id: number, embedding: number[]): Promise; abstract batchUpsertVectors(modelId: string, records: { id: number; embedding: number[]; }[]): Promise; abstract getVector(modelId: string, id: number): Promise; abstract deleteVector(modelId: string, id: number): Promise; abstract batchDeleteVectors(modelId: string, ids: number[]): Promise; abstract search(modelId: string, queryEmbedding: number[], options?: VectorSearchOptions): Promise; abstract countVectors(modelId: string): Promise; abstract getVectorIds(modelId: string, options?: { limit?: number; afterId?: number; }): Promise; /** * 将各种时间格式转换为 Unix 时间戳(秒) */ protected toTimestamp(value: any): number; /** * 将 distance 转换为 score [0, 1] */ protected distanceToScore(distance: number): number; }