error.py 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. # -*- coding:utf-8 -*-
  2. from libs.exception import BaseHTTPException
  3. class AppUnavailableError(BaseHTTPException):
  4. error_code = 'app_unavailable'
  5. description = "App unavailable."
  6. code = 400
  7. class NotCompletionAppError(BaseHTTPException):
  8. error_code = 'not_completion_app'
  9. description = "Not Completion App"
  10. code = 400
  11. class NotChatAppError(BaseHTTPException):
  12. error_code = 'not_chat_app'
  13. description = "Not Chat App"
  14. code = 400
  15. class ConversationCompletedError(BaseHTTPException):
  16. error_code = 'conversation_completed'
  17. description = "Conversation Completed."
  18. code = 400
  19. class ProviderNotInitializeError(BaseHTTPException):
  20. error_code = 'provider_not_initialize'
  21. description = "Provider Token not initialize."
  22. code = 400
  23. class ProviderQuotaExceededError(BaseHTTPException):
  24. error_code = 'provider_quota_exceeded'
  25. description = "Provider quota exceeded."
  26. code = 400
  27. class ProviderModelCurrentlyNotSupportError(BaseHTTPException):
  28. error_code = 'model_currently_not_support'
  29. description = "GPT-4 currently not support."
  30. code = 400
  31. class CompletionRequestError(BaseHTTPException):
  32. error_code = 'completion_request_error'
  33. description = "Completion request failed."
  34. code = 400
  35. class AppMoreLikeThisDisabledError(BaseHTTPException):
  36. error_code = 'app_more_like_this_disabled'
  37. description = "More like this disabled."
  38. code = 403
  39. class AppSuggestedQuestionsAfterAnswerDisabledError(BaseHTTPException):
  40. error_code = 'app_suggested_questions_after_answer_disabled'
  41. description = "Function Suggested questions after answer disabled."
  42. code = 403