From 6336d34b59606a6769a044d5d9c27d5564bb137c Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Thu, 17 Oct 2024 13:08:10 -0700 Subject: [PATCH] fix: web attachment issue --- backend/open_webui/apps/retrieval/main.py | 4 ++-- backend/open_webui/apps/retrieval/utils.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/backend/open_webui/apps/retrieval/main.py b/backend/open_webui/apps/retrieval/main.py index 87df03238..8a9d410e6 100644 --- a/backend/open_webui/apps/retrieval/main.py +++ b/backend/open_webui/apps/retrieval/main.py @@ -709,8 +709,8 @@ def save_docs_to_vector_db( if overwrite: VECTOR_DB_CLIENT.delete_collection(collection_name=collection_name) log.info(f"deleting existing collection {collection_name}") - - if add is False: + elif add is False: + log.info(f"collection {collection_name} already exists, overwrite is False and add is False") return True log.info(f"adding to collection {collection_name}") diff --git a/backend/open_webui/apps/retrieval/utils.py b/backend/open_webui/apps/retrieval/utils.py index 22255002f..80b0ce2a0 100644 --- a/backend/open_webui/apps/retrieval/utils.py +++ b/backend/open_webui/apps/retrieval/utils.py @@ -385,6 +385,8 @@ def get_rag_context( extracted_collections.extend(collection_names) if context: + if "data" in file: + del file["data"] relevant_contexts.append({**context, "file": file}) contexts = [] @@ -401,7 +403,6 @@ def get_rag_context( ] ) ) - contexts.append( ((", ".join(file_names) + ":\n\n") if file_names else "") + "\n\n".join(