diff --git a/backend/open_webui/retrieval/loaders/external_document.py b/backend/open_webui/retrieval/loaders/external_document.py index e1371be288..90fe70f879 100644 --- a/backend/open_webui/retrieval/loaders/external_document.py +++ b/backend/open_webui/retrieval/loaders/external_document.py @@ -41,7 +41,7 @@ class ExternalDocumentLoader(BaseLoader): try: headers["X-Filename"] = quote(os.path.basename(self.file_path)) - except: + except Exception: pass if self.user is not None: diff --git a/backend/open_webui/retrieval/loaders/mineru.py b/backend/open_webui/retrieval/loaders/mineru.py index 617be8e87a..108abd8b9a 100644 --- a/backend/open_webui/retrieval/loaders/mineru.py +++ b/backend/open_webui/retrieval/loaders/mineru.py @@ -122,7 +122,7 @@ class MinerULoader: try: error_data = e.response.json() error_detail += f" - {error_data}" - except: + except Exception: error_detail += f" - {e.response.text}" raise HTTPException(status.HTTP_400_BAD_REQUEST, detail=error_detail) except Exception as e: @@ -252,7 +252,7 @@ class MinerULoader: try: error_data = e.response.json() error_detail += f" - {error_data.get('msg', error_data)}" - except: + except Exception: error_detail += f" - {e.response.text}" raise HTTPException(status.HTTP_400_BAD_REQUEST, detail=error_detail) except Exception as e: @@ -355,7 +355,7 @@ class MinerULoader: try: error_data = e.response.json() error_detail += f" - {error_data.get('msg', error_data)}" - except: + except Exception: error_detail += f" - {e.response.text}" raise HTTPException(status.HTTP_400_BAD_REQUEST, detail=error_detail) except Exception as e: diff --git a/backend/open_webui/retrieval/vector/dbs/chroma.py b/backend/open_webui/retrieval/vector/dbs/chroma.py index b7ea5244b4..b8dc88945b 100755 --- a/backend/open_webui/retrieval/vector/dbs/chroma.py +++ b/backend/open_webui/retrieval/vector/dbs/chroma.py @@ -123,7 +123,7 @@ class ChromaClient(VectorDBBase): } ) return None - except: + except Exception: return None def get(self, collection_name: str) -> Optional[GetResult]: diff --git a/backend/open_webui/routers/chats.py b/backend/open_webui/routers/chats.py index 52e8e45c4d..837170c89d 100644 --- a/backend/open_webui/routers/chats.py +++ b/backend/open_webui/routers/chats.py @@ -1095,7 +1095,7 @@ async def send_chat_message_event_by_id( else: return False return True - except: + except Exception: return False diff --git a/backend/open_webui/routers/configs.py b/backend/open_webui/routers/configs.py index c574de7e5f..8d145d8cef 100644 --- a/backend/open_webui/routers/configs.py +++ b/backend/open_webui/routers/configs.py @@ -179,7 +179,7 @@ async def set_tool_servers_config( try: request.app.state.oauth_client_manager.remove_client(client_key) - except: + except Exception: pass # Set new tool server connections diff --git a/backend/open_webui/routers/pipelines.py b/backend/open_webui/routers/pipelines.py index fa1b77a09c..24cf6682c7 100644 --- a/backend/open_webui/routers/pipelines.py +++ b/backend/open_webui/routers/pipelines.py @@ -70,7 +70,7 @@ async def process_pipeline_inlet_filter(request, payload, user, models): try: urlIdx = int(urlIdx) - except: + except Exception: continue url = request.app.state.config.OPENAI_API_BASE_URLS[urlIdx] @@ -123,7 +123,7 @@ async def process_pipeline_outlet_filter(request, payload, user, models): try: urlIdx = int(urlIdx) - except: + except Exception: continue url = request.app.state.config.OPENAI_API_BASE_URLS[urlIdx] diff --git a/backend/open_webui/routers/retrieval.py b/backend/open_webui/routers/retrieval.py index e75b345ce8..f63871224a 100644 --- a/backend/open_webui/routers/retrieval.py +++ b/backend/open_webui/routers/retrieval.py @@ -1688,7 +1688,7 @@ def process_file( VECTOR_DB_CLIENT.delete_collection( collection_name=f"file-{file.id}" ) - except: + except Exception: # Audio file upload pipeline pass diff --git a/backend/open_webui/socket/main.py b/backend/open_webui/socket/main.py index 3070959332..6a4cfd0ba2 100644 --- a/backend/open_webui/socket/main.py +++ b/backend/open_webui/socket/main.py @@ -661,7 +661,7 @@ async def yjs_document_update(sid, data): try: await stop_item_tasks(REDIS, document_id) - except: + except Exception: pass user_id = data.get("user_id", sid) diff --git a/backend/open_webui/utils/middleware.py b/backend/open_webui/utils/middleware.py index 8bfed7d391..f0a79ef4b1 100644 --- a/backend/open_webui/utils/middleware.py +++ b/backend/open_webui/utils/middleware.py @@ -1926,7 +1926,7 @@ async def chat_completion_files_handler( queries_response = {"queries": [queries_response]} queries = queries_response.get("queries", []) - except: + except Exception: pass await __event_emitter__( @@ -2196,7 +2196,7 @@ async def process_chat_payload(request, form_data, user, metadata, model): form_data = apply_system_prompt_to_body( system_message.get("content"), form_data, metadata, user, replace=True ) # Required to handle system prompt variables - except: + except Exception: pass form_data = await convert_url_images_to_base64(form_data) @@ -3338,7 +3338,7 @@ async def streaming_chat_response_handler(response, ctx): if match: try: attr_content = match.group(1) if match.group(1) else "" - except: + except Exception: attr_content = "" attributes = extract_attributes(attr_content)