From aab2e52f41258133ab7a67ed03a2e936570757fe Mon Sep 17 00:00:00 2001 From: haotian <2421912570@qq.com> Date: Fri, 5 Sep 2025 10:55:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E5=88=A0=E9=99=A4=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=9B=86=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module_admin/controller/ragflow_controller.py | 12 ++++++++++++ .../module_admin/service/ragflow_service.py | 10 ++++++++++ 2 files changed, 22 insertions(+) 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