mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-12 12:25:20 +00:00
refac: web search error handling
This commit is contained in:
parent
7d205b1711
commit
53e98620bf
1 changed files with 12 additions and 2 deletions
|
|
@ -201,9 +201,13 @@ def get_rf(
|
||||||
eos = getattr(cfg, "eos_token_id", None)
|
eos = getattr(cfg, "eos_token_id", None)
|
||||||
if eos is not None:
|
if eos is not None:
|
||||||
cfg.pad_token_id = eos
|
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:
|
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:
|
except Exception as e2:
|
||||||
log.warning(f"Failed to adjust pad_token_id on CrossEncoder: {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),
|
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:
|
try:
|
||||||
if request.app.state.config.BYPASS_WEB_SEARCH_WEB_LOADER:
|
if request.app.state.config.BYPASS_WEB_SEARCH_WEB_LOADER:
|
||||||
search_results = [
|
search_results = [
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue