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

Method chat

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

Source from the content-addressed store, hash-verified

136 chat_id = serializers.UUIDField(required=True, label=_("Conversation ID"))
137
138 def chat(self, instance: dict, base_to_response: BaseToResponse = SystemToResponse()):
139 self.is_valid(raise_exception=True)
140 chat_id = self.data.get('chat_id')
141 chat_info: ChatInfo = ChatInfo.get_cache(chat_id)
142 application = QuerySet(Application).filter(id=chat_info.application_id).first()
143 chat_info.application = application
144 return ChatSerializers(data={
145 'chat_id': chat_id, "chat_user_id": chat_info.chat_user_id,
146 "chat_user_type": chat_info.chat_user_type,
147 "application_id": chat_info.application.id, "debug": True
148 }).chat(instance, base_to_response)
149
150
151SYSTEM_ROLE = get_file_content(os.path.join(PROJECT_DIR, "apps", "chat", 'template', 'generate_prompt_system'))

Callers

nothing calls this directly

Calls 6

SystemToResponseClass · 0.90
ChatSerializersClass · 0.85
get_cacheMethod · 0.80
is_validMethod · 0.45
getMethod · 0.45
chatMethod · 0.45

Tested by

no test coverage detected