mirror of
https://github.com/langgenius/dify.git
synced 2026-04-21 15:28:42 +08:00
add external_retrieval_model
This commit is contained in:
parent
02b06c420e
commit
a69dcb8bee
@ -101,8 +101,8 @@ class ExternalApiTemplateApi(Resource):
|
|||||||
@setup_required
|
@setup_required
|
||||||
@login_required
|
@login_required
|
||||||
@account_initialization_required
|
@account_initialization_required
|
||||||
def patch(self, api_template_id):
|
def patch(self, external_knowledge_api_id):
|
||||||
api_template_id = str(api_template_id)
|
external_knowledge_api_id = str(external_knowledge_api_id)
|
||||||
|
|
||||||
parser = reqparse.RequestParser()
|
parser = reqparse.RequestParser()
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
@ -125,7 +125,7 @@ class ExternalApiTemplateApi(Resource):
|
|||||||
api_template = ExternalDatasetService.update_api_template(
|
api_template = ExternalDatasetService.update_api_template(
|
||||||
tenant_id=current_user.current_tenant_id,
|
tenant_id=current_user.current_tenant_id,
|
||||||
user_id=current_user.id,
|
user_id=current_user.id,
|
||||||
api_template_id=api_template_id,
|
external_knowledge_api_id=external_knowledge_api_id,
|
||||||
args=args,
|
args=args,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -134,15 +134,15 @@ class ExternalApiTemplateApi(Resource):
|
|||||||
@setup_required
|
@setup_required
|
||||||
@login_required
|
@login_required
|
||||||
@account_initialization_required
|
@account_initialization_required
|
||||||
def delete(self, api_template_id):
|
def delete(self, external_knowledge_api_id):
|
||||||
api_template_id = str(api_template_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
|
# 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:
|
if not current_user.is_editor or current_user.is_dataset_operator:
|
||||||
raise Forbidden()
|
raise Forbidden()
|
||||||
|
|
||||||
ExternalDatasetService.delete_api_template(current_user.current_tenant_id, api_template_id)
|
ExternalDatasetService.delete_api_template(current_user.current_tenant_id, external_knowledge_api_id)
|
||||||
return {"result": "success"}, 204
|
return {"result": "success"}, 200
|
||||||
|
|
||||||
|
|
||||||
class ExternalApiUseCheckApi(Resource):
|
class ExternalApiUseCheckApi(Resource):
|
||||||
|
|||||||
@ -65,8 +65,8 @@ class ExternalDatasetService:
|
|||||||
return ExternalApiTemplates.query.filter_by(id=external_knowledge_api_id).first()
|
return ExternalApiTemplates.query.filter_by(id=external_knowledge_api_id).first()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def update_api_template(tenant_id, user_id, api_template_id, args) -> ExternalApiTemplates:
|
def update_api_template(tenant_id, user_id, external_knowledge_api_id, args) -> ExternalApiTemplates:
|
||||||
api_template = ExternalApiTemplates.query.filter_by(id=api_template_id, tenant_id=tenant_id).first()
|
api_template = ExternalApiTemplates.query.filter_by(id=external_knowledge_api_id, tenant_id=tenant_id).first()
|
||||||
if api_template is None:
|
if api_template is None:
|
||||||
raise ValueError("api template not found")
|
raise ValueError("api template not found")
|
||||||
|
|
||||||
@ -80,8 +80,8 @@ class ExternalDatasetService:
|
|||||||
return api_template
|
return api_template
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def delete_api_template(tenant_id: str, api_template_id: str):
|
def delete_api_template(tenant_id: str, external_knowledge_api_id: str):
|
||||||
api_template = ExternalApiTemplates.query.filter_by(id=api_template_id, tenant_id=tenant_id).first()
|
api_template = ExternalApiTemplates.query.filter_by(id=external_knowledge_api_id, tenant_id=tenant_id).first()
|
||||||
if api_template is None:
|
if api_template is None:
|
||||||
raise ValueError("api template not found")
|
raise ValueError("api template not found")
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user