From 2bd083c09f5fb6daf300e485f817707e17f2fe91 Mon Sep 17 00:00:00 2001 From: Tian jianyong <11429339@qq.com> Date: Wed, 17 Dec 2025 14:47:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BB=B6=E6=97=B6=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E5=B0=9D=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module_admin/controller/ragflow_controller.py | 4 ++-- ruoyi-fastapi-backend/module_admin/service/search_service.py | 4 ++-- ruoyi-fastapi-backend/verify_fix_logic.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) 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