MCPcopy Index your code
hub / github.com/1Panel-dev/MaxKB / is_valid_application_simple

Method is_valid_application_simple

apps/chat/serializers/chat.py:323–335  ·  view source on GitHub ↗
(self, *, chat_info: ChatInfo, raise_exception=False)

Source from the content-addressed store, hash-verified

321 raise AppChatNumOutOfBoundsFailed(1002, _("The number of visits exceeds today's visits"))
322
323 def is_valid_application_simple(self, *, chat_info: ChatInfo, raise_exception=False):
324 self.is_valid_intraday_access_num()
325 model_id = chat_info.application.model_id
326 if model_id is None:
327 return chat_info
328 model = QuerySet(Model).filter(id=model_id).first()
329 if model is None:
330 return chat_info
331 if model.status == Status.ERROR:
332 raise ChatException(500, _("The current model is not available"))
333 if model.status == Status.DOWNLOAD:
334 raise ChatException(500, _("The model is downloading, please try again later"))
335 return chat_info
336
337 def chat_simple(self, chat_info: ChatInfo, instance, base_to_response):
338 message = instance.get('message')

Callers 1

chatMethod · 0.95

Calls 2

ChatExceptionClass · 0.90

Tested by

no test coverage detected