mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 19:59:50 +08:00
13be84e4d4
Some checks are pending
Build and Push API & Web / build (api, DIFY_API_IMAGE_NAME, linux/amd64, build-api-amd64) (push) Waiting to run
Build and Push API & Web / build (api, DIFY_API_IMAGE_NAME, linux/arm64, build-api-arm64) (push) Waiting to run
Build and Push API & Web / build (web, DIFY_WEB_IMAGE_NAME, linux/amd64, build-web-amd64) (push) Waiting to run
Build and Push API & Web / build (web, DIFY_WEB_IMAGE_NAME, linux/arm64, build-web-arm64) (push) Waiting to run
Build and Push API & Web / create-manifest (api, DIFY_API_IMAGE_NAME, merge-api-images) (push) Blocked by required conditions
Build and Push API & Web / create-manifest (web, DIFY_WEB_IMAGE_NAME, merge-web-images) (push) Blocked by required conditions
110 lines
3.0 KiB
Python
110 lines
3.0 KiB
Python
from libs.exception import BaseHTTPException
|
|
|
|
|
|
class AppUnavailableError(BaseHTTPException):
|
|
error_code = "app_unavailable"
|
|
description = "App unavailable, please check your app configurations."
|
|
code = 400
|
|
|
|
|
|
class NotCompletionAppError(BaseHTTPException):
|
|
error_code = "not_completion_app"
|
|
description = "Please check if your Completion app mode matches the right API route."
|
|
code = 400
|
|
|
|
|
|
class NotChatAppError(BaseHTTPException):
|
|
error_code = "not_chat_app"
|
|
description = "Please check if your app mode matches the right API route."
|
|
code = 400
|
|
|
|
|
|
class NotWorkflowAppError(BaseHTTPException):
|
|
error_code = "not_workflow_app"
|
|
description = "Please check if your app mode matches the right API route."
|
|
code = 400
|
|
|
|
|
|
class ConversationCompletedError(BaseHTTPException):
|
|
error_code = "conversation_completed"
|
|
description = "The conversation has ended. Please start a new conversation."
|
|
code = 400
|
|
|
|
|
|
class 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 = 400
|
|
|
|
|
|
class 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 = 400
|
|
|
|
|
|
class ProviderModelCurrentlyNotSupportError(BaseHTTPException):
|
|
error_code = "model_currently_not_support"
|
|
description = "Dify Hosted OpenAI trial currently not support the GPT-4 model."
|
|
code = 400
|
|
|
|
|
|
class CompletionRequestError(BaseHTTPException):
|
|
error_code = "completion_request_error"
|
|
description = "Completion request failed."
|
|
code = 400
|
|
|
|
|
|
class NoAudioUploadedError(BaseHTTPException):
|
|
error_code = "no_audio_uploaded"
|
|
description = "Please upload your audio."
|
|
code = 400
|
|
|
|
|
|
class AudioTooLargeError(BaseHTTPException):
|
|
error_code = "audio_too_large"
|
|
description = "Audio size exceeded. {message}"
|
|
code = 413
|
|
|
|
|
|
class UnsupportedAudioTypeError(BaseHTTPException):
|
|
error_code = "unsupported_audio_type"
|
|
description = "Audio type not allowed."
|
|
code = 415
|
|
|
|
|
|
class ProviderNotSupportSpeechToTextError(BaseHTTPException):
|
|
error_code = "provider_not_support_speech_to_text"
|
|
description = "Provider not support speech to text."
|
|
code = 400
|
|
|
|
|
|
class NoFileUploadedError(BaseHTTPException):
|
|
error_code = "no_file_uploaded"
|
|
description = "Please upload your file."
|
|
code = 400
|
|
|
|
|
|
class TooManyFilesError(BaseHTTPException):
|
|
error_code = "too_many_files"
|
|
description = "Only one file is allowed."
|
|
code = 400
|
|
|
|
|
|
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
|