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 gpt_robot
|
||||
from . import res_users
|
||||
from . import mail_message
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import requests
|
||||
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")
|
||||
temperature = fields.Float(string='Temperature', default=0.9)
|
||||
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
|
||||
import logging
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Channel(models.Model):
|
||||
_inherit = 'mail.channel'
|
||||
|
||||
@@ -18,7 +20,7 @@ class Channel(models.Model):
|
||||
"model": "text-davinci-003",
|
||||
"prompt": data,
|
||||
"temperature": 0.9,
|
||||
"max_tokens": 1000,
|
||||
"max_tokens": 2000,
|
||||
"top_p": 1,
|
||||
"frequency_penalty": 0.0,
|
||||
"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>
|
||||
</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
|
||||
id="menu_gpt_robot"
|
||||
name="GPT Robot"
|
||||
|
||||
Reference in New Issue
Block a user