fix add segment when dataset and document is empty (#3021)

Co-authored-by: jyong <jyong@dify.ai>
This commit is contained in:
Jyong
2024-03-29 13:06:00 +08:00
committed by GitHub
parent 2c43393bf1
commit a6cd0f0e73
4 changed files with 24 additions and 2 deletions

View File

@@ -275,6 +275,13 @@ class QdrantVector(BaseVector):
)
def text_exists(self, id: str) -> bool:
all_collection_name = []
collections_response = self._client.get_collections()
collection_list = collections_response.collections
for collection in collection_list:
all_collection_name.append(collection.name)
if self._collection_name not in all_collection_name:
return False
response = self._client.retrieve(
collection_name=self._collection_name,
ids=[id]