From 60f62c2f5947160831025eaeda1685e7c1469a8a Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Wed, 17 Sep 2025 11:28:04 -0500 Subject: [PATCH] refac --- backend/open_webui/routers/files.py | 5 ----- backend/open_webui/routers/retrieval.py | 7 +++++++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/backend/open_webui/routers/files.py b/backend/open_webui/routers/files.py index 778fbdec27..84d8f841cf 100644 --- a/backend/open_webui/routers/files.py +++ b/backend/open_webui/routers/files.py @@ -120,11 +120,6 @@ def process_uploaded_file(request, file, file_path, file_item, file_metadata, us f"File type {file.content_type} is not provided, but trying to process anyway" ) process_file(request, ProcessFileForm(file_id=file_item.id), user=user) - - Files.update_file_data_by_id( - file_item.id, - {"status": "completed"}, - ) except Exception as e: log.error(f"Error processing file: {file_item.id}") Files.update_file_data_by_id( diff --git a/backend/open_webui/routers/retrieval.py b/backend/open_webui/routers/retrieval.py index 1f32791ba6..0ddf824efa 100644 --- a/backend/open_webui/routers/retrieval.py +++ b/backend/open_webui/routers/retrieval.py @@ -1584,12 +1584,19 @@ def process_file( }, ) + Files.update_file_data_by_id( + file.id, + {"status": "completed"}, + ) + return { "status": True, "collection_name": collection_name, "filename": file.filename, "content": text_content, } + else: + raise Exception("Error saving document to vector database") except Exception as e: raise e