prepare #I6SC9C app_chatgpt优化,指定用户时增加使用情况

This commit is contained in:
Chill
2023-04-12 17:50:36 +08:00
parent fbc2453f8f
commit 3304a1f5a6
8 changed files with 185 additions and 105 deletions

View File

@@ -45,7 +45,9 @@ class Channel(models.Model):
return '\n'.join(prompt[::-1])
def get_ai(self, ai, prompt, partner_name, channel, user_id, message):
res = ai.get_ai(prompt, partner_name)
sender_id = message.create_uid.partner_id
answer_id = user_id.partner_id
res = ai.get_ai(prompt, sender_id, answer_id)
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)