feat: enable AI design voice input
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
# Task: Fix AI design dialog Enter and voice input
|
||||
|
||||
## Identity
|
||||
|
||||
- Task ID: 20260818-ai-design-input-9f3a
|
||||
- Mode: Feature
|
||||
- Branch: codex/20260818-ai-design-input-9f3a-ai-design-input
|
||||
- Worktree: D:\Datas\OthersProjects\makelore-ai-design-input-9f3a
|
||||
- Base commit: 13bdc0c9bab656aa9ff6c990bf6359f7d3210750
|
||||
- Owner: developer
|
||||
- Status: Completed
|
||||
|
||||
## Scope
|
||||
|
||||
- 保留并验收 AI 设计对话框现有的 Enter 发送、Shift+Enter 换行和输入法组合保护。
|
||||
- 打开 AI 设计对话框的语音输入:采集麦克风、转为 16 kHz 单声道 WAV,经既有 Works Speech Host API 转写并回填当前草稿。
|
||||
- 为账号、Workspace、Conversation 切换和组件卸载增加录音/异步转写生命周期清理与迟到结果保护;录音中始终保留停止按钮。
|
||||
- 增加组件回归测试和 AI Design Electron E2E 的 Enter 发送覆盖。
|
||||
|
||||
## Intent And Constraints
|
||||
|
||||
- 复用现有 `transcribeWorksSpeech` 与 Renderer → Host API → Main → Works 调用边界,不新增直连 IPC 或本地运行时 HTTP。
|
||||
- 不改变消息、Quote 确认、任务创建和多会话数据链路;Enter 仍由现有 `handleSend` 提交,Shift+Enter 和 IME 行为保持不变。
|
||||
- 录音期间即使发送或附件操作进入 busy,也必须可以停止录音并释放 MediaStream;账号、Workspace、Conversation 变化后不得使用旧录音结果回填新上下文。
|
||||
- 真实麦克风和 Works 账号的 Electron smoke 未纳入本次自动化验证。
|
||||
|
||||
## Plan
|
||||
|
||||
1. 核对 AI 设计 composer 的键盘处理、语音入口和 Works Speech 复用边界。
|
||||
2. 实现语音采集、WAV 转码、认证重试及上下文生命周期守卫,并补齐回归测试。
|
||||
3. 更新 Enter 交互 E2E 覆盖,运行聚焦/全量测试、类型检查、Lint、构建和文档漂移检查。
|
||||
|
||||
## Outcome
|
||||
|
||||
- AI 设计 composer 的 Enter 提交行为已由单测和 Electron E2E 覆盖;Shift+Enter 换行及 IME 组合期间不误发保持不变。
|
||||
- 语音输入按钮已接入 MediaRecorder;录音停止后生成 16 kHz、单声道、16-bit PCM WAV,调用 Works Speech 并将识别文本追加到当前草稿。
|
||||
- 语音流程支持未登录/环境不支持提示、401 强制刷新后单次重试,并在账号、Workspace、Conversation 变化或卸载时停止 recorder、释放 tracks、丢弃迟到结果。
|
||||
- 录音状态下停止按钮不受发送、参考图上传或素材操作 busy 状态禁用。
|
||||
|
||||
## Verification
|
||||
|
||||
- `node node_modules/vitest/vitest.mjs run tests/unit/image-canvas-page.test.tsx`:44 passed。
|
||||
- `node node_modules/vitest/vitest.mjs run`:176 files / 2114 tests passed。
|
||||
- `node node_modules/typescript/bin/tsc --noEmit`:通过。
|
||||
- `node node_modules/eslint/bin/eslint.js src/pages/ImageCanvas/index.tsx tests/unit/image-canvas-page.test.tsx tests/e2e/image-workspace-conversations.spec.ts`:通过。
|
||||
- `node --max-old-space-size=6144 node_modules/vite/bin/vite.js build`:Renderer、Electron Main、Preload 均构建通过;仅有既有动态导入和 chunk 体积警告。
|
||||
- `git diff --check`:通过。
|
||||
- `check_doc_drift.py --task-id 20260818-ai-design-input-9f3a`:通过。
|
||||
|
||||
## Follow-ups
|
||||
|
||||
- 需要真实麦克风权限和 Works 账号的 Electron smoke,确认不同浏览器/系统的 MediaRecorder 编码兼容性。
|
||||
- 音频转码 helper 目前与 AI 编程 composer 各自维护,后续可在独立任务中评估抽到共享 `src/lib` 工具。
|
||||
|
||||
## Promotion Candidates
|
||||
|
||||
- None。此次改动复用既有 Host API 和产品交互契约,不需要修改 canonical 架构或决策文档。
|
||||
Reference in New Issue
Block a user