diff --git a/backend/open_webui/tools/builtin.py b/backend/open_webui/tools/builtin.py index 853aaaa9d5..ed6ad9d4a6 100644 --- a/backend/open_webui/tools/builtin.py +++ b/backend/open_webui/tools/builtin.py @@ -2489,7 +2489,7 @@ async def grep_chat_files( if not files_to_search: return JSONCodec.dumps({'error': 'No accessible files found'}) - return _grep_file_models(files_to_search, pattern, case_insensitive, count_only) + return await asyncio.to_thread(_grep_file_models, files_to_search, pattern, case_insensitive, count_only) except Exception as e: log.exception(f'grep_chat_files error: {e}') return JSONCodec.dumps({'error': str(e)}) @@ -2727,7 +2727,7 @@ async def grep_knowledge_files( if not files_to_search: return JSONCodec.dumps({'error': 'No accessible files found'}) - return _grep_file_models(files_to_search, pattern, case_insensitive, count_only) + return await asyncio.to_thread(_grep_file_models, files_to_search, pattern, case_insensitive, count_only) except Exception as e: log.exception(f'grep_knowledge_files error: {e}')