Merge pull request #12958 from Youggls/fix_search_web

fix: use run_in_threadpool for search_web to prevent blocking
This commit is contained in:
Tim Jaeryang Baek 2025-04-17 22:03:31 -07:00 committed by GitHub
commit 165eb50c22
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1477,8 +1477,11 @@ async def process_web_search(
logging.info(
f"trying to web search with {request.app.state.config.WEB_SEARCH_ENGINE, form_data.query}"
)
web_results = search_web(
request, request.app.state.config.WEB_SEARCH_ENGINE, form_data.query
web_results = await run_in_threadpool(
search_web,
request,
request.app.state.config.WEB_SEARCH_ENGINE,
form_data.query,
)
except Exception as e:
log.exception(e)