From 0a824610cfa42353656e6567f1d9b97d891f5180 Mon Sep 17 00:00:00 2001 From: link2026 Date: Wed, 10 Jun 2026 06:53:25 +0800 Subject: [PATCH] =?UTF-8?q?docs(plan):=20=E5=8B=BE=E9=80=89=E5=B7=B2?= =?UTF-8?q?=E5=AE=8C=E6=88=90=E6=AD=A5=E9=AA=A4(=E4=BD=99=E7=9C=9F?= =?UTF-8?q?=E6=9C=BA=E6=89=8B=E6=B5=8B)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5 --- .../plans/2026-06-10-voice-diary.md | 56 +++++++++---------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/docs/superpowers/plans/2026-06-10-voice-diary.md b/docs/superpowers/plans/2026-06-10-voice-diary.md index 0315aae..2d8395f 100644 --- a/docs/superpowers/plans/2026-06-10-voice-diary.md +++ b/docs/superpowers/plans/2026-06-10-voice-diary.md @@ -22,7 +22,7 @@ **Files:** 无(纯 git) -- [ ] **Step 1: 从当前分支建 `feat/voice-diary`** +- [x] **Step 1: 从当前分支建 `feat/voice-diary`** ```bash cd /Users/xuhuayong/apps/康康 @@ -40,7 +40,7 @@ Expected: `Switched to a new branch 'feat/voice-diary'`(`Localizable.xcstrings` pbxproj 的 `INFOPLIST_KEY_*` 按字母序排列:Microphone 插在 `NSHealthUpdateUsageDescription` 之后,SpeechRecognition 插在 `NSPhotoLibraryUsageDescription` 之后。每个锚点行在文件中出现 **2 次**(Debug/Release),用 replace_all 一次改两处。 -- [ ] **Step 1: 插入 NSMicrophoneUsageDescription(replace_all)** +- [x] **Step 1: 插入 NSMicrophoneUsageDescription(replace_all)** 用 Edit 工具,`replace_all: true`: @@ -55,7 +55,7 @@ new_string: INFOPLIST_KEY_NSMicrophoneUsageDescription = "康康需要使用麦克风进行语音记录,识别全程在本机完成,声音不会上传。"; ``` -- [ ] **Step 2: 插入 NSSpeechRecognitionUsageDescription(replace_all)** +- [x] **Step 2: 插入 NSSpeechRecognitionUsageDescription(replace_all)** old_string: ``` @@ -68,7 +68,7 @@ new_string: INFOPLIST_KEY_NSSpeechRecognitionUsageDescription = "语音转文字使用 iOS 端侧识别,内容不会发送给 Apple 或任何服务器。"; ``` -- [ ] **Step 3: 验证两个键各出现 2 次** +- [x] **Step 3: 验证两个键各出现 2 次** ```bash grep -c "NSMicrophoneUsageDescription\|NSSpeechRecognitionUsageDescription" 康康.xcodeproj/project.pbxproj @@ -76,7 +76,7 @@ grep -c "NSMicrophoneUsageDescription\|NSSpeechRecognitionUsageDescription" 康 Expected: `4` -- [ ] **Step 4: Commit** +- [x] **Step 4: Commit** ```bash git add 康康.xcodeproj/project.pbxproj @@ -91,7 +91,7 @@ git commit -m "feat(语音日记): 新增麦克风与语音识别权限描述( - Test: `康康Tests/DiaryOrganizePromptTests.swift`(新建) - Modify: `康康/AI/Prompts/DiaryAssistPrompts.swift`(文件末尾 `}` 前加方法) -- [ ] **Step 1: 写失败测试** +- [x] **Step 1: 写失败测试** 新建 `康康Tests/DiaryOrganizePromptTests.swift`: @@ -126,7 +126,7 @@ struct DiaryOrganizePromptTests { } ``` -- [ ] **Step 2: 跑测试确认编译失败(方法还不存在)** +- [x] **Step 2: 跑测试确认编译失败(方法还不存在)** ```bash cd /Users/xuhuayong/apps/康康 @@ -139,7 +139,7 @@ xcodebuild test -project 康康.xcodeproj -scheme 康康 \ Expected: 编译错误 `type 'DiaryAssistPrompts' has no member 'organize'`(TEST FAILED)。 -- [ ] **Step 3: 实现 organize prompt** +- [x] **Step 3: 实现 organize prompt** 在 `康康/AI/Prompts/DiaryAssistPrompts.swift` 的 enum 末尾(`suggest` 方法后、收尾 `}` 前)加: @@ -185,11 +185,11 @@ Expected: 编译错误 `type 'DiaryAssistPrompts' has no member 'organize'`(TEST } ``` -- [ ] **Step 4: 跑测试确认通过** +- [x] **Step 4: 跑测试确认通过** 同 Step 2 命令。Expected: `** TEST SUCCEEDED **`,2 个用例通过。 -- [ ] **Step 5: Commit** +- [x] **Step 5: Commit** ```bash git add 康康Tests/DiaryOrganizePromptTests.swift 康康/AI/Prompts/DiaryAssistPrompts.swift @@ -205,7 +205,7 @@ git commit -m "feat(语音日记): organize prompt(自适应样式 + 数值不 无新单测(纯转发 AIRuntime,LLM 行为靠真机手测;解析逻辑只有 strip + trim,复用已测过的 `stripThinkBlocks`)。 -- [ ] **Step 1: 加 organize 方法** +- [x] **Step 1: 加 organize 方法** 在 `suggest` 方法的收尾 `}` 之后、struct 收尾 `}` 之前加: @@ -236,7 +236,7 @@ git commit -m "feat(语音日记): organize prompt(自适应样式 + 数值不 } ``` -- [ ] **Step 2: 编译验证** +- [x] **Step 2: 编译验证** ```bash cd /Users/xuhuayong/apps/康康 @@ -249,7 +249,7 @@ xcodebuild -project 康康.xcodeproj -scheme 康康 \ Expected: `BUILD SUCCEEDED`,无新增 warning。 -- [ ] **Step 3: Commit** +- [x] **Step 3: Commit** ```bash git add 康康/Services/DiaryAssistService.swift @@ -265,7 +265,7 @@ git commit -m "feat(语音日记): DiaryAssistService.organize 转写稿整理" 硬件绑定,无单测;模拟器路径(`isAvailable == false`)与真机路径在 Task 7 手测。 -- [ ] **Step 1: 新建 SpeechDictationService.swift** +- [x] **Step 1: 新建 SpeechDictationService.swift** ```swift import Foundation @@ -421,11 +421,11 @@ final class SpeechDictationService { } ``` -- [ ] **Step 2: 编译验证** +- [x] **Step 2: 编译验证** 同 Task 3 Step 2 命令。Expected: `BUILD SUCCEEDED`。若出现 actor 隔离 warning(标注 error in Swift 6 language mode 的不阻塞),按提示把回调内对 self 的访问收进 `Task { @MainActor in }`,不许用 `nonisolated(unsafe)` 糊。 -- [ ] **Step 3: Commit** +- [x] **Step 3: Commit** ```bash git add 康康/Services/SpeechDictationService.swift @@ -441,7 +441,7 @@ git commit -m "feat(语音日记): SpeechDictationService 端侧流式转写(不 纯展示组件,状态全部外部传入,DiaryQuickSheet(已 600+ 行)不再膨胀。 -- [ ] **Step 1: 新建 DiaryVoicePanel.swift** +- [x] **Step 1: 新建 DiaryVoicePanel.swift** ```swift import SwiftUI @@ -587,11 +587,11 @@ struct DiaryVoicePanel: View { } ``` -- [ ] **Step 2: 编译验证** +- [x] **Step 2: 编译验证** 同 Task 3 Step 2 命令。Expected: `BUILD SUCCEEDED`。 -- [ ] **Step 3: Commit** +- [x] **Step 3: Commit** ```bash git add 康康/Features/Diary/DiaryVoicePanel.swift @@ -607,7 +607,7 @@ git commit -m "feat(语音日记): DiaryVoicePanel 录音/整理面板" 改 5 处:① 状态 + 录音流程函数;② 「内容」标签行加 mic 按钮;③ 输入框下方挂面板 / 提示条 / 回退 pill;④ `canRequestSuggest` 把 organizing 排除;⑤ onDisappear 清理。 -- [ ] **Step 1: 加语音状态(`@FocusState` 行之后、`hasContent` 之前)** +- [x] **Step 1: 加语音状态(`@FocusState` 行之后、`hasContent` 之前)** 在 `DiaryQuickSheet.swift:38`(`@FocusState private var contentFocused: Bool`)之后插入: @@ -632,7 +632,7 @@ git commit -m "feat(语音日记): DiaryVoicePanel 录音/整理面板" private let dictation = SpeechDictationService() ``` -- [ ] **Step 2: 「内容」标签行加 mic 按钮** +- [x] **Step 2: 「内容」标签行加 mic 按钮** 把(`DiaryQuickSheet.swift:79-80` 附近): @@ -672,7 +672,7 @@ git commit -m "feat(语音日记): DiaryVoicePanel 录音/整理面板" (`TextField` 那段不动,仍在该 VStack 内。) -- [ ] **Step 3: 输入框下方挂面板 / 提示条 / 回退 pill** +- [x] **Step 3: 输入框下方挂面板 / 提示条 / 回退 pill** 在 TextField 的 `.overlay(...)` 闭合后、该 VStack 的收尾 `}` 之前(即原 `DiaryQuickSheet.swift:95` `)` 与 `:96` `}` 之间)插入: @@ -721,7 +721,7 @@ git commit -m "feat(语音日记): DiaryVoicePanel 录音/整理面板" } ``` -- [ ] **Step 4: organizing 期间禁用「AI 追问」+ 关 sheet 清理 + 权限 alert** +- [x] **Step 4: organizing 期间禁用「AI 追问」+ 关 sheet 清理 + 权限 alert** 把 `DiaryQuickSheet.swift:48`: @@ -762,7 +762,7 @@ git commit -m "feat(语音日记): DiaryVoicePanel 录音/整理面板" } ``` -- [ ] **Step 5: 加流程函数(`// MARK: - Actions` 区,`requestSuggestions` 之前)** +- [x] **Step 5: 加流程函数(`// MARK: - Actions` 区,`requestSuggestions` 之前)** 在 `DiaryQuickSheet.swift` 的 `sectionLabel` 函数后插入: @@ -858,7 +858,7 @@ git commit -m "feat(语音日记): DiaryVoicePanel 录音/整理面板" } ``` -- [ ] **Step 6: 编译验证(touch 强制重编拿全量警告)** +- [x] **Step 6: 编译验证(touch 强制重编拿全量警告)** ```bash cd /Users/xuhuayong/apps/康康 @@ -872,7 +872,7 @@ xcodebuild -project 康康.xcodeproj -scheme 康康 \ Expected: `BUILD SUCCEEDED`,无新增 warning。 -- [ ] **Step 7: 跑全量单测(确认没碰坏别的)** +- [x] **Step 7: 跑全量单测(确认没碰坏别的)** ```bash xcodebuild test -project 康康.xcodeproj -scheme 康康 \ @@ -882,7 +882,7 @@ xcodebuild test -project 康康.xcodeproj -scheme 康康 \ Expected: `** TEST SUCCEEDED **`。 -- [ ] **Step 8: Commit** +- [x] **Step 8: Commit** ```bash git add 康康/Features/Diary/DiaryQuickSheet.swift @@ -895,7 +895,7 @@ git commit -m "feat(语音日记): DiaryQuickSheet 接入语音输入(录音→ **Files:** 无新增代码 -- [ ] **Step 1: 模拟器降级路径验证** +- [x] **Step 1: 模拟器降级路径验证** 模拟器跑 App(或 Xcode Preview `DiaryQuickSheet`),打开「+ 新建 → 写日记」: - `SpeechDictationService.isAvailable` 在模拟器多半为 false → 「说一段」按钮应**整体不显示**,其余功能照旧。