diff --git a/VoiceInk/Services/AIEnhancementService.swift b/VoiceInk/Services/AIEnhancementService.swift index 82051b8..07b9243 100644 --- a/VoiceInk/Services/AIEnhancementService.swift +++ b/VoiceInk/Services/AIEnhancementService.swift @@ -134,7 +134,7 @@ class AIEnhancementService: ObservableObject { private func getSystemMessage(for mode: EnhancementPrompt) -> String { let clipboardSnapshot = NSPasteboard.general.string(forType: .string) let selectedText = SelectedTextService.fetchSelectedText() - + if let activePrompt = activePrompt, activePrompt.id == PredefinedPrompts.assistantPromptId, let selectedText = selectedText, !selectedText.isEmpty { diff --git a/VoiceInk/Services/SelectedTextService.swift b/VoiceInk/Services/SelectedTextService.swift index c58dc31..19fd0e6 100644 --- a/VoiceInk/Services/SelectedTextService.swift +++ b/VoiceInk/Services/SelectedTextService.swift @@ -1,7 +1,9 @@ import Foundation import AppKit class SelectedTextService { - + // Private pasteboard type to avoid clipboard history pollution + private static let privatePasteboardType = NSPasteboard.PasteboardType("com.prakashjoshipax.VoiceInk.transient") + static func fetchSelectedText() -> String? { // Don't check for selected text within VoiceInk itself guard let frontmostApp = NSWorkspace.shared.frontmostApplication,