| 
									
										
										
										
											2023-05-15 08:51:32 +08:00
										 |  |  | from libs.exception import BaseHTTPException | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class AppNotFoundError(BaseHTTPException): | 
					
						
							|  |  |  |     error_code = 'app_not_found' | 
					
						
							|  |  |  |     description = "App not found." | 
					
						
							|  |  |  |     code = 404 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class ProviderNotInitializeError(BaseHTTPException): | 
					
						
							|  |  |  |     error_code = 'provider_not_initialize' | 
					
						
							| 
									
										
										
										
											2023-05-22 17:39:28 +08:00
										 |  |  |     description = "No valid model provider credentials found. " \ | 
					
						
							|  |  |  |                   "Please go to Settings -> Model Provider to complete your provider credentials." | 
					
						
							| 
									
										
										
										
											2023-05-15 08:51:32 +08:00
										 |  |  |     code = 400 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class ProviderQuotaExceededError(BaseHTTPException): | 
					
						
							|  |  |  |     error_code = 'provider_quota_exceeded' | 
					
						
							| 
									
										
										
										
											2023-07-17 00:14:19 +08:00
										 |  |  |     description = "Your quota for Dify Hosted Model Provider has been exhausted. " \ | 
					
						
							| 
									
										
										
										
											2023-05-22 17:39:28 +08:00
										 |  |  |                   "Please go to Settings -> Model Provider to complete your own provider credentials." | 
					
						
							| 
									
										
										
										
											2023-05-15 08:51:32 +08:00
										 |  |  |     code = 400 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class ProviderModelCurrentlyNotSupportError(BaseHTTPException): | 
					
						
							|  |  |  |     error_code = 'model_currently_not_support' | 
					
						
							| 
									
										
										
										
											2023-05-22 17:39:28 +08:00
										 |  |  |     description = "Dify Hosted OpenAI trial currently not support the GPT-4 model." | 
					
						
							| 
									
										
										
										
											2023-05-15 08:51:32 +08:00
										 |  |  |     code = 400 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class ConversationCompletedError(BaseHTTPException): | 
					
						
							|  |  |  |     error_code = 'conversation_completed' | 
					
						
							| 
									
										
										
										
											2023-05-22 17:39:28 +08:00
										 |  |  |     description = "The conversation has ended. Please start a new conversation." | 
					
						
							| 
									
										
										
										
											2023-05-15 08:51:32 +08:00
										 |  |  |     code = 400 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class AppUnavailableError(BaseHTTPException): | 
					
						
							|  |  |  |     error_code = 'app_unavailable' | 
					
						
							| 
									
										
										
										
											2023-05-22 17:39:28 +08:00
										 |  |  |     description = "App unavailable, please check your app configurations." | 
					
						
							| 
									
										
										
										
											2023-05-15 08:51:32 +08:00
										 |  |  |     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' | 
					
						
							| 
									
										
										
										
											2023-05-22 17:39:28 +08:00
										 |  |  |     description = "The 'More like this' feature is disabled. Please refresh your page." | 
					
						
							| 
									
										
										
										
											2023-05-15 08:51:32 +08:00
										 |  |  |     code = 403 | 
					
						
							| 
									
										
										
										
											2023-07-07 17:50:42 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 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." | 
					
						
							| 
									
										
										
										
											2023-12-18 13:10:05 +08:00
										 |  |  |     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 | 
					
						
							| 
									
										
										
										
											2024-04-08 18:51:46 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class DraftWorkflowNotExist(BaseHTTPException): | 
					
						
							|  |  |  |     error_code = 'draft_workflow_not_exist' | 
					
						
							|  |  |  |     description = "Draft workflow need to be initialized." | 
					
						
							|  |  |  |     code = 400 |