update chat not parent_id

This commit is contained in:
Chill
2023-04-07 13:47:13 +08:00
parent 6363f3ffd7
commit 90e68c2ff6

View File

@@ -48,7 +48,10 @@ class Channel(models.Model):
res = ai.get_ai(prompt, partner_name)
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)
if channel.channel_type == 'chat':
channel.with_user(user_id).message_post(body=res, message_type='comment', subtype_xmlid='mail.mt_comment')
else:
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)