From 94c3dce0696ee2cd809dd1810a9095218ce613f8 Mon Sep 17 00:00:00 2001 From: Chill Date: Thu, 30 Mar 2023 11:30:56 +0800 Subject: [PATCH] =?UTF-8?q?fix=20#I6RFA0=20[app=5Fchat=5Fgpt]=E5=BC=82?= =?UTF-8?q?=E6=AD=A5=E5=A4=84=E7=90=86=EF=BC=8C=E5=BD=93=E5=89=8D=E6=9C=89?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app_chatgpt/models/mail_channel.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app_chatgpt/models/mail_channel.py b/app_chatgpt/models/mail_channel.py index 54308e12..ab5631b2 100644 --- a/app_chatgpt/models/mail_channel.py +++ b/app_chatgpt/models/mail_channel.py @@ -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', '
') - 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', '
') + 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)