kuaifan da095a1a80 feat(ai-assistant): 页面操作搬到主程序 /ws + doo task notify + 删 OCR
页面操作传输层从 MCP 独立 WebSocket 迁到主程序常驻 /ws:
- 后端 AssistantController 加 operation__dispatch/result(fd 归属校验 +
  PushTask 精推 + Cache 轮询取结果),WebSocketService onMessage 加
  operationResult 回包分支
- 前端 actions.js 加 case "operation" 经 emitter 桥接到浮窗执行后回包;
  float-button.vue 接 aiOperationRequest;operation-module.js 解耦、
  executor 惰性化;删除 operation-client.js(不再单连 MCP WS)

ai-kb 同步:tool-binding.yaml 去掉 4 个工具(3 页面 + OCR),相关 chunk
reconcile(措辞去 MCP 化、OCR 改多模态识图),工具数 33→29

i18n:后端新增文案登记 original-api.txt

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-12 01:31:21 +00:00

57 lines
2.0 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
id: ai-assistant.match-elements.concept
title: AI 怎么找到页面元素
type: concept
feature: ai-assistant
scope: end-user
locale: zh
aliases:
- match_elements
- AI 找按钮
- 元素匹配
- 向量匹配元素
- AI 怎么知道点哪
- AI 元素识别
related_tools: []
related_pages: []
prerequisites:
- 应用市场已安装 ai 插件
negative:
- 匹配纯依赖元素可见文本/aria-label/title无文本的图标按钮命中率低
- 单次匹配上限 50 个候选元素
- 不持久化匹配结果,每轮交互需重新取上下文
last_verified: v1.7.90
---
# AI 怎么找到页面元素
## 定义
当 AI 想操作页面元素(点按钮、填表)时,先采集当前页面上下文拿到候选元素列表(每条含 ref / name / role再通过后端 API `POST api/assistant/match-elements` 把"用户意图描述"和"候选列表"提交给 embedding 服务,返回按余弦相似度排序的命中元素。
## 工作流
1. **采集**:前端按 ARIA 角色扫描,给每个可交互元素分配 refe1, e2...)和 name
2. **关键词过滤**:先用 query 做子串匹配
3. **向量匹配**:关键词没命中时对 query 和元素 name 求 embedding取相似度 top-K默认 10最多 50
4. **执行**:模型拿匹配元素的 ref让 AI 助手在你的页面上操作该元素
## 元素信息字段
- `ref`本轮唯一标识e1, e2...
- `name`:可见文本 / aria-label / title
- `role`ARIA 角色button / textbox / link 等)
- `selector` + `nth`:兜底选择器
## 命中率
- 有清晰文本的按钮:高
- 仅 icon 无 aria-label建议加 title
- 隐藏元素:默认不采集
## 不支持
- 元素匹配仅基于元素文本,不靠图像识别
- 不支持「按位置」找元素("左上角第三个"
- 不能跨 iframe 匹配
## 相关
- 取页面上下文:[[ai-assistant.page-context-tool.concept]]
- 操作元素:[[ai-assistant.element-action.howto]]
- 页面操作机制:[[ai-assistant.page-action.concept]]