prepare #I6SC9C 处理azure私聊群聊,app_chatgpt优化,指定用户时增加使用情况

This commit is contained in:
ivan deng
2023-04-13 06:55:59 +08:00
parent aaa310ef63
commit 753fea8ebb
5 changed files with 77 additions and 73 deletions

View File

@@ -7,12 +7,14 @@ from .lib.WordsSearch import WordsSearch
class MailThread(models.AbstractModel):
_inherit = "mail.thread"
@api.returns('mail.message', lambda value: value.id)
def message_post(self, **kwargs):
self.ensure_one()
search = WordsSearch()
search.SetKeywords([])
body = kwargs.get('body', False)
body = search.Replace(text=body)
kwargs.update({'body': body})
return super(MailThread, self).message_post(**kwargs)
# todo: 不是说在此屏蔽,而是当用户发出敏感词时,提示下,同时不发送到 ai
# @api.returns('mail.message', lambda value: value.id)
# def message_post(self, **kwargs):
# self.ensure_one()
# search = WordsSearch()
# search.SetKeywords([])
# body = kwargs.get('body', False)
# body = search.Replace(text=body)
# kwargs.update({'body': body})
# return super(MailThread, self).message_post(**kwargs)