feat(asr): Apple Speech 本地 ASR provider (macOS) — 完成 #574#636
Merged
Conversation
从旧 WIP 分支抢救 provider 并重新落到当前 beta 结构;只含可干净合并的基础,coordinator/dictation 接线、命令、完整编译验证待后续(见 PR 待办)。 - asr/local/apple_speech_provider.rs:SFSpeechRecognizer 批处理识别 + 授权 + objc2 桥接 + 单测 - asr/local/mod.rs:注册 + APPLE_SPEECH_PROVIDER_ID + is_apple_speech - build.rs:链接 Speech.framework(macOS);Info.plist:NSSpeechRecognitionUsageDescription - 前端:LocalAsr / ProvidersSection / Overview / shared + 5 语言 i18n
…574) 承接草稿 PR #625 的 provider 基础,补完后端接线: - coordinator: ActiveAsr::AppleSpeech 变体(macOS only) - asr_setup: build_apple_speech + ensure_asr_credentials 平台门控 + build_qa_asr_start QA 接线 + is_keyless_local_asr_provider - dictation_session/dictation_end: 听写 start + 批处理 transcribe(沿用 local_qwen 动态超时) - qa_session: QA transcribe arm - resources: cancel arm - commands: active_apple_speech_asr_is_supported(非 macOS 返回 false)+ keyless 校验白名单 + asr_configured_for_provider + set_active_asr_provider 非 macOS 拒绝门控 provider 仅 macOS 编译;非 macOS 由门控判不可用。前端 UI/i18n 已随 #625 落地。 验证:cargo check(macOS)通过、provider 单测 5/5 通过、npm run build 通过。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User description
概述
完成 macOS 上的 Apple Speech 本地 ASR provider,关闭 #574。
本 PR 在草稿 PR #625 的 provider 基础之上,补完了全部后端接线,使 "Apple 语音" 成为可在设置中选择并实际工作的 ASR provider。合并后可取代草稿 #625。
改动内容
Provider 基础(承接 #625,cherry-pick)
IS_MAC门控)后端接线(本 PR 新增,+166 / -0,8 文件)
coordinator.rs:新增ActiveAsr::AppleSpeech变体(macOS only)asr_setup.rs:build_apple_speech()构建器、ensure_asr_credentials平台门控(非 macOS 报错)、QA 路径接线、is_keyless_local_asr_providerdictation_session.rs+dictation_end.rs:听写 start + 批处理 transcribe(沿用local_qwen的动态超时与 cancel/error 收尾)qa_session.rs:QA transcribe 分支resources.rs:cancel 分支commands/providers.rs+credentials.rs:active_apple_speech_asr_is_supported(非 macOS 返回 false)、keyless 校验白名单、set_active_asr_provider非 macOS 拒绝门控所有 macOS 专属代码均以
#[cfg(target_os = "macos")]门控,与现有 qwen / foundry / sherpa provider 完全同形;三平台match保持穷尽。测试情况
cargo check(macOS aarch64):通过,无新增警告npm run build(tsc + vite):通过cargo fmt+cargo clippy收尾备注
Closes #574
PR Type
Enhancement, Documentation
Description
Add Apple Speech local ASR provider using SFSpeechRecognizer (macOS)
Wire provider into coordinator, dictation, and QA sessions
Frontend UI card for activation with i18n support
Platform-gate with macOS-only compilation and error messages
Diagram Walkthrough
File Walkthrough
2 files
Link Speech.framework for macOSAdd NSSpeechRecognitionUsageDescription14 files
New Apple Speech ASR provider with objc2 bridgeRegister Apple Speech provider and constantsPlatform gate for Apple Speech providerAdd active_apple_speech_asr_is_supportedAdd AppleSpeech variant to ActiveAsr enumBuild Apple Speech provider and ensure credentialsHandle Apple Speech in dictation end sessionHandle Apple Speech in dictation begin sessionHandle Apple Speech in QA sessionCancel Apple Speech ASRAdd Apple Speech activation UI cardMap apple-speech ID to display nameAdd apple-speech preset and hide from dropdownExtend AsrPresetId type with apple-speech5 files
Add English i18n strings for Apple SpeechAdd Japanese i18n strings for Apple SpeechAdd Korean i18n strings for Apple SpeechAdd Simplified Chinese i18n strings for Apple SpeechAdd Traditional Chinese i18n strings for Apple Speech