MCPcopy
hub / github.com/1Panel-dev/MaxKB / chat

Method chat

apps/chat/serializers/chat.py:456–470  ·  view source on GitHub ↗
(self, instance: dict, base_to_response: BaseToResponse = SystemToResponse())

Source from the content-addressed store, hash-verified

454 raise ChatException(500, _("The chat user is not authorized."))
455
456 def chat(self, instance: dict, base_to_response: BaseToResponse = SystemToResponse()):
457 super().is_valid(raise_exception=True)
458 ChatMessageSerializers(data=instance).is_valid(raise_exception=True)
459 chat_info = self.get_chat_info()
460 chat_info.get_application()
461 chat_info.get_chat_user(asker=(instance.get('form_data') or {}).get('asker'))
462 self.is_valid_chat_id(chat_info)
463 if not self.data.get('debug'):
464 self.is_valid_chat_user()
465 if chat_info.application.type == ApplicationTypeChoices.SIMPLE:
466 self.is_valid_application_simple(raise_exception=True, chat_info=chat_info)
467 return self.chat_simple(chat_info, instance, base_to_response)
468 else:
469 self.is_valid_application_workflow(raise_exception=True)
470 return self.chat_work_flow(chat_info, instance, base_to_response)
471
472 def get_chat_info(self):
473 self.is_valid(raise_exception=True)

Callers 8

chatMethod · 0.45
chatMethod · 0.45
postMethod · 0.45
postMethod · 0.45
call_toolMethod · 0.45
executeMethod · 0.45
executeMethod · 0.45
postMethod · 0.45

Calls 13

get_chat_infoMethod · 0.95
is_valid_chat_idMethod · 0.95
is_valid_chat_userMethod · 0.95
chat_simpleMethod · 0.95
chat_work_flowMethod · 0.95
SystemToResponseClass · 0.90
get_applicationMethod · 0.80
get_chat_userMethod · 0.80
is_validMethod · 0.45

Tested by

no test coverage detected