From 96896d0b506db699e883dc6a4489e9a851e5d840 Mon Sep 17 00:00:00 2001 From: ivan deng Date: Sun, 23 Apr 2023 19:35:19 +0800 Subject: [PATCH] fix chat but --- app_chatgpt/models/mail_channel.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app_chatgpt/models/mail_channel.py b/app_chatgpt/models/mail_channel.py index 3dcd6b93..2f7c21db 100644 --- a/app_chatgpt/models/mail_channel.py +++ b/app_chatgpt/models/mail_channel.py @@ -165,7 +165,10 @@ class Channel(models.Model): sync_config = self.env['ir.config_parameter'].sudo().get_param('app_chatgpt.openai_sync_config') openai.api_key = api_key # 非4版本,取0次。其它取3 次历史 - chat_count = 0 if '4' in ai.ai_model else 3 + if '4' in ai.ai_model: + chat_count = 1 if self.chat_count > 0 else 0 + else: + chat_count = self.chat_count if author_id != answer_id.id and self.channel_type == 'chat': # 私聊 _logger.info(f'私聊:author_id:{author_id},partner_chatgpt.id:{answer_id.id}')