error.py 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. from libs.exception import BaseHTTPException
  2. class AppNotFoundError(BaseHTTPException):
  3. error_code = 'app_not_found'
  4. description = "App not found."
  5. code = 404
  6. class ProviderNotInitializeError(BaseHTTPException):
  7. error_code = 'provider_not_initialize'
  8. description = "No valid model provider credentials found. " \
  9. "Please go to Settings -> Model Provider to complete your provider credentials."
  10. code = 400
  11. class ProviderQuotaExceededError(BaseHTTPException):
  12. error_code = 'provider_quota_exceeded'
  13. description = "Your quota for Dify Hosted OpenAI has been exhausted. " \
  14. "Please go to Settings -> Model Provider to complete your own provider credentials."
  15. code = 400
  16. class ProviderModelCurrentlyNotSupportError(BaseHTTPException):
  17. error_code = 'model_currently_not_support'
  18. description = "Dify Hosted OpenAI trial currently not support the GPT-4 model."
  19. code = 400
  20. class ConversationCompletedError(BaseHTTPException):
  21. error_code = 'conversation_completed'
  22. description = "The conversation has ended. Please start a new conversation."
  23. code = 400
  24. class AppUnavailableError(BaseHTTPException):
  25. error_code = 'app_unavailable'
  26. description = "App unavailable, please check your app configurations."
  27. code = 400
  28. class CompletionRequestError(BaseHTTPException):
  29. error_code = 'completion_request_error'
  30. description = "Completion request failed."
  31. code = 400
  32. class AppMoreLikeThisDisabledError(BaseHTTPException):
  33. error_code = 'app_more_like_this_disabled'
  34. description = "The 'More like this' feature is disabled. Please refresh your page."
  35. code = 403