mirror of
https://github.com/guohuadeng/app-odoo.git
synced 2025-02-23 04:11:36 +02:00
update app_chatgpt disconnect
This commit is contained in:
@@ -5,3 +5,4 @@ from . import mail_channel
|
|||||||
from . import res_config_settings
|
from . import res_config_settings
|
||||||
from . import gpt_robot
|
from . import gpt_robot
|
||||||
from . import res_users
|
from . import res_users
|
||||||
|
from . import mail_message
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import requests
|
||||||
from odoo import api, fields, models, _
|
from odoo import api, fields, models, _
|
||||||
|
|
||||||
|
|
||||||
@@ -12,3 +13,7 @@ class GptRobot(models.Model):
|
|||||||
openapi_api_key = fields.Char(string="API Key", help="Provide the API key here")
|
openapi_api_key = fields.Char(string="API Key", help="Provide the API key here")
|
||||||
temperature = fields.Float(string='Temperature', default=0.9)
|
temperature = fields.Float(string='Temperature', default=0.9)
|
||||||
sequence = fields.Integer('Sequence', help="Determine the display order", default=10)
|
sequence = fields.Integer('Sequence', help="Determine the display order", default=10)
|
||||||
|
|
||||||
|
def action_disconnect(self):
|
||||||
|
requests.delete('https://chatgpt.com/v1/disconnect')
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ from odoo import api, fields, models, _
|
|||||||
from odoo.exceptions import UserError
|
from odoo.exceptions import UserError
|
||||||
import logging
|
import logging
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class Channel(models.Model):
|
class Channel(models.Model):
|
||||||
_inherit = 'mail.channel'
|
_inherit = 'mail.channel'
|
||||||
|
|
||||||
@@ -18,7 +20,7 @@ class Channel(models.Model):
|
|||||||
"model": "text-davinci-003",
|
"model": "text-davinci-003",
|
||||||
"prompt": data,
|
"prompt": data,
|
||||||
"temperature": 0.9,
|
"temperature": 0.9,
|
||||||
"max_tokens": 1000,
|
"max_tokens": 2000,
|
||||||
"top_p": 1,
|
"top_p": 1,
|
||||||
"frequency_penalty": 0.0,
|
"frequency_penalty": 0.0,
|
||||||
"presence_penalty": 0.6,
|
"presence_penalty": 0.6,
|
||||||
|
|||||||
13
app_chatgpt/models/mail_message.py
Normal file
13
app_chatgpt/models/mail_message.py
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from odoo import fields, models
|
||||||
|
|
||||||
|
|
||||||
|
class Message(models.Model):
|
||||||
|
_inherit = "mail.message"
|
||||||
|
|
||||||
|
def _message_add_reaction(self, content):
|
||||||
|
super(Message, self)._message_add_reaction(content)
|
||||||
|
if self.create_uid.gpt_id:
|
||||||
|
# 处理反馈
|
||||||
|
pass
|
||||||
@@ -43,6 +43,15 @@
|
|||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<record id="model_gpt_robot_action_disconnect" model="ir.actions.server">
|
||||||
|
<field name="name">Disconnect</field>
|
||||||
|
<field name="model_id" ref="app_chatgpt.model_gpt_robot"/>
|
||||||
|
<field name="binding_model_id" ref="app_chatgpt.model_gpt_robot"/>
|
||||||
|
<field name="binding_view_types">list,form</field>
|
||||||
|
<field name="state">code</field>
|
||||||
|
<field name="code">action = records.action_disconnect()</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
<menuitem
|
<menuitem
|
||||||
id="menu_gpt_robot"
|
id="menu_gpt_robot"
|
||||||
name="GPT Robot"
|
name="GPT Robot"
|
||||||
|
|||||||
Reference in New Issue
Block a user