Files
app-odoo/app_chatgpt/models/res_users.py

27 lines
1.1 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -*- coding: utf-8 -*-
from odoo import fields, models
class ResUsers(models.Model):
_inherit = "res.users"
# 改为在 partner中设置用户处绑定
gpt_id = fields.Many2one('ai.robot', string='Bind to ChatGpt', related='partner_id.gpt_id', inherited=True, readonly=False)
gpt_policy = fields.Selection([
('all', 'All Users'),
('limit', 'Selected Users')
], string='Allowed Conversation Mode', default='all', ondelete='set default')
gpt_wl_users = fields.Many2many('res.users', 'res_users_res_users_rel', 'robot_id', 'user_id', string='Allowed Users', domain="[('id', '!=', id)]")
gpt_demo_time = fields.Integer('Default Demo Time', default=0)
first_ask_time = fields.Datetime('First Ask Time')
service_start_date = fields.Datetime('Service Start Date')
service_end_date = fields.Datetime('Service End Date')
used_number = fields.Integer('Number of Used')
max_number = fields.Integer('Max Number of Call')
human_prompt_tokens = fields.Integer('Human Prompt Tokens')
ai_completion_tokens = fields.Integer('AI Completion Tokens')
tokens_total = fields.Integer('Total Tokens')