fix #I6RFA0 [app_chat_gpt]异步处理,当前有问题

This commit is contained in:
Chill
2023-03-30 11:30:56 +08:00
parent 828e6bc8e8
commit 94c3dce069

View File

@@ -46,8 +46,9 @@ class Channel(models.Model):
def get_ai(self, ai, prompt, partner_name, channel, user_id, message):
res = ai.get_ai(prompt, partner_name)
res = res.replace('\n', '<br/>')
channel.with_user(user_id).message_post(body=res, message_type='comment', subtype_xmlid='mail.mt_comment', parent_id=message.id)
if res:
res = res.replace('\n', '<br/>')
channel.with_user(user_id).message_post(body=res, message_type='comment', subtype_xmlid='mail.mt_comment', parent_id=message.id)
def _notify_thread(self, message, msg_vals=False, **kwargs):
rdata = super(Channel, self)._notify_thread(message, msg_vals=msg_vals, **kwargs)