diff --git a/backend/open_webui/routers/retrieval.py b/backend/open_webui/routers/retrieval.py index 5e356c5a88..c79d3ce656 100644 --- a/backend/open_webui/routers/retrieval.py +++ b/backend/open_webui/routers/retrieval.py @@ -201,9 +201,13 @@ def get_rf( eos = getattr(cfg, "eos_token_id", None) if eos is not None: cfg.pad_token_id = eos - log.debug(f"Missing pad_token_id detected; set to eos_token_id={eos}") + log.debug( + f"Missing pad_token_id detected; set to eos_token_id={eos}" + ) else: - log.warning("Neither pad_token_id nor eos_token_id present in model config") + log.warning( + "Neither pad_token_id nor eos_token_id present in model config" + ) except Exception as e2: log.warning(f"Failed to adjust pad_token_id on CrossEncoder: {e2}") @@ -2064,6 +2068,12 @@ async def process_web_search( detail=ERROR_MESSAGES.WEB_SEARCH_ERROR(e), ) + if len(urls) == 0: + raise HTTPException( + status_code=status.HTTP_404_NOT_FOUND, + detail=ERROR_MESSAGES.DEFAULT("No results found from web search"), + ) + try: if request.app.state.config.BYPASS_WEB_SEARCH_WEB_LOADER: search_results = [