mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-22 16:17:57 +01:00
Fix get_documents_ids_distances return error when n_results = 0 (#2347)
This commit is contained in:
parent
07a4f0569f
commit
0dbc3d9b2c
@ -50,7 +50,7 @@ class ChromaCollector(Collecter):
|
|||||||
def get_documents_ids_distances(self, search_strings: list[str], n_results: int):
|
def get_documents_ids_distances(self, search_strings: list[str], n_results: int):
|
||||||
n_results = min(len(self.ids), n_results)
|
n_results = min(len(self.ids), n_results)
|
||||||
if n_results == 0:
|
if n_results == 0:
|
||||||
return [], []
|
return [], [], []
|
||||||
|
|
||||||
result = self.collection.query(query_texts=search_strings, n_results=n_results, include=['documents', 'distances'])
|
result = self.collection.query(query_texts=search_strings, n_results=n_results, include=['documents', 'distances'])
|
||||||
documents = result['documents'][0]
|
documents = result['documents'][0]
|
||||||
|
Loading…
Reference in New Issue
Block a user