feat: update document retrieval to include limit and offset parameters

This commit is contained in:
Soulter
2025-10-24 17:38:22 +08:00
parent 9430e3090d
commit 9b004f3d2f
2 changed files with 4 additions and 1 deletions
@@ -51,6 +51,7 @@ class EmbeddingStorage:
f"向量维度不匹配, 期望: {self.dimension}, 实际: {vectors.shape[1]}"
)
self.index.add_with_ids(vectors, np.array(ids))
await self.save_index()
async def search(self, vector: np.ndarray, k: int) -> tuple:
"""搜索最相似的向量
@@ -73,7 +73,9 @@ class SparseRetriever:
vec_db: FaissVecDB = kb_options.get(kb_id, {}).get("vec_db")
if not vec_db:
continue
result = await vec_db.document_storage.get_documents(metadata_filters={})
result = await vec_db.document_storage.get_documents(
metadata_filters={}, limit=None, offset=None
)
chunk_mds = [json.loads(doc["metadata"]) for doc in result]
result = [
{