diff --git a/VoiceInk/Services/PromptDetectionService.swift b/VoiceInk/Services/PromptDetectionService.swift index a2fcbe9..74944f7 100644 --- a/VoiceInk/Services/PromptDetectionService.swift +++ b/VoiceInk/Services/PromptDetectionService.swift @@ -21,14 +21,17 @@ class PromptDetectionService { let originalPromptId = enhancementService.selectedPromptId if let selectedText = SelectedTextService.fetchSelectedText(), !selectedText.isEmpty { - return PromptDetectionResult( - shouldEnableAI: true, - selectedPromptId: PredefinedPrompts.assistantPromptId, - processedText: text, // The user's speech is the prompt for the selected text - detectedTriggerWord: nil, - originalEnhancementState: originalEnhancementState, - originalPromptId: originalPromptId - ) + let wordCount = selectedText.split { $0.isWhitespace || $0.isNewline }.count + if wordCount >= 2 { + return PromptDetectionResult( + shouldEnableAI: true, + selectedPromptId: PredefinedPrompts.assistantPromptId, + processedText: text, // The user's speech is the prompt for the selected text + detectedTriggerWord: nil, + originalEnhancementState: originalEnhancementState, + originalPromptId: originalPromptId + ) + } } for prompt in enhancementService.allPrompts {