Skip to content

接入 LabscriptAI MCP,并完善实验助手的拍照与小智语音 - #42

Merged
zhangyuian merged 5 commits into
mainfrom
codex/labscriptai-experiment-mcp
Dec 3, 2026
Merged

zhangyuian merged 5 commits into
mainfrom
codex/labscriptai-experiment-mcp

Conversation

@zhangyuian

Copy link
Copy Markdown
Collaborator

问题

实验助手此前依赖内嵌的 LabscriptAI 源码和虚拟环境,协议模拟、台面拍照、识别和真机运行没有通过公开 MCP 接口提供;台面照片只显示原图,看不到本地 YOLO 的识别框。

小智语音在实际使用中还有三个问题:长任务在结果出来前就结束了本轮,操作员听不到结果;追问和结果会在下一次交办时被重复播报;网页不会跟随小智新开的对话。

修改

  • 实验助手改为通过公开的 LabscriptAI MCP 产物接口(v1)提供全部工具,新增 internal/experiment/labscriptai-tools.mjs。协议模拟、动画、配置图、台面拍照、识别、设备状态和运行都由锁定版本的外部插件负责;涉及设备的操作仍需要工作台确认,运行记录写回实验库。启动器按 labscriptai-ot.lock.json 安装并校验插件,替代内嵌源码与 .venv;已有数据库打开时升级到 schema 3。升级说明见 docs/upgrade-guide/v0.2.2-alpha.2/external-labscriptai。
  • 拍照和识别结果新增 photoMarkdown / annotatedMarkdown,通过认证的文件路由在工作台内显示;提示词要求先贴带识别框的标注图,再贴原图。
  • 小智语音:交办回执改为“实验正在准备”,运行中保持观察最多约 2 分钟(15 秒、60 秒各提示一次),2 分钟后结束本轮进入待机;待机后只有用户主动问进度或结果时才查询并播报,不再把上一轮结果补播到下一次交办;追问先播一句进度概括(voice_progress)再说缺失条件(voice_question);查状态可以省略任务编号。
  • 网页端发现小智的会话变化就自动切到新对话,不再只依赖跳转信号。
  • 审批服务允许主机为独立的设备操作指定 policy: 'ask',不改变会话级策略(packages/interaction/user-approval)。

限制:语音实际播报仍由托管模型决定,需在实体设备上验证;MCP 接口不提供空闲设备主动推送,2 分钟后才完成的结果只在用户主动询问时播报。

验证

  • node --import tsx/esm --test internal/xiaozhi/*.test.mjs internal/experiment/tests/agent-tools.test.mjs:61 个测试通过。
  • pnpm exec vitest run packages/client/ui-sidebar-experiment:45 个测试通过。
  • pnpm --filter @deepseek-ai/dsh-client-ui-sidebar-experiment bundle:客户端打包成功。
  • pnpm run verify-translation-pairing:中英文配对检查通过。
  • 手工验证(开发期间):真实 Flex 台面拍照与本地 YOLO 识别、真机运行与审批、长任务超时后的待机与按需查询、网页跟随小智新开的对话。
  • 未在本地运行仓库全量 CI 矩阵,交由 PR CI 覆盖;Windows 安装与两种机型的本地仿真由 CI 的安装任务验证。

zhangyuian and others added 5 commits November 26, 2026 16:01
The voice bridge now speaks only the conclusion (first sentence, at most 40 characters), greets with 收到。 and a single 还在做。, and ends the turn after a wait or question so the device can listen again. request_experiment_input accepts a voice_question that names only the missing facts, and a new request no longer replays the previous finished answer; an explicit progress query still reports it. Restore the voice diagnostics log for device-side verification.
capture_image and deck_vision_check results now carry a photoMarkdown or annotatedMarkdown line built from the absolute host path. The experiment prompt tells the assistant to place that line in its reply, so the chat renders the photo through the authenticated file route instead of leaving the operator with a bare local path.
Third-party racks such as the PE tip boxes are custom_beta definitions the local engine cannot resolve by name. The prompt now tells the assistant to fetch the exact load name, request its full definition with labware_lookup inspect include_definition, and load it with protocol.load_labware_from_definition.
Voice turns now open with 实验正在准备 and keep observing for up to two minutes with short progress lines; after that the device returns to standby and a late result is reported only when the operator asks. Missed results are no longer replayed on the next delegation, clarifications lead with the workbench voice_progress summary, and status queries can omit the job id. The browser also follows a changed voice session even without a new focus event, and replies show the annotated deck photo before the plain capture.
@zhangyuian zhangyuian self-assigned this Dec 3, 2026
@zhangyuian
zhangyuian merged commit 2d552c9 into main Dec 3, 2026
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant