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:
1 parent
3492021361
commit
6c7478c1c9
2 files changed
+8
-2
No files matched your search
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user