Skip to content

Commit be915bc

Browse files
ZhaoChaoqunclaude
andcommitted
Fix model switching not reinitializing recognizers
The switchModel function compared the new model with currentModel, but currentModel reads from UserDefaults which was already updated by SettingsView. This caused the guard to always return early, skipping recognizer initialization. Now switchModel always reinitializes recognizers when called. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent e3b6363 commit be915bc

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,4 @@ promo-video/out/
4343

4444
# FunASR CoreML conversion scripts (contains large model files)
4545
funasr-coreml/
46+
.cache/

Sources/RecordingManager.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ class RecordingManager {
4040

4141
/// 切换 ASR 模型
4242
func switchModel(to model: ASRModelType) async {
43-
guard model != currentModel else { return }
44-
currentModel = model
43+
// 注意:不能用 currentModel 比较,因为 SettingsView 已经更新了 UserDefaults
44+
// 直接重新初始化识别器
4545
await initializeRecognizer()
4646
}
4747

0 commit comments

Comments
 (0)