continue refactor of backend to utilize ts, deprecate js
This commit is contained in:
21
server/src/stores/vectorStore.ts
Normal file
21
server/src/stores/vectorStore.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
'use strict';
|
||||
|
||||
const vectors = new Map<string, Float32Array>();
|
||||
|
||||
export function storeVector(chunkId: string, embedding: number[]): void {
|
||||
vectors.set(chunkId, new Float32Array(embedding));
|
||||
}
|
||||
|
||||
export function getVector(chunkId: string): Float32Array | null {
|
||||
return vectors.get(chunkId) || null;
|
||||
}
|
||||
|
||||
export function getAllVectors(): Map<string, Float32Array> {
|
||||
return vectors;
|
||||
}
|
||||
|
||||
export function deleteVectorsForChunks(chunkIds: string[]): void {
|
||||
for (const id of chunkIds) {
|
||||
vectors.delete(id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user