[UPD] app_chatgpt 15.0

This commit is contained in:
Chill
2024-04-24 18:56:55 +08:00
parent d26b55cde3
commit e533269196
6 changed files with 15 additions and 14 deletions

View File

@@ -24,7 +24,8 @@ class AiRobot(models.Model):
# update ai_robot set ai_model=set_ai_model
ai_model = fields.Char(string="AI Model", required=True, default='auto', help='Customize input')
set_ai_model = fields.Selection(string="Quick Set Model", selection=[
('gpt-3.5-turbo-0613', 'gpt-3.5-turbo-0613(Default and Latest)'),
('gpt-3.5-turbo-0125', 'gpt-3.5-turbo-0125(Default and Latest)'),
('gpt-3.5-turbo-0613', 'gpt-3.5-turbo-0613'),
('gpt-3.5-turbo-16k-0613', 'gpt-3.5-turbo-16k-0613(Big text)'),
('gpt-4', 'Chatgpt 4'),
('gpt-4-32k', 'Chatgpt 4 32k'),
@@ -34,7 +35,7 @@ class AiRobot(models.Model):
('code-davinci-002', 'Chatgpt 2 Code Optimized'),
('text-davinci-002', 'Chatgpt 2 Davinci'),
('dall-e2', 'Dall-E Image'),
], default='gpt-3.5-turbo-0613',
], default='gpt-3.5-turbo-0125',
help="""
GPT-4: Can understand Image, generate natural language or code.
GPT-3.5: A set of models that improve on GPT-3 and can understand as well as generate natural language or code

View File

@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
import openai
import logging
import requests, json
import datetime
# from transformers import TextDavinciTokenizer, TextDavinciModel
@@ -9,7 +10,7 @@ from odoo.exceptions import UserError
from odoo.osv import expression
from odoo.addons.app_common.models.base import get_ua_type
import logging
_logger = logging.getLogger(__name__)
@@ -249,7 +250,7 @@ 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信息丢失
plaintext_ct = tools.html_to_inner_content(message.body)
plaintext_ct = tools.html2plaintext(message.body)
msg = plaintext_ct.replace('@%s' % answer_id.name, '').lstrip()
if not msg: