(self, instance: dict, base_to_response: BaseToResponse = SystemToResponse())
| 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 | |
| 151 | SYSTEM_ROLE = get_file_content(os.path.join(PROJECT_DIR, "apps", "chat", 'template', 'generate_prompt_system')) |
nothing calls this directly
no test coverage detected