mirror of
https://github.com/open-webui/open-webui.git
synced 2026-08-13 01:02:25 -06:00
fix: surface web search embedding failures in the chat UI instead of silently returning an empty collection (#26883)
Previously, when web search retrieved pages successfully but saving them to the vector DB failed (for example an unreachable or misconfigured embedding endpoint), process_web_search swallowed the exception at debug log level and still returned status: True with the collection name. The chat then showed "Searched N sites" followed by "No sources found" at retrieval time, hiding the actual misconfiguration from the user and making the failure look like a search bug. process_web_search now logs the failure at exception level and raises an HTTPException with an actionable message pointing at the embedding configuration in Admin Settings > Documents. chat_web_search_handler surfaces the detail of any HTTPException raised during the search in the emitted error status, so the real cause (embedding misconfiguration, search engine errors, no results) is shown in the chat UI instead of the generic "An error occurred while searching the web". Non-HTTP exceptions keep the generic message, so raw internal error strings are not exposed. Ref #26750, #25038
This commit is contained in:
@@ -2670,7 +2670,12 @@ async def process_web_search(request: Request, form_data: SearchForm, user=Depen
|
||||
user=user,
|
||||
)
|
||||
except Exception as e:
|
||||
log.debug(f'error saving docs: {e}')
|
||||
# Surface the failure instead of returning an unusable collection
|
||||
log.exception(f'Error saving web search results to vector DB: {e}')
|
||||
raise HTTPException(
|
||||
status.HTTP_500_INTERNAL_SERVER_ERROR,
|
||||
detail='Failed to embed and store the retrieved web pages. Check the embedding configuration in Admin Settings > Documents.',
|
||||
)
|
||||
|
||||
return {
|
||||
'status': True,
|
||||
|
||||
@@ -1497,12 +1497,13 @@ async def chat_web_search_handler(request: Request, form_data: dict, extra_param
|
||||
|
||||
except Exception as e:
|
||||
log.exception(e)
|
||||
detail = e.detail if isinstance(e, HTTPException) else None
|
||||
await event_emitter(
|
||||
{
|
||||
'type': 'status',
|
||||
'data': {
|
||||
'action': 'web_search',
|
||||
'description': 'An error occurred while searching the web',
|
||||
'description': (str(detail) if detail else 'An error occurred while searching the web'),
|
||||
'queries': queries,
|
||||
'done': True,
|
||||
'error': True,
|
||||
|
||||
Reference in New Issue
Block a user