(chunkId: string, vector: Float32Array)
| 2432 | } |
| 2433 | |
| 2434 | upsertHubEmbedding(chunkId: string, vector: Float32Array): void { |
| 2435 | const buf = Buffer.from(vector.buffer, vector.byteOffset, vector.byteLength); |
| 2436 | this.db.prepare(` |
| 2437 | INSERT INTO hub_embeddings (chunk_id, vector, dimensions, updated_at) |
| 2438 | VALUES (?, ?, ?, ?) |
| 2439 | ON CONFLICT(chunk_id) DO UPDATE SET vector = excluded.vector, dimensions = excluded.dimensions, updated_at = excluded.updated_at |
| 2440 | `).run(chunkId, buf, vector.length, Date.now()); |
| 2441 | } |
| 2442 | |
| 2443 | getHubEmbedding(chunkId: string): Float32Array | null { |
| 2444 | const row = this.db.prepare('SELECT vector, dimensions FROM hub_embeddings WHERE chunk_id = ?').get(chunkId) as { vector: Buffer; dimensions: number } | undefined; |
no test coverage detected