mirror of
				https://github.com/langgenius/dify.git
				synced 2025-10-31 02:42:59 +00:00 
			
		
		
		
	 d186daa131
			
		
	
	
		d186daa131
		
			
		
	
	
	
	
		
			
			Signed-off-by: -LAN- <laipz8200@outlook.com> Co-authored-by: Hash Brown <hi@xzd.me> Co-authored-by: crazywoola <427733928@qq.com> Co-authored-by: GareArc <chen4851@purdue.edu> Co-authored-by: Byron.wang <byron@dify.ai> Co-authored-by: Joel <iamjoel007@gmail.com> Co-authored-by: -LAN- <laipz8200@outlook.com> Co-authored-by: Garfield Dai <dai.hai@foxmail.com> Co-authored-by: KVOJJJin <jzongcode@gmail.com> Co-authored-by: Alexi.F <654973939@qq.com> Co-authored-by: Xiyuan Chen <52963600+GareArc@users.noreply.github.com> Co-authored-by: kautsar_masuara <61046989+izon-masuara@users.noreply.github.com> Co-authored-by: achmad-kautsar <achmad.kautsar@insignia.co.id> Co-authored-by: Xin Zhang <sjhpzx@gmail.com> Co-authored-by: kelvintsim <83445753+kelvintsim@users.noreply.github.com> Co-authored-by: zxhlyh <jasonapring2015@outlook.com> Co-authored-by: Zixuan Cheng <61724187+Theysua@users.noreply.github.com>
		
			
				
	
	
		
			142 lines
		
	
	
		
			4.0 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			142 lines
		
	
	
		
			4.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 Workflow 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 AppMoreLikeThisDisabledError(BaseHTTPException):
 | |
|     error_code = "app_more_like_this_disabled"
 | |
|     description = "The 'More like this' feature is disabled. Please refresh your page."
 | |
|     code = 403
 | |
| 
 | |
| 
 | |
| class AppSuggestedQuestionsAfterAnswerDisabledError(BaseHTTPException):
 | |
|     error_code = "app_suggested_questions_after_answer_disabled"
 | |
|     description = "The 'Suggested Questions After Answer' feature is disabled. Please refresh your page."
 | |
|     code = 403
 | |
| 
 | |
| 
 | |
| 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
 | |
| 
 | |
| 
 | |
| class WebAppAuthRequiredError(BaseHTTPException):
 | |
|     error_code = "web_sso_auth_required"
 | |
|     description = "Web app authentication required."
 | |
|     code = 401
 | |
| 
 | |
| 
 | |
| class WebAppAuthAccessDeniedError(BaseHTTPException):
 | |
|     error_code = "web_app_access_denied"
 | |
|     description = "You do not have permission to access this web app."
 | |
|     code = 401
 | |
| 
 | |
| 
 | |
| class InvokeRateLimitError(BaseHTTPException):
 | |
|     """Raised when the Invoke returns rate limit error."""
 | |
| 
 | |
|     error_code = "rate_limit_error"
 | |
|     description = "Rate Limit Error"
 | |
|     code = 429
 |