baa-conductor

git clone 

commit
e6a758f
parent
f62d4bc
author
im_wower
date
2026-03-30 00:04:59 +0800 CST
Merge branch 'feat/gemini-delivery-adapter'
2 files changed,  +43, -7
M plugins/baa-firefox/delivery-adapters.js
+31, -0
 1@@ -60,6 +60,37 @@
 2         "button[aria-label*='stop generating' i]",
 3         "button[aria-label*='stop' i]"
 4       ]
 5+    },
 6+    gemini: {
 7+      label: "Gemini",
 8+      pageHosts: ["gemini.google.com"],
 9+      readinessSelectors: [
10+        ".conversation-container",
11+        "chat-window",
12+        "rich-text-field",
13+        ".ql-editor[contenteditable='true']",
14+        "[role='textbox']"
15+      ],
16+      composerSelectors: [
17+        "rich-text-field .ql-editor[contenteditable='true']",
18+        "rich-text-field div[contenteditable='true']",
19+        "div[contenteditable='true'][aria-label*='prompt' i]",
20+        "div[contenteditable='true'][aria-label*='message' i]",
21+        "div[contenteditable='true'][role='textbox']",
22+        "textarea[aria-label*='prompt' i]",
23+        "textarea"
24+      ],
25+      sendButtonSelectors: [
26+        "button[aria-label*='Send message' i]",
27+        "button[aria-label*='send' i]",
28+        ".send-button",
29+        ".input-area-container button:not([aria-label*='microphone' i])"
30+      ],
31+      sendingSelectors: [
32+        "button[aria-label*='Stop' i]",
33+        "button[aria-label*='Cancel' i]",
34+        "mat-icon[data-mat-icon-name='stop_circle']"
35+      ]
36     }
37   };
38 
M tasks/T-S048.md
+12, -7
 1@@ -2,7 +2,7 @@
 2 
 3 ## 状态
 4 
 5-- 当前状态:`待开始`
 6+- 当前状态:`已完成`
 7 - 规模预估:`M`
 8 - 依赖任务:无
 9 - 建议执行者:`Claude`(需要在 Gemini 页面观察 DOM 结构确认选择器)
10@@ -82,18 +82,23 @@
11 
12 ### 开始执行
13 
14-- 执行者:
15-- 开始时间:
16+- 执行者:Claude
17+- 开始时间:2026-03-29
18 - 状态变更:`待开始` → `进行中`
19 
20 ### 完成摘要
21 
22-- 完成时间:
23+- 完成时间:2026-03-29
24 - 状态变更:`进行中` → `已完成`
25-- 修改了哪些文件:
26-- 核心实现思路:
27-- 跑了哪些测试:
28+- 修改了哪些文件:`plugins/baa-firefox/delivery-adapters.js`
29+- 核心实现思路:在 `PLATFORM_ADAPTERS` 中新增 `gemini` 条目,遵循与 claude/chatgpt 相同的适配器结构。Gemini 使用 Lit/Web Components 架构,输入框为 `rich-text-field` 内嵌 Quill 编辑器(`.ql-editor[contenteditable]`)。选择器按优先级从精确到宽泛排列,涵盖 `rich-text-field .ql-editor`、aria-label、role=textbox、textarea 等多种 fallback。发送按钮通过 `aria-label*='Send message'` 定位,发送中状态通过 Stop/Cancel 按钮和 mat-icon 检测。
30+- 跑了哪些测试:无专门的 delivery-adapter 单元测试文件;确认 manifest.json 和 page-interceptor.js、controller.js 均已有 gemini 平台注册,无需额外修改。
31 
32 ### 执行过程中遇到的问题
33 
34+无
35+
36 ### 剩余风险
37+
38+- 选择器基于 Gemini 截至 2025 年初的已知 DOM 结构,Google 可能随时更新页面结构导致选择器失效,需在 Firefox 中实际验证并按需调整。
39+- `mat-icon[data-mat-icon-name='stop_circle']` 选择器依赖 Angular Material 实现细节,若 Gemini 前端框架迁移可能失效。