diff --git a/ruoyi-fastapi-backend/module_admin/controller/ragflow_controller.py b/ruoyi-fastapi-backend/module_admin/controller/ragflow_controller.py index 839c0dc..bcb0df9 100644 --- a/ruoyi-fastapi-backend/module_admin/controller/ragflow_controller.py +++ b/ruoyi-fastapi-backend/module_admin/controller/ragflow_controller.py @@ -230,8 +230,8 @@ async def converse_with_chat_assistant( # Revert to Native RAGFlow Service (OpenAI endpoint failed with Auth error) t1 = time.perf_counter() - # 修复:直接获取AsyncGenerator,不使用await消费 - result = RAGFlowService.converse_with_chat_assistant_services(converse_params) + # 修复:await async方法获取AsyncGenerator + result = await RAGFlowService.converse_with_chat_assistant_services(converse_params) logger.info(f"[RAG_PROFILE] RAG Init/Connect ({converse_params.chat_id}): {time.perf_counter() - t1:.3f}s") if converse_params.stream: diff --git a/ruoyi-fastapi-backend/module_admin/service/search_service.py b/ruoyi-fastapi-backend/module_admin/service/search_service.py index 667c46d..edfb33e 100644 --- a/ruoyi-fastapi-backend/module_admin/service/search_service.py +++ b/ruoyi-fastapi-backend/module_admin/service/search_service.py @@ -189,8 +189,8 @@ class SearchService: except SearchServiceError as exc: logger.warning('搜索服务失败,降级到RAGFlow: %s', exc) # Fallback to normal flow - # 修复:直接获取AsyncGenerator,不使用await消费 - result = RAGFlowService.converse_with_chat_assistant_services(converse_params) + # 修复:await async方法获取AsyncGenerator + result = await RAGFlowService.converse_with_chat_assistant_services(converse_params) if converse_params.stream: async def stream_response(): diff --git a/ruoyi-fastapi-backend/verify_fix_logic.py b/ruoyi-fastapi-backend/verify_fix_logic.py index cc72522..ed50201 100644 --- a/ruoyi-fastapi-backend/verify_fix_logic.py +++ b/ruoyi-fastapi-backend/verify_fix_logic.py @@ -107,8 +107,8 @@ async def test_new_implementation(): print("="*60) try: - # 修复:直接获取AsyncGenerator,不使用await消费 - generator = MockRAGFlowServiceNew.converse_with_chat_assistant_services( + # 修复:await async方法获取AsyncGenerator + generator = await MockRAGFlowServiceNew.converse_with_chat_assistant_services( chat_id="test_chat_123", question="你好", stream=True