fix: files added to a knowledge base on Qdrant can end up with only part of their content (#31961)

On Qdrant, uploading a file into a knowledge base or editing a file's content could leave the knowledge base with only part of the file, often exactly 64 chunks, while the file showed as completed and nothing was logged. The file's chunks were saved without waiting for Qdrant to make them searchable, and the knowledge base copied them straight after, so it only got the ones Qdrant had finished storing. Saving now waits until Qdrant has finished storing the chunks, so the knowledge base always gets the whole file. On a busy Qdrant this makes file processing somewhat slower, since each save now waits for the server.

Fixes #31959
This commit is contained in:
Classic298 2026-10-07 14:29:13 +02:00 • committed by GitHub
parent bee0554235
commit f6cbeb1a1c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View file

@ -220,7 +220,7 @@ class QdrantClient(VectorDBBase):
# Insert the items into the collection, if the collection does not exist, it will be created.
self._create_collection_if_not_exists(collection_name, len(items[0]['vector']))
points = self._create_points(items)
self.client.upload_points(f'{self.collection_prefix}_{collection_name}', points)
self.client.upload_points(f'{self.collection_prefix}_{collection_name}', points, wait=True)
def upsert(self, collection_name: str, items: list[VectorItem]):
# Update the items in the collection, if the items are not present, insert them. If the collection does not exist, it will be created.

View file

@ -332,7 +332,7 @@ class QdrantClient(VectorDBBase):
dimension = len(items[0]['vector'])
self._ensure_collection(mt_collection, dimension)
points = self._create_points(items, tenant_id)
self.client.upload_points(mt_collection, points)
self.client.upload_points(mt_collection, points, wait=True)
return None
def insert(self, collection_name: str, items: List[VectorItem]):