159 lines
7.6 KiB
XML
159 lines
7.6 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<odoo>
|
|
<!-- ============================================ -->
|
|
<!-- 根菜单 & 系统配置父菜单 -->
|
|
<!-- ============================================ -->
|
|
<menuitem id="menu_ai_root" name="AI 助手" sequence="70"
|
|
web_icon="yuthon_ai_agent,static/description/icon.png"
|
|
groups="yuthon_ai_agent.group_ai_agent_user,yuthon_ai_agent.group_ai_agent_admin"/>
|
|
|
|
<menuitem id="menu_system_config" name="系统配置"
|
|
parent="menu_ai_root" sequence="50"
|
|
groups="yuthon_ai_agent.group_ai_agent_admin"/>
|
|
|
|
<!-- ============================================ -->
|
|
<!-- AI 服务商 - 列表视图 -->
|
|
<!-- ============================================ -->
|
|
<record id="view_ai_provider_tree" model="ir.ui.view">
|
|
<field name="name">ai.provider.tree</field>
|
|
<field name="model">ai.provider</field>
|
|
<field name="arch" type="xml">
|
|
<tree string="AI 服务商">
|
|
<field name="name"/>
|
|
<field name="provider_type"/>
|
|
<field name="model_name"/>
|
|
<field name="api_base"/>
|
|
<field name="timeout"/>
|
|
<field name="enable_tools" widget="boolean_toggle"/>
|
|
<field name="allow_write" widget="boolean_toggle"/>
|
|
<field name="provider_total_tokens" string="Token 用量"/>
|
|
<field name="provider_call_count" string="调用次数"/>
|
|
<field name="active" widget="boolean_toggle"/>
|
|
</tree>
|
|
</field>
|
|
</record>
|
|
|
|
<!-- ============================================ -->
|
|
<!-- AI 服务商 - 表单视图 -->
|
|
<!-- ============================================ -->
|
|
<record id="view_ai_provider_form" model="ir.ui.view">
|
|
<field name="name">ai.provider.form</field>
|
|
<field name="model">ai.provider</field>
|
|
<field name="arch" type="xml">
|
|
<form string="AI 服务商">
|
|
<sheet>
|
|
<widget name="web_ribbon" title="已停用"
|
|
bg_color="text-bg-danger" invisible="active"/>
|
|
|
|
<!-- Stat Buttons -->
|
|
<div class="oe_button_box" name="button_box">
|
|
<button name="action_view_provider_token_usage" type="object"
|
|
class="oe_stat_button" icon="fa-bar-chart">
|
|
<div class="o_stat_info">
|
|
<field name="provider_total_tokens" class="o_stat_value"/>
|
|
<span class="o_stat_text">Token</span>
|
|
</div>
|
|
</button>
|
|
<button name="action_view_provider_token_usage" type="object"
|
|
class="oe_stat_button" icon="fa-bolt">
|
|
<div class="o_stat_info">
|
|
<field name="provider_call_count" class="o_stat_value"/>
|
|
<span class="o_stat_text">调用</span>
|
|
</div>
|
|
</button>
|
|
</div>
|
|
|
|
<div class="oe_title">
|
|
<h1>
|
|
<field name="name" placeholder="如:OpenAI GPT-4、本地 Ollama"/>
|
|
</h1>
|
|
</div>
|
|
|
|
<!-- 连接配置 -->
|
|
<group string="连接配置">
|
|
<group>
|
|
<field name="provider_type"/>
|
|
<field name="api_base"/>
|
|
<field name="api_key" password="True"/>
|
|
</group>
|
|
<group>
|
|
<field name="active"/>
|
|
<field name="model_name"
|
|
placeholder="gpt-4o-mini / qwen-plus / deepseek-chat ..."/>
|
|
</group>
|
|
</group>
|
|
|
|
<!-- 模型参数 -->
|
|
<group string="模型参数">
|
|
<group>
|
|
<field name="max_tokens"/>
|
|
<field name="temperature"/>
|
|
</group>
|
|
<group>
|
|
<field name="timeout"/>
|
|
</group>
|
|
</group>
|
|
|
|
<!-- 权限 / 工具 -->
|
|
<group string="工具调用 (Function Calling)">
|
|
<group>
|
|
<field name="enable_tools"/>
|
|
</group>
|
|
<group>
|
|
<field name="allow_write"/>
|
|
</group>
|
|
</group>
|
|
<div class="alert alert-warning" role="alert"
|
|
invisible="not allow_write">
|
|
⚠ 已开启写入权限:AI 可以创建 / 修改 / 删除业务数据,请仅在受信任环境使用。
|
|
</div>
|
|
|
|
<!-- 关联规则 -->
|
|
<notebook>
|
|
<page string="关联规则" name="rules">
|
|
<field name="rule_ids" widget="many2many_tags"
|
|
options="{'no_create': False, 'color_field': 'rule_type'}"/>
|
|
<p class="text-muted">
|
|
绑定的规则将根据用户组自动生效:回复指令 → 注入 AI 系统提示词;限制规则 → 禁止回答特定话题;技能接口 → 注册为 AI 可调用工具。
|
|
</p>
|
|
</page>
|
|
<page string="OCR 配置" name="ocr">
|
|
<group string="腾讯云 OCR(附件图片/PDF 文字识别)">
|
|
<group>
|
|
<field name="ocr_enabled"/>
|
|
</group>
|
|
<group>
|
|
<field name="ocr_region"/>
|
|
</group>
|
|
</group>
|
|
<group string="API 密钥" invisible="not ocr_enabled">
|
|
<field name="ocr_secret_id"
|
|
placeholder="在 https://console.cloud.tencent.com/cam/capi 获取"/>
|
|
<field name="ocr_secret_key" password="True"
|
|
placeholder="腾讯云 SecretKey"/>
|
|
</group>
|
|
<p class="text-muted" invisible="not ocr_enabled">
|
|
密钥在 <a href="https://console.cloud.tencent.com/cam/capi" target="_blank">腾讯云 API 密钥管理</a> 获取。
|
|
每月免费 1000 次调用,超出按量计费(约 0.15 元/次)。
|
|
</p>
|
|
</page>
|
|
</notebook>
|
|
</sheet>
|
|
</form>
|
|
</field>
|
|
</record>
|
|
|
|
<!-- Action -->
|
|
<record id="action_ai_provider" model="ir.actions.act_window">
|
|
<field name="name">服务商配置</field>
|
|
<field name="res_model">ai.provider</field>
|
|
<field name="view_mode">tree,form</field>
|
|
</record>
|
|
|
|
<!-- 服务商配置菜单 → 归入系统配置 -->
|
|
<menuitem id="menu_ai_provider" name="服务商配置"
|
|
parent="menu_system_config" action="action_ai_provider" sequence="1"
|
|
groups="yuthon_ai_agent.group_ai_agent_admin"/>
|
|
|
|
</odoo>
|