118118from open_webui .utils .access_control import has_permission
119119from open_webui .utils .access_control .files import has_access_to_file
120120from open_webui .utils .auth import get_admin_user , get_verified_user
121+ from open_webui .utils .errors import error_detail
121122from open_webui .utils .misc import (
122123 calculate_sha256_string ,
123124 sanitize_text_for_db ,
@@ -182,7 +183,7 @@ def get_rf(
182183
183184 except Exception as e :
184185 log .error (f'ColBERT: { e } ' )
185- raise Exception (ERROR_MESSAGES . DEFAULT ( e ))
186+ raise Exception (error_detail ( e , 'Error loading reranking model' ))
186187 else :
187188 if engine == 'external' :
188189 try :
@@ -196,7 +197,7 @@ def get_rf(
196197 )
197198 except Exception as e :
198199 log .error (f'ExternalReranking: { e } ' )
199- raise Exception (ERROR_MESSAGES . DEFAULT ( e ))
200+ raise Exception (error_detail ( e , 'Error loading reranking model' ))
200201 else :
201202 import sentence_transformers
202203 import torch
@@ -605,7 +606,7 @@ async def update_embedding_config(request: Request, form_data: EmbeddingModelUpd
605606 log .exception (f'Problem updating embedding model: { e } ' )
606607 raise HTTPException (
607608 status_code = status .HTTP_500_INTERNAL_SERVER_ERROR ,
608- detail = ERROR_MESSAGES . DEFAULT ( e ),
609+ detail = error_detail ( e , 'Error updating embedding configuration' ),
609610 )
610611
611612
@@ -1207,7 +1208,7 @@ async def update_rag_config(request: Request, form_data: ConfigForm, user=Depend
12071208 log .exception (f'Problem updating reranking model: { e } ' )
12081209 raise HTTPException (
12091210 status_code = status .HTTP_500_INTERNAL_SERVER_ERROR ,
1210- detail = ERROR_MESSAGES . DEFAULT ( e ),
1211+ detail = error_detail ( e , 'Error updating reranking configuration' ),
12111212 )
12121213
12131214 # Chunking settings
@@ -2149,7 +2150,7 @@ async def process_web(
21492150 log .exception (e )
21502151 raise HTTPException (
21512152 status_code = status .HTTP_400_BAD_REQUEST ,
2152- detail = ERROR_MESSAGES . DEFAULT ( e ),
2153+ detail = error_detail ( e , 'Error querying knowledge base' ),
21532154 )
21542155
21552156
@@ -2654,7 +2655,10 @@ async def search_query_with_semaphore(query):
26542655 }
26552656 except Exception as e :
26562657 log .exception ('Web search content loading failed' )
2657- raise HTTPException (status .HTTP_400_BAD_REQUEST , detail = ERROR_MESSAGES .DEFAULT (e ))
2658+ raise HTTPException (
2659+ status .HTTP_400_BAD_REQUEST ,
2660+ detail = error_detail (e , ERROR_MESSAGES .WEB_SEARCH_ERROR ()),
2661+ )
26582662
26592663
26602664async def _validate_collection_access (collection_names : list [str ], user , access_type : str = 'read' ) -> None :
@@ -2732,7 +2736,7 @@ async def query_doc_handler(
27322736 log .exception (e )
27332737 raise HTTPException (
27342738 status_code = status .HTTP_400_BAD_REQUEST ,
2735- detail = ERROR_MESSAGES . DEFAULT ( e ),
2739+ detail = error_detail ( e , 'Error querying knowledge base' ),
27362740 )
27372741
27382742
@@ -2798,7 +2802,7 @@ async def query_collection_handler(
27982802 log .exception (e )
27992803 raise HTTPException (
28002804 status_code = status .HTTP_400_BAD_REQUEST ,
2801- detail = ERROR_MESSAGES . DEFAULT ( e ),
2805+ detail = error_detail ( e , 'Error querying knowledge base' ),
28022806 )
28032807
28042808
0 commit comments