From a30876c901fee7a4340e42c120737db52442b8d8 Mon Sep 17 00:00:00 2001 From: ytqh Date: Fri, 28 Feb 2025 20:59:06 +0800 Subject: [PATCH] chore: remove unwanted changes in dify service_api --- api/controllers/service_api/__init__.py | 2 +- api/controllers/service_api/error.py | 103 ------------------------ api/controllers/service_api/index.py | 2 - 3 files changed, 1 insertion(+), 106 deletions(-) delete mode 100644 api/controllers/service_api/error.py diff --git a/api/controllers/service_api/__init__.py b/api/controllers/service_api/__init__.py index a4c90fc688..aba9e3ecbb 100644 --- a/api/controllers/service_api/__init__.py +++ b/api/controllers/service_api/__init__.py @@ -7,4 +7,4 @@ api = ExternalApi(bp) from . import index from .app import app, audio, completion, conversation, file, message, workflow -from .dataset import dataset, document, hit_testing, segment, upload_file \ No newline at end of file +from .dataset import dataset, document, hit_testing, segment, upload_file diff --git a/api/controllers/service_api/error.py b/api/controllers/service_api/error.py deleted file mode 100644 index ee87138a44..0000000000 --- a/api/controllers/service_api/error.py +++ /dev/null @@ -1,103 +0,0 @@ -from libs.exception import BaseHTTPException - - -class AlreadySetupError(BaseHTTPException): - error_code = "already_setup" - description = "Dify has been successfully installed. Please refresh the page or return to the dashboard homepage." - code = 403 - - -class NotSetupError(BaseHTTPException): - error_code = "not_setup" - description = ( - "Dify has not been initialized and installed yet. " - "Please proceed with the initialization and installation process first." - ) - code = 401 - - -class NotInitValidateError(BaseHTTPException): - error_code = "not_init_validated" - description = "Init validation has not been completed yet. Please proceed with the init validation process first." - code = 401 - - -class InitValidateFailedError(BaseHTTPException): - error_code = "init_validate_failed" - description = "Init validation failed. Please check the password and try again." - code = 401 - - -class AccountNotLinkTenantError(BaseHTTPException): - error_code = "account_not_link_tenant" - description = "Account not link tenant." - code = 403 - - -class AlreadyActivateError(BaseHTTPException): - error_code = "already_activate" - description = "Auth Token is invalid or account already activated, please check again." - code = 403 - - -class NotAllowedCreateWorkspace(BaseHTTPException): - error_code = "not_allowed_create_workspace" - description = "Workspace not found, please contact system admin to invite you to join in a workspace." - code = 400 - - -class AccountBannedError(BaseHTTPException): - error_code = "account_banned" - description = "Account is banned." - code = 400 - - -class AccountNotFound(BaseHTTPException): - error_code = "account_not_found" - description = "Account not found." - code = 400 - - -class EmailSendIpLimitError(BaseHTTPException): - error_code = "email_send_ip_limit" - description = "Too many emails have been sent from this IP address recently. Please try again later." - code = 429 - - -class FileTooLargeError(BaseHTTPException): - error_code = "file_too_large" - description = "File size exceeded. {message}" - code = 413 - - -class UnsupportedFileTypeError(BaseHTTPException): - error_code = "unsupported_file_type" - description = "File type not allowed." - code = 415 - - -class TooManyFilesError(BaseHTTPException): - error_code = "too_many_files" - description = "Only one file is allowed." - code = 400 - - -class NoFileUploadedError(BaseHTTPException): - error_code = "no_file_uploaded" - description = "Please upload your file." - code = 400 - - -class UnauthorizedAndForceLogout(BaseHTTPException): - error_code = "unauthorized_and_force_logout" - description = "Unauthorized and force logout." - code = 401 - - -class AccountInFreezeError(BaseHTTPException): - error_code = "account_in_freeze" - code = 400 - description = ( - "This email account has been deleted within the past 30 days" - "and is temporarily unavailable for new account registration." - ) diff --git a/api/controllers/service_api/index.py b/api/controllers/service_api/index.py index d163f61723..75d9141a6d 100644 --- a/api/controllers/service_api/index.py +++ b/api/controllers/service_api/index.py @@ -1,4 +1,3 @@ -from libs.login import login_required from flask_restful import Resource # type: ignore from configs import dify_config @@ -6,7 +5,6 @@ from controllers.service_api import api class IndexApi(Resource): - @login_required def get(self): return { "welcome": "Dify OpenAPI",