| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 | from libs.exception import BaseHTTPExceptionclass AppUnavailableError(BaseHTTPException):    error_code = 'app_unavailable'    description = "App unavailable, please check your app configurations."    code = 400class NotCompletionAppError(BaseHTTPException):    error_code = 'not_completion_app'    description = "Please check if your Completion app mode matches the right API route."    code = 400class NotChatAppError(BaseHTTPException):    error_code = 'not_chat_app'    description = "Please check if your app mode matches the right API route."    code = 400class NotWorkflowAppError(BaseHTTPException):    error_code = 'not_workflow_app'    description = "Please check if your Workflow app mode matches the right API route."    code = 400class ConversationCompletedError(BaseHTTPException):    error_code = 'conversation_completed'    description = "The conversation has ended. Please start a new conversation."    code = 400class ProviderNotInitializeError(BaseHTTPException):    error_code = 'provider_not_initialize'    description = "No valid model provider credentials found. " \                  "Please go to Settings -> Model Provider to complete your provider credentials."    code = 400class ProviderQuotaExceededError(BaseHTTPException):    error_code = 'provider_quota_exceeded'    description = "Your quota for Dify Hosted OpenAI has been exhausted. " \                  "Please go to Settings -> Model Provider to complete your own provider credentials."    code = 400class ProviderModelCurrentlyNotSupportError(BaseHTTPException):    error_code = 'model_currently_not_support'    description = "Dify Hosted OpenAI trial currently not support the GPT-4 model."    code = 400class CompletionRequestError(BaseHTTPException):    error_code = 'completion_request_error'    description = "Completion request failed."    code = 400class AppMoreLikeThisDisabledError(BaseHTTPException):    error_code = 'app_more_like_this_disabled'    description = "The 'More like this' feature is disabled. Please refresh your page."    code = 403class AppSuggestedQuestionsAfterAnswerDisabledError(BaseHTTPException):    error_code = 'app_suggested_questions_after_answer_disabled'    description = "The 'Suggested Questions After Answer' feature is disabled. Please refresh your page."    code = 403class NoAudioUploadedError(BaseHTTPException):    error_code = 'no_audio_uploaded'    description = "Please upload your audio."    code = 400class AudioTooLargeError(BaseHTTPException):    error_code = 'audio_too_large'    description = "Audio size exceeded. {message}"    code = 413class UnsupportedAudioTypeError(BaseHTTPException):    error_code = 'unsupported_audio_type'    description = "Audio type not allowed."    code = 415class ProviderNotSupportSpeechToTextError(BaseHTTPException):    error_code = 'provider_not_support_speech_to_text'    description = "Provider not support speech to text."    code = 400class NoFileUploadedError(BaseHTTPException):    error_code = 'no_file_uploaded'    description = "Please upload your file."    code = 400class TooManyFilesError(BaseHTTPException):    error_code = 'too_many_files'    description = "Only one file is allowed."    code = 400class FileTooLargeError(BaseHTTPException):    error_code = 'file_too_large'    description = "File size exceeded. {message}"    code = 413class UnsupportedFileTypeError(BaseHTTPException):    error_code = 'unsupported_file_type'    description = "File type not allowed."    code = 415class WebSSOAuthRequiredError(BaseHTTPException):    error_code = 'web_sso_auth_required'    description = "Web SSO authentication required."    code = 401
 |