fix: uploaded files leaking to other user chats issue

#4601
This commit is contained in:
Timothy J. Baek 2024-08-23 15:02:23 +02:00
parent 7b91be21b4
commit 0a5a2e67e8

View File

@ -149,16 +149,20 @@ def query_collection(
): ):
results = [] results = []
for collection_name in collection_names: for collection_name in collection_names:
try: if collection_name:
result = query_doc( try:
collection_name=collection_name, result = query_doc(
query=query, collection_name=collection_name,
k=k, query=query,
embedding_function=embedding_function, k=k,
) embedding_function=embedding_function,
results.append(result) )
except Exception: results.append(result)
except Exception:
pass
else:
pass pass
return merge_and_sort_query_results(results, k=k) return merge_and_sort_query_results(results, k=k)
@ -257,7 +261,7 @@ def get_rag_context(
collection_names = ( collection_names = (
file["collection_names"] file["collection_names"]
if file["type"] == "collection" if file["type"] == "collection"
else [file["collection_name"]] else [file["collection_name"]] if file["collection_name"] else []
) )
collection_names = set(collection_names).difference(extracted_collections) collection_names = set(collection_names).difference(extracted_collections)