diff --git a/yuthon_ai_agent/security/ai_security.xml b/yuthon_ai_agent/security/ai_security.xml
index e40d83d2b..634b5a2fc 100644
--- a/yuthon_ai_agent/security/ai_security.xml
+++ b/yuthon_ai_agent/security/ai_security.xml
@@ -3,7 +3,7 @@
AI Agent 用户
-
+
使用 AI 对话功能
@@ -11,7 +11,7 @@
AI Agent 管理员
-
+
管理 AI 服务商配置
diff --git a/yuthon_ai_agent/static/src/js/ai_rule_test.js b/yuthon_ai_agent/static/src/js/ai_rule_test.js
new file mode 100644
index 000000000..04e4e890e
--- /dev/null
+++ b/yuthon_ai_agent/static/src/js/ai_rule_test.js
@@ -0,0 +1,51 @@
+/** @odoo-module **/
+
+import { jsonrpc } from "@web/core/network/rpc_service";
+import { FormController } from "@web/views/form/form_controller";
+import { patch } from "@web/core/utils/patch";
+
+/**
+ * 主动感知规则表单:测试按钮点击处理
+ *
+ * 拦截"测试主动感知"按钮的点击:
+ * 1. 调用 /ai/rule/test_guide 创建测试消息
+ * 2. 成功后派发事件通知浮动聊天框打开并刷新
+ */
+patch(FormController.prototype, "yuthon_ai_agent.ActiveGuideTest", {
+ setup() {
+ super.setup(...arguments);
+ },
+});
+
+// 注入全局函数到 window,供 onclick 调用
+window._testActiveGuide = async function (btnEl) {
+ const formEl = btnEl.closest(".o_form_view");
+ if (!formEl) return;
+ // 从 URL 或 data 属性获取 record id
+ const resId = formEl.dataset?.resId
+ || (new URLSearchParams(window.location.search)).get("id");
+ if (!resId) {
+ alert("无法获取规则 ID");
+ return;
+ }
+
+ btnEl.disabled = true;
+ btnEl.textContent = "⏳ 测试中...";
+
+ try {
+ const res = await jsonrpc("/ai/rule/test_guide", { rule_id: parseInt(resId) });
+ if (res.error) {
+ alert("错误: " + res.error);
+ } else {
+ // 通知浮动聊天框打开
+ window.dispatchEvent(new CustomEvent("yuthon:ai_open_chat", {
+ detail: { forceOpen: true },
+ }));
+ }
+ } catch (e) {
+ alert("测试失败: " + e.message);
+ } finally {
+ btnEl.disabled = false;
+ // 恢复按钮文字(Odoo 会重新渲染)
+ }
+};