Handles accidental selections

This commit is contained in:
Beingpax 2025-06-30 20:26:36 +05:45
parent d9165e1e4d
commit d6d6db2354

View File

@ -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 {