140 lines
6.6 KiB
XML
140 lines
6.6 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<odoo>
|
|
<!-- ============================================ -->
|
|
<!-- AI 规则 - 列表视图 -->
|
|
<!-- ============================================ -->
|
|
<record id="view_ai_rule_tree" model="ir.ui.view">
|
|
<field name="name">ai.rule.tree</field>
|
|
<field name="model">ai.rule</field>
|
|
<field name="arch" type="xml">
|
|
<tree string="AI 规则">
|
|
<field name="priority" widget="handle"/>
|
|
<field name="name"/>
|
|
<field name="rule_type" widget="badge"
|
|
decoration-info="rule_type == 'instruction'"
|
|
decoration-warning="rule_type == 'restriction'"
|
|
decoration-success="rule_type == 'skill'"/>
|
|
<field name="provider_ids" widget="many2many_tags"/>
|
|
<field name="group_ids" widget="many2many_tags"/>
|
|
<field name="active" widget="boolean_toggle"/>
|
|
</tree>
|
|
</field>
|
|
</record>
|
|
|
|
<!-- ============================================ -->
|
|
<!-- AI 规则 - 表单视图 -->
|
|
<!-- ============================================ -->
|
|
<record id="view_ai_rule_form" model="ir.ui.view">
|
|
<field name="name">ai.rule.form</field>
|
|
<field name="model">ai.rule</field>
|
|
<field name="arch" type="xml">
|
|
<form string="AI 规则">
|
|
<sheet>
|
|
<widget name="web_ribbon" title="已停用"
|
|
bg_color="text-bg-danger" invisible="active"/>
|
|
|
|
<div class="oe_title">
|
|
<h1>
|
|
<field name="name" placeholder="输入规则名称"/>
|
|
</h1>
|
|
</div>
|
|
|
|
<group>
|
|
<group string="基本设置">
|
|
<field name="rule_type"/>
|
|
<field name="priority"/>
|
|
<field name="active"/>
|
|
</group>
|
|
<group string="适用范围">
|
|
<field name="provider_ids" widget="many2many_tags"
|
|
options="{'no_create': True}"
|
|
placeholder="留空 = 所有服务商"/>
|
|
<field name="group_ids" widget="many2many_tags"
|
|
options="{'no_create': True}"
|
|
placeholder="留空 = 所有用户"/>
|
|
</group>
|
|
</group>
|
|
|
|
<notebook>
|
|
<!-- 回复指令 / 限制规则 -->
|
|
<page string="规则内容" name="content"
|
|
invisible="rule_type == 'skill'">
|
|
<field name="content" placeholder="写给 AI 的指令内容,如:所有回复不超过 200 字 / 不得回答薪资相关问题" nolabel="1"/>
|
|
</page>
|
|
|
|
<!-- 技能接口配置 -->
|
|
<page string="技能接口配置" name="skill"
|
|
invisible="rule_type != 'skill'">
|
|
<group>
|
|
<group string="技能定义">
|
|
<field name="skill_name"
|
|
placeholder="如:query_weather"/>
|
|
<field name="skill_description"
|
|
placeholder="当用户询问天气时调用此技能"/>
|
|
</group>
|
|
<group string="接口配置">
|
|
<field name="skill_endpoint"
|
|
placeholder="https://api.example.com/weather"/>
|
|
<field name="skill_method"/>
|
|
<field name="skill_timeout"/>
|
|
</group>
|
|
</group>
|
|
<group string="参数定义">
|
|
<field name="skill_parameters" nolabel="1"
|
|
placeholder='{"type": "object", "properties": {"city": {"type": "string", "description": "城市名"}}, "required": ["city"]}'/>
|
|
</group>
|
|
<group string="请求头">
|
|
<field name="skill_headers" nolabel="1"
|
|
placeholder='{"Authorization": "Bearer xxx"}'/>
|
|
</group>
|
|
</page>
|
|
</notebook>
|
|
</sheet>
|
|
</form>
|
|
</field>
|
|
</record>
|
|
|
|
<!-- ============================================ -->
|
|
<!-- AI 规则 - 搜索视图 -->
|
|
<!-- ============================================ -->
|
|
<record id="view_ai_rule_search" model="ir.ui.view">
|
|
<field name="name">ai.rule.search</field>
|
|
<field name="model">ai.rule</field>
|
|
<field name="arch" type="xml">
|
|
<search string="搜索规则">
|
|
<field name="name"/>
|
|
<field name="rule_type"/>
|
|
<filter name="filter_instruction" string="回复指令"
|
|
domain="[('rule_type','=','instruction')]"/>
|
|
<filter name="filter_restriction" string="限制规则"
|
|
domain="[('rule_type','=','restriction')]"/>
|
|
<filter name="filter_skill" string="技能接口"
|
|
domain="[('rule_type','=','skill')]"/>
|
|
<separator/>
|
|
<filter name="filter_active" string="已启用"
|
|
domain="[('active','=',True)]"/>
|
|
<filter name="filter_inactive" string="已停用"
|
|
domain="[('active','=',False)]"/>
|
|
<group expand="0" string="分组">
|
|
<filter name="group_type" string="规则类型"
|
|
context="{'group_by': 'rule_type'}"/>
|
|
</group>
|
|
</search>
|
|
</field>
|
|
</record>
|
|
|
|
<!-- Action -->
|
|
<record id="action_ai_rule" model="ir.actions.act_window">
|
|
<field name="name">规则配置</field>
|
|
<field name="res_model">ai.rule</field>
|
|
<field name="view_mode">tree,form</field>
|
|
<field name="context">{'search_default_filter_active': 1}</field>
|
|
</record>
|
|
|
|
<!-- 菜单 → 系统配置 -->
|
|
<menuitem id="menu_ai_rule" name="规则配置"
|
|
parent="menu_system_config" action="action_ai_rule" sequence="2"
|
|
groups="yuthon_ai_agent.group_ai_agent_admin"/>
|
|
|
|
</odoo>
|