error.py 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 = "Provider Token not initialize."
  9. code = 400
  10. class ProviderQuotaExceededError(BaseHTTPException):
  11. error_code = 'provider_quota_exceeded'
  12. description = "Provider quota exceeded."
  13. code = 400
  14. class ProviderModelCurrentlyNotSupportError(BaseHTTPException):
  15. error_code = 'model_currently_not_support'
  16. description = "GPT-4 currently not support."
  17. code = 400
  18. class ConversationCompletedError(BaseHTTPException):
  19. error_code = 'conversation_completed'
  20. description = "Conversation was completed."
  21. code = 400
  22. class AppUnavailableError(BaseHTTPException):
  23. error_code = 'app_unavailable'
  24. description = "App unavailable."
  25. code = 400
  26. class CompletionRequestError(BaseHTTPException):
  27. error_code = 'completion_request_error'
  28. description = "Completion request failed."
  29. code = 400
  30. class AppMoreLikeThisDisabledError(BaseHTTPException):
  31. error_code = 'app_more_like_this_disabled'
  32. description = "More like this disabled."
  33. code = 403