diff --git a/api/controllers/console/datasets/external.py b/api/controllers/console/datasets/external.py index 1bc7ffdf49..faca8a2a45 100644 --- a/api/controllers/console/datasets/external.py +++ b/api/controllers/console/datasets/external.py @@ -101,8 +101,8 @@ class ExternalApiTemplateApi(Resource): @setup_required @login_required @account_initialization_required - def patch(self, api_template_id): - api_template_id = str(api_template_id) + def patch(self, external_knowledge_api_id): + external_knowledge_api_id = str(external_knowledge_api_id) parser = reqparse.RequestParser() parser.add_argument( @@ -125,7 +125,7 @@ class ExternalApiTemplateApi(Resource): api_template = ExternalDatasetService.update_api_template( tenant_id=current_user.current_tenant_id, user_id=current_user.id, - api_template_id=api_template_id, + external_knowledge_api_id=external_knowledge_api_id, args=args, ) @@ -134,15 +134,15 @@ class ExternalApiTemplateApi(Resource): @setup_required @login_required @account_initialization_required - def delete(self, api_template_id): - api_template_id = str(api_template_id) + def delete(self, external_knowledge_api_id): + external_knowledge_api_id = str(external_knowledge_api_id) # The role of the current user in the ta table must be admin, owner, or editor if not current_user.is_editor or current_user.is_dataset_operator: raise Forbidden() - ExternalDatasetService.delete_api_template(current_user.current_tenant_id, api_template_id) - return {"result": "success"}, 204 + ExternalDatasetService.delete_api_template(current_user.current_tenant_id, external_knowledge_api_id) + return {"result": "success"}, 200 class ExternalApiUseCheckApi(Resource): diff --git a/api/services/external_knowledge_service.py b/api/services/external_knowledge_service.py index 58006ea088..9810c253ba 100644 --- a/api/services/external_knowledge_service.py +++ b/api/services/external_knowledge_service.py @@ -65,8 +65,8 @@ class ExternalDatasetService: return ExternalApiTemplates.query.filter_by(id=external_knowledge_api_id).first() @staticmethod - def update_api_template(tenant_id, user_id, api_template_id, args) -> ExternalApiTemplates: - api_template = ExternalApiTemplates.query.filter_by(id=api_template_id, tenant_id=tenant_id).first() + def update_api_template(tenant_id, user_id, external_knowledge_api_id, args) -> ExternalApiTemplates: + api_template = ExternalApiTemplates.query.filter_by(id=external_knowledge_api_id, tenant_id=tenant_id).first() if api_template is None: raise ValueError("api template not found") @@ -80,8 +80,8 @@ class ExternalDatasetService: return api_template @staticmethod - def delete_api_template(tenant_id: str, api_template_id: str): - api_template = ExternalApiTemplates.query.filter_by(id=api_template_id, tenant_id=tenant_id).first() + def delete_api_template(tenant_id: str, external_knowledge_api_id: str): + api_template = ExternalApiTemplates.query.filter_by(id=external_knowledge_api_id, tenant_id=tenant_id).first() if api_template is None: raise ValueError("api template not found")