chore: update retrieval components

This commit is contained in:
2026-02-08 18:14:02 +08:00
parent 8fdce7b9a1
commit 8226c48624
3 changed files with 116 additions and 229 deletions

View File

@@ -159,6 +159,20 @@ export async function getAllChunkVectors(chatId) {
}));
}
export async function getChunkVectorsByIds(chatId, chunkIds) {
if (!chatId || !chunkIds?.length) return [];
const records = await chunkVectorsTable
.where('[chatId+chunkId]')
.anyOf(chunkIds.map(id => [chatId, id]))
.toArray();
return records.map(r => ({
chunkId: r.chunkId,
vector: bufferToFloat32(r.vector),
}));
}
// ═══════════════════════════════════════════════════════════════════════════
// EventVectors 表操作
// ═══════════════════════════════════════════════════════════════════════════