From 04872e2308acb4aa2ba3f0c47dd4fa42a217a044 Mon Sep 17 00:00:00 2001 From: Beingpax Date: Sat, 22 Mar 2025 14:58:02 +0545 Subject: [PATCH] Add model selection validation --- VoiceInk/Whisper/WhisperState.swift | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/VoiceInk/Whisper/WhisperState.swift b/VoiceInk/Whisper/WhisperState.swift index 725835a..e24d843 100644 --- a/VoiceInk/Whisper/WhisperState.swift +++ b/VoiceInk/Whisper/WhisperState.swift @@ -127,6 +127,20 @@ class WhisperState: NSObject, ObservableObject, AVAudioRecorderDelegate { logger.error("❌ No recorded file found after stopping recording") } } else { + // Validate that a model is selected before allowing recording to start + guard currentModel != nil else { + // Show an alert to the user + await MainActor.run { + let alert = NSAlert() + alert.messageText = "No Whisper Model Selected" + alert.informativeText = "Please select a default whisper model in AI Models tab before recording." + alert.alertStyle = .warning + alert.addButton(withTitle: "OK") + alert.runModal() + } + return + } + logger.notice("🎙️ Starting recording") requestRecordPermission { [self] granted in if granted {