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

Method get_chat_record

apps/chat/serializers/chat.py:379–390  ·  view source on GitHub ↗
(chat_info, chat_record_id)

Source from the content-addressed store, hash-verified

377
378 @staticmethod
379 def get_chat_record(chat_info, chat_record_id):
380 if chat_info is not None:
381 chat_record_list = [chat_record for chat_record in chat_info.chat_record_list if
382 str(chat_record.id) == str(chat_record_id)]
383 if chat_record_list is not None and len(chat_record_list):
384 return chat_record_list[-1]
385 chat_record = QuerySet(ChatRecord).filter(id=chat_record_id, chat_id=chat_info.chat_id).first()
386 if chat_record is None:
387 if not is_valid_uuid(chat_record_id):
388 raise ChatException(500, _("Conversation record does not exist"))
389 chat_record = QuerySet(ChatRecord).filter(id=chat_record_id).first()
390 return chat_record
391
392 def chat_work_flow(self, chat_info: ChatInfo, instance: dict, base_to_response):
393 message = instance.get('message')

Callers 1

chat_work_flowMethod · 0.95

Calls 2

is_valid_uuidFunction · 0.90
ChatExceptionClass · 0.90

Tested by

no test coverage detected