diff --git a/ruoyi-fastapi-backend/module_admin/controller/ragflow_controller.py b/ruoyi-fastapi-backend/module_admin/controller/ragflow_controller.py index 0236757..0fbaf87 100644 --- a/ruoyi-fastapi-backend/module_admin/controller/ragflow_controller.py +++ b/ruoyi-fastapi-backend/module_admin/controller/ragflow_controller.py @@ -13,6 +13,12 @@ from fastapi.responses import StreamingResponse from module_admin.service.login_service import LoginService from module_admin.service.ragflow_service import RAGFlowService from module_admin.service.search_service import SearchService +from module_admin.entity.vo.ragflow_vo import ( + ConverseWithChatAssistantModel, + CreateSessionWithChatModel, + UpdateChatAssistantModel, + RagflowListQueryModel +) from utils.log_util import logger from utils.response_util import ResponseUtil @@ -46,7 +52,7 @@ def build_chat_cache_key(chat_id: str, question: str) -> str: @ragflowController.post('/converse_with_chat_assistant') async def converse_with_chat_assistant( request: Request, - converse_params: Any, # 使用Any避免导入具体模型类 + converse_params: ConverseWithChatAssistantModel, # 使用正确的Pydantic模型 ): """ 与聊天助手进行对话 - 同步版本,简化复杂性 @@ -168,7 +174,7 @@ def stream_ragflow_response(result: Generator, chat_id: str, start_time: float) # 聊天助手列表 @ragflowController.post('/get_chat_assistant_list') async def get_chat_assistant_list( - query_params: Any, # 使用Any避免导入具体模型类 + query_params: RagflowListQueryModel, # 使用正确的Pydantic模型 ): """获取聊天助手列表""" result = RAGFlowService.get_chat_assistant_list_services(query_params) @@ -178,7 +184,7 @@ async def get_chat_assistant_list( # 创建会话 @ragflowController.post('/create_session_with_chat') async def create_session_with_chat( - create_params: Any, # 使用Any避免导入具体模型类 + create_params: CreateSessionWithChatModel, # 使用正确的Pydantic模型 ): """创建聊天会话""" result = RAGFlowService.create_session_with_chat_services(create_params) @@ -188,7 +194,7 @@ async def create_session_with_chat( # 更新聊天助手 @ragflowController.post('/update_chat_assistant') async def update_chat_assistant( - update_params: Any, # 使用Any避免导入具体模型类 + update_params: UpdateChatAssistantModel, # 使用正确的Pydantic模型 ): """更新聊天助手""" result = RAGFlowService.update_chat_assistant_services(update_params)