ai模块测试

This commit is contained in:
李鹏宇
2026-05-28 10:15:40 +08:00
parent 17f72913cc
commit b87f6a934f
26 changed files with 27 additions and 16 deletions
@@ -15,7 +15,7 @@
'author': 'pengyuthon',
'version': '17.0.2.2.0',
'license': 'LGPL-3',
'depends': ['base', 'web', 'hr'],
'depends': ['base', 'web', 'hr', 'sh_backmate_theme_adv_enterprise'],
'data': [
'security/ai_security.xml',
'security/ir.model.access.csv',
@@ -32,7 +32,7 @@
'yuthon_ai_agent_17/static/src/js/ai_chat_action.js',
'yuthon_ai_agent_17/static/src/js/ai_floating.js',
'yuthon_ai_agent_17/static/src/xml/ai_chat_template.xml',
'yuthon_ai_agent_17/static/src/xml/ai_floating_template.xml',
'yuthon_ai_agent_17/static/src/xml/ai_navbar_button.xml',
'yuthon_ai_agent_17/static/src/css/ai_chat.css',
'yuthon_ai_agent_17/static/src/css/ai_floating.css',
],
@@ -1,8 +1,8 @@
/** @odoo-module **/
import { Component } from "@odoo/owl";
import { registry } from "@web/core/registry";
import { jsonrpc } from "@web/core/network/rpc_service";
import { NavBar } from "@web/webclient/navbar/navbar";
import { patch } from "@web/core/utils/patch";
/**
* AI 浮动聊天窗口 — 右下角弹出式聊天面板
@@ -277,16 +277,9 @@ function toggleChat() {
}
}
// ====== Systray 组件 ======
export class AiSystrayItem extends Component {
static template = "yuthon_ai_agent_17.AiSystray";
static props = ["*"];
toggleChat() {
// ====== 通过 patch NavBar 挂载 AI 按钮点击事件 ======
patch(NavBar.prototype, {
_click_ai_toggle(ev) {
toggleChat();
}
}
registry.category("systray").add("yuthon_ai_agent_17.systray", {
Component: AiSystrayItem,
}, { sequence: 25 });
},
});
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<!-- 在侧边栏 logo 区域添加 AI 按钮(全屏/折叠按钮旁) -->
<t t-name="sh.NavBar.AppsMenu" t-inherit="sh.NavBar.AppsMenu" t-inherit-mode="extension" owl="1">
<xpath expr="//span[@id='show_top_bar']" position="after">
<span
id="ai_chat_toggle"
class="o_ai_navbar_btn"
title="AI 助手"
t-on-click="_click_ai_toggle"
style="margin-left: 25px;margin-top: 0px; font-size: 20px; cursor: pointer;">
<i class="fa fa-bolt" aria-hidden="true" style="color: #a855f7;"/>
</span>
</xpath>
</t>
</templates>