diff --git a/api/controllers/console/wraps.py b/api/controllers/console/wraps.py index 668d76461eff5..7c8ad110784ee 100644 --- a/api/controllers/console/wraps.py +++ b/api/controllers/console/wraps.py @@ -85,7 +85,7 @@ def decorated(*args, **kwargs): def cloud_edition_billing_knowledge_limit_check(resource: str, - error_msg: str = "You have reached the limit of your subscription."): + error_msg: str = "To unlock this feature and elevate your Dify experience, please upgrade to a paid plan."): def interceptor(view): @wraps(view) def decorated(*args, **kwargs): @@ -93,7 +93,7 @@ def decorated(*args, **kwargs): if features.billing.enabled: if resource == 'add_segment': if features.billing.subscription.plan == 'sandbox': - abort(403, 'To unlock this feature and elevate your Dify experience, please upgrade to a paid plan.') + abort(403, error_msg) else: return view(*args, **kwargs) diff --git a/api/controllers/service_api/wraps.py b/api/controllers/service_api/wraps.py index 2529b5fb8c3d4..cb684cfac2064 100644 --- a/api/controllers/service_api/wraps.py +++ b/api/controllers/service_api/wraps.py @@ -8,7 +8,7 @@ from flask_login import user_logged_in from flask_restful import Resource from pydantic import BaseModel -from werkzeug.exceptions import NotFound, Unauthorized +from werkzeug.exceptions import NotFound, Unauthorized, Forbidden from extensions.ext_database import db from libs.login import _get_user @@ -92,13 +92,13 @@ def decorated(*args, **kwargs): documents_upload_quota = features.documents_upload_quota if resource == 'members' and 0 < members.limit <= members.size: - raise Unauthorized(error_msg) + raise Forbidden(error_msg) elif resource == 'apps' and 0 < apps.limit <= apps.size: - raise Unauthorized(error_msg) + raise Forbidden(error_msg) elif resource == 'vector_space' and 0 < vector_space.limit <= vector_space.size: - raise Unauthorized(error_msg) + raise Forbidden(error_msg) elif resource == 'documents' and 0 < documents_upload_quota.limit <= documents_upload_quota.size: - raise Unauthorized(error_msg) + raise Forbidden(error_msg) else: return view(*args, **kwargs) @@ -118,7 +118,7 @@ def decorated(*args, **kwargs): if features.billing.enabled: if resource == 'add_segment': if features.billing.subscription.plan == 'sandbox': - raise Unauthorized(error_msg) + raise Forbidden(error_msg) else: return view(*args, **kwargs)