diff --git a/ruoyi-fastapi-backend/module_admin/controller/ragflow_controller.py b/ruoyi-fastapi-backend/module_admin/controller/ragflow_controller.py index 2f59de8..fcfa0f5 100644 --- a/ruoyi-fastapi-backend/module_admin/controller/ragflow_controller.py +++ b/ruoyi-fastapi-backend/module_admin/controller/ragflow_controller.py @@ -101,6 +101,18 @@ async def delete_file( return parse_result(result) + +# 删除数据集 +@ragflowController.post('/delete_datasets') +async def delete_datasets( + delete_params: DeleteFileModel, + # query_db: AsyncSession = Depends(get_db), +): + """ + 删除数据集 + """ + result = await RAGFlowService.delete_datasets_services(delete_params) + return parse_result(result) diff --git a/ruoyi-fastapi-backend/module_admin/service/ragflow_service.py b/ruoyi-fastapi-backend/module_admin/service/ragflow_service.py index e1b1214..bd1bf28 100644 --- a/ruoyi-fastapi-backend/module_admin/service/ragflow_service.py +++ b/ruoyi-fastapi-backend/module_admin/service/ragflow_service.py @@ -70,4 +70,14 @@ class RAGFlowService: async with AsyncRAGFlowClient(RAGFlowConfig.RAGFLOW_BASE_URL, RAGFlowConfig.RAGFLOW_API_KEY) as client: result = await client.delete_documents(dataset_id=dataset_id, **(delete_params.model_dump())) return result + + # 删除数据集 + @classmethod + async def delete_datasets_services( + cls, + delete_params: DeleteFileModel, + ): + async with AsyncRAGFlowClient(RAGFlowConfig.RAGFLOW_BASE_URL, RAGFlowConfig.RAGFLOW_API_KEY) as client: + result = await client.delete_datasets(**(delete_params.model_dump())) + return result \ No newline at end of file