From 378223aedbc372b199ad28668e38083d3a183e1a Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Sat, 5 Oct 2024 10:08:48 -0700 Subject: [PATCH] refac: comments --- backend/open_webui/apps/retrieval/main.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/backend/open_webui/apps/retrieval/main.py b/backend/open_webui/apps/retrieval/main.py index 5c5b55e4e..9fedd6575 100644 --- a/backend/open_webui/apps/retrieval/main.py +++ b/backend/open_webui/apps/retrieval/main.py @@ -738,6 +738,9 @@ def process_file( collection_name = f"file-{file.id}" if form_data.content: + # Update the content in the file + # Usage: /files/{file_id}/data/content/update + VECTOR_DB_CLIENT.delete( collection_name=f"file-{file.id}", filter={"file_id": file.id}, @@ -757,6 +760,9 @@ def process_file( text_content = form_data.content elif form_data.collection_name: + # Check if the file has already been processed and save the content + # Usage: /knowledge/{id}/file/add, /knowledge/{id}/file/update + result = VECTOR_DB_CLIENT.query( collection_name=f"file-{file.id}", filter={"file_id": file.id} ) @@ -784,6 +790,9 @@ def process_file( text_content = file.data.get("content", "") else: + # Process the file and save the content + # Usage: /files/ + file_path = file.meta.get("path", None) if file_path: loader = Loader(