From b000cbfff7b78a52de396b87413f74490c1260a7 Mon Sep 17 00:00:00 2001 From: Chill Date: Mon, 17 Apr 2023 14:28:05 +0800 Subject: [PATCH] fix msg body --- 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 704518e0..90196a4b 100644 --- a/app_chatgpt/models/mail_channel.py +++ b/app_chatgpt/models/mail_channel.py @@ -4,7 +4,7 @@ import openai import requests, json import datetime # from transformers import TextDavinciTokenizer, TextDavinciModel -from odoo import api, fields, models, _ +from odoo import api, fields, models, tools, _ from odoo.exceptions import UserError import logging @@ -129,7 +129,8 @@ class Channel(models.Model): msg = _("Please warmly welcome our new partner %s and send him the best wishes.") % message.author_id.name else: # 不能用 preview, 如果用 : 提示词则 preview信息丢失 - msg = message.description.replace('@%s' % answer_id.name, '').lstrip() + plaintext_ct = tools.html_to_inner_content(message.body) + msg = plaintext_ct.replace('@%s' % answer_id.name, '').lstrip() if not msg: return rdata