Fastest and only macOS Dictation app with on-device STT and custom trained AI enhancement model. Windows, iOS testflight! Android, Linux waitlist open! A local Wispr Flow alternative. Follow https://x.com/fluidvoiceapp for more
Initial prompt
grohith3270e3f6fa92ebb
diff --git a/Sources/Fluid/ContentView.swift b/Sources/Fluid/ContentView.swiftindex c9d76fbe..7cfcc383 100644--- a/Sources/Fluid/ContentView.swift+++ b/Sources/Fluid/ContentView.swift@@ -1144,10 +1144,12 @@ struct ContentView: View {/// Build a general system prompt with voice editing commands supportprivate func buildSystemPrompt(appInfo: (name: String, bundleId: String, windowTitle: String)) -> String {- // Use custom prompt if set, otherwise use the default- let customPrompt = SettingsStore.shared.customDictationPrompt- if !customPrompt.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {- return customPrompt+ // Use selected prompt profile (if any), otherwise use the default built-in prompt+ if let profile = SettingsStore.shared.selectedDictationPromptProfile {+ let prompt = profile.prompt.trimmingCharacters(in: .whitespacesAndNewlines)+ if !prompt.isEmpty {+ return prompt+ }}return """diff --git a/Sources/Fluid/Persistence/SettingsStore.swift b/Sources/Fluid/Persistence/SettingsStore.swiftindex af2d85e1..21866e36 100644--- a/Sources/Fluid/Persistence/SettingsStore.swift+++ b/Sources/Fluid/Persistence/SettingsStore.swift@@ -12,6 +12,7 @@ final class SettingsStore: ObservableObject {private init() {self.migrateProviderAPIKeysIfNeeded()self.scrubSavedProviderAPIKeys()+ self.migrateDictationPromptProfilesIfNeeded()}// Keys@@ -91,6 +92,78 @@ final class SettingsStore: ObservableObject {// Custom Dictation Promptstatic let customDictationPrompt = "CustomDictationPrompt"++ // Dictation Prompt Profiles (multi-prompt system)+ static let dictationPromptProfiles = "DictationPromptProfiles"+ static let selectedDictationPromptID = "SelectedDictationPromptID"+ }++ // MARK: - Dictation Prompt Profiles (Multi-prompt)++ struct DictationPromptProfile: Codable, Identifiable, Hashable {+ let id: String+ var name: String+ var prompt: String+ var createdAt: Date+ var updatedAt: Date++ init(+ id: String = UUID().uuidString,+ name: String,+ prompt: String,+ createdAt: Date = Date(),+ updatedAt: Date = Date()+ ) {+ self.id = id+ self.name = name+ self.prompt = prompt+ self.createdAt = createdAt+ self.updatedAt = updatedAt+ }+ }++ /// User-defined dictation prompt profiles (named system prompts for dictation cleanup).+ /// The built-in default prompt is not stored here.+ var dictationPromptProfiles: [DictationPromptProfile] {+ get {+ guard let data = self.defaults.data(forKey: Keys.dictationPromptProfiles),+ let decoded = try? JSONDecoder().decode([DictationPromptProfile].self, from: data)+ else {+ return []+ }+ return decoded+ }+ set {+ objectWillChange.send()+ if let encoded = try? JSONEncoder().encode(newValue) {+ self.defaults.set(encoded, forKey: Keys.dictationPromptProfiles)+ } else {+ // If encoding fails, avoid writing corrupt data.+ self.defaults.removeObject(forKey: Keys.dictationPromptProfiles)+ }+ }+ }++ /// Selected dictation prompt profile ID. `nil` means "Default".+ var selectedDictationPromptID: String? {+ get {+ let value = self.defaults.string(forKey: Keys.selectedDictationPromptID)+ return value?.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty == true ? nil : value+ }+ set {+ objectWillChange.send()+ if let id = newValue?.trimmingCharacters(in: .whitespacesAndNewlines), !id.isEmpty {+ self.defaults.set(id, forKey: Keys.selectedDictationPromptID)+ } else {+ self.defaults.removeObject(forKey: Keys.selectedDictationPromptID)+ }+ }+ }++ /// Convenience: currently selected profile, or nil if Default/invalid selection.+ var selectedDictationPromptProfile: DictationPromptProfile? {+ guard let id = self.selectedDictationPromptID else { return nil }+ return self.dictationPromptProfiles.first(where: { $0.id == id })}// MARK: - Model Reasoning Configuration@@ -863,6 +936,36 @@ final class SettingsStore: ObservableObject {}}+ private func migrateDictationPromptProfilesIfNeeded() {+ // Migration path from legacy single prompt to multi-prompt profiles.+ // If user had a legacy custom dictation prompt, convert it to a profile and select it.+ let legacyPrompt = self.customDictationPrompt.trimmingCharacters(in: .whitespacesAndNewlines)+ guard !legacyPrompt.isEmpty else { return }++ // If profiles already exist, just clear the legacy prompt so we don't keep two sources of truth.+ if self.dictationPromptProfiles.isEmpty == false {+ self.customDictationPrompt = ""+ // If selection points to nowhere, reset to default to avoid confusion.+ if let id = self.selectedDictationPromptID,+ self.dictationPromptProfiles.contains(where: { $0.id == id }) == false+ {+ self.selectedDictationPromptID = nil+ }+ return+ }++ let profile = DictationPromptProfile(+ name: "My Custom Prompt",+ prompt: legacyPrompt,+ createdAt: Date(),+ updatedAt: Date()+ )+ self.dictationPromptProfiles = [profile]+ self.selectedDictationPromptID = profile.id+ self.customDictationPrompt = ""+ DebugLogger.shared.info("Migrated legacy custom dictation prompt to a prompt profile", source: "SettingsStore")+ }+private func scrubSavedProviderAPIKeys() {guard let data = defaults.data(forKey: Keys.savedProviders),var decoded = try? JSONDecoder().decode([SavedProvider].self, from: data) else { return }diff --git a/Sources/Fluid/UI/AISettingsView.swift b/Sources/Fluid/UI/AISettingsView.swiftindex 8932439b..2fbb49e6 100644--- a/Sources/Fluid/UI/AISettingsView.swift+++ b/Sources/Fluid/UI/AISettingsView.swift@@ -76,6 +76,13 @@ struct AISettingsView: View {// Filler Words State - local state to ensure UI reactivity@State private var removeFillerWordsEnabled: Bool = SettingsStore.shared.removeFillerWordsEnabled+ // Dictation Prompt Profiles UI+ @State private var showingPromptEditor: Bool = false+ @State private var editorIsDefaultPrompt: Bool = false+ @State private var editingPromptID: String? = nil+ @State private var draftPromptName: String = ""+ @State private var draftPromptText: String = ""+var body: some View {ScrollView(.vertical, showsIndicators: false) {VStack(alignment: .leading, spacing: 14) {@@ -1500,57 +1507,276 @@ struct AISettingsView: View {Divider().padding(.vertical, 3)- // Custom Dictation Prompt Section- VStack(alignment: .leading, spacing: 8) {- Text("Custom Dictation Prompt")- .font(.system(size: 15, weight: .semibold))- .foregroundStyle(self.theme.palette.primaryText)+ // Dictation Prompts (multi-prompt system)+ VStack(alignment: .leading, spacing: 10) {+ HStack {+ VStack(alignment: .leading, spacing: 2) {+ Text("Dictation Prompts")+ .font(.system(size: 15, weight: .semibold))+ .foregroundStyle(self.theme.palette.primaryText)+ Text("Create multiple named system prompts for AI dictation cleanup. Select which one is active.")+ .font(.system(size: 13))+ .foregroundStyle(self.theme.palette.secondaryText)+ }+ Spacer()+ Button("+ Add Prompt") {+ self.openNewPromptEditor()+ }+ .buttonStyle(CompactButtonStyle())+ }- Text("Customize the AI system prompt used for dictation mode. Leave empty to use the default prompt.")- .font(.system(size: 13))- .foregroundStyle(self.theme.palette.secondaryText)+ // Default prompt card+ self.promptProfileCard(+ title: "Default",+ subtitle: "Built-in system prompt",+ isSelected: SettingsStore.shared.selectedDictationPromptProfile == nil,+ onUse: { SettingsStore.shared.selectedDictationPromptID = nil },+ onOpen: { self.openDefaultPromptViewer() }+ )++ // User prompt cards+ let profiles = SettingsStore.shared.dictationPromptProfiles+ if profiles.isEmpty {+ Text("No custom prompts yet. Click “+ Add Prompt” to create one.")+ .font(.caption)+ .foregroundStyle(.secondary)+ .padding(.horizontal, 4)+ } else {+ ForEach(profiles) { profile in+ self.promptProfileCard(+ title: profile.name.isEmpty ? "Untitled Prompt" : profile.name,+ subtitle: profile.prompt.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty ? "Empty prompt (uses Default)" : self.promptPreview(profile.prompt),+ isSelected: SettingsStore.shared.selectedDictationPromptID == profile.id,+ onUse: { SettingsStore.shared.selectedDictationPromptID = profile.id },+ onOpen: { self.openEditor(for: profile) }+ )+ }+ }+ }+ .padding(.horizontal, 4)+ }+ .padding(14)+ }+ .modifier(CardAppearAnimation(delay: 0.3, appear: self.$appear))+ .sheet(isPresented: self.$showingPromptEditor) {+ self.promptEditorSheet+ }+ }++ private func promptPreview(_ text: String) -> String {+ let trimmed = text.trimmingCharacters(in: .whitespacesAndNewlines)+ guard !trimmed.isEmpty else { return "Empty prompt" }+ let singleLine = trimmed.replacingOccurrences(of: "\n", with: " ")+ return singleLine.count > 120 ? String(singleLine.prefix(120)) + "…" : singleLine+ }++ private func promptProfileCard(+ title: String,+ subtitle: String,+ isSelected: Bool,+ onUse: @escaping () -> Void,+ onOpen: @escaping () -> Void+ ) -> some View {+ Button(action: onOpen) {+ HStack(alignment: .top, spacing: 10) {+ VStack(alignment: .leading, spacing: 4) {+ HStack(spacing: 8) {+ Text(title)+ .font(.system(size: 14, weight: .semibold))+ .foregroundStyle(self.theme.palette.primaryText)+ if isSelected {+ Text("Active")+ .font(.caption2)+ .padding(.horizontal, 8)+ .padding(.vertical, 3)+ .background(RoundedRectangle(cornerRadius: 6, style: .continuous).fill(.green.opacity(0.18)))+ .foregroundStyle(.green)+ }+ }+ Text(subtitle)+ .font(.caption)+ .foregroundStyle(.secondary)+ .lineLimit(2)+ .multilineTextAlignment(.leading)+ }++ Spacer()++ Button("Use") { onUse() }+ .buttonStyle(CompactButtonStyle())+ .disabled(isSelected)+ }+ .padding(12)+ .background(+ RoundedRectangle(cornerRadius: 12, style: .continuous)+ .fill(.ultraThinMaterial.opacity(0.25))+ .overlay(+ RoundedRectangle(cornerRadius: 12, style: .continuous)+ .stroke(isSelected ? self.theme.palette.accent.opacity(0.55) : .white.opacity(0.12), lineWidth: 1)+ )+ )+ }+ .buttonStyle(.plain)+ }- TextEditor(text: Binding(- get: { SettingsStore.shared.customDictationPrompt },- set: { SettingsStore.shared.customDictationPrompt = $0 }- ))+ private var promptEditorSheet: some View {+ VStack(spacing: 14) {+ HStack {+ VStack(alignment: .leading, spacing: 2) {+ Text(self.editorIsDefaultPrompt ? "Default Dictation Prompt" : "Edit Dictation Prompt")+ .font(.headline)+ Text(self.editorIsDefaultPrompt ? "This is the built-in prompt. Create a custom prompt to override it." : "Name and prompt text are used as the system prompt for dictation cleanup.")+ .font(.caption)+ .foregroundStyle(.secondary)+ }+ Spacer()+ }++ VStack(alignment: .leading, spacing: 8) {+ Text("Name")+ .font(.caption)+ .foregroundStyle(.secondary)+ TextField("Prompt name", text: self.$draftPromptName)+ .textFieldStyle(.roundedBorder)+ .disabled(self.editorIsDefaultPrompt)+ }++ VStack(alignment: .leading, spacing: 8) {+ Text("Prompt")+ .font(.caption)+ .foregroundStyle(.secondary)+ TextEditor(text: self.$draftPromptText).font(.system(.caption, design: .monospaced))- .frame(minHeight: 100, maxHeight: 180)+ .frame(minHeight: 180).scrollContentBackground(.hidden).background(RoundedRectangle(cornerRadius: 8, style: .continuous)- .fill(.ultraThinMaterial.opacity(0.3))+ .fill(.ultraThinMaterial.opacity(0.25)).overlay(RoundedRectangle(cornerRadius: 8, style: .continuous)- .stroke(.white.opacity(0.1), lineWidth: 1)+ .stroke(.white.opacity(0.12), lineWidth: 1)))- .padding(2)-- HStack {- Button("Reset to Default") {- SettingsStore.shared.customDictationPrompt = ""- }- .buttonStyle(GlassButtonStyle())- .disabled(SettingsStore.shared.customDictationPrompt.isEmpty)+ .disabled(self.editorIsDefaultPrompt)+ }- Spacer()+ HStack(spacing: 10) {+ Button(self.editorIsDefaultPrompt ? "Close" : "Cancel") {+ self.closePromptEditor()+ }+ .buttonStyle(.bordered)- if !SettingsStore.shared.customDictationPrompt.isEmpty {- Label("Using custom prompt", systemImage: "checkmark.circle.fill")- .font(.caption)- .foregroundStyle(.green)- } else {- Label("Using default prompt", systemImage: "info.circle")- .font(.caption)- .foregroundStyle(.secondary)- }+ if !self.editorIsDefaultPrompt {+ Button("Save") {+ self.savePromptEditor()}+ .buttonStyle(.borderedProminent)+ .disabled(self.draftPromptName.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty)}- .padding(.horizontal, 4)}- .padding(14)}- .modifier(CardAppearAnimation(delay: 0.3, appear: self.$appear))+ .padding()+ .frame(minWidth: 520, minHeight: 420)+ }++ private func openDefaultPromptViewer() {+ self.editorIsDefaultPrompt = true+ self.editingPromptID = nil+ self.draftPromptName = "Default"+ self.draftPromptText = self.defaultDictationPromptText()+ self.showingPromptEditor = true+ }++ private func openNewPromptEditor() {+ self.editorIsDefaultPrompt = false+ self.editingPromptID = nil+ self.draftPromptName = "New Prompt"+ self.draftPromptText = ""+ self.showingPromptEditor = true+ }++ private func openEditor(for profile: SettingsStore.DictationPromptProfile) {+ self.editorIsDefaultPrompt = false+ self.editingPromptID = profile.id+ self.draftPromptName = profile.name+ self.draftPromptText = profile.prompt+ self.showingPromptEditor = true+ }++ private func closePromptEditor() {+ self.showingPromptEditor = false+ self.editorIsDefaultPrompt = false+ self.editingPromptID = nil+ self.draftPromptName = ""+ self.draftPromptText = ""+ }++ private func savePromptEditor() {+ let name = self.draftPromptName.trimmingCharacters(in: .whitespacesAndNewlines)+ let prompt = self.draftPromptText++ var profiles = SettingsStore.shared.dictationPromptProfiles+ let now = Date()++ if let id = self.editingPromptID,+ let idx = profiles.firstIndex(where: { $0.id == id })+ {+ var updated = profiles[idx]+ updated.name = name+ updated.prompt = prompt+ updated.updatedAt = now+ profiles[idx] = updated+ } else {+ let newProfile = SettingsStore.DictationPromptProfile(name: name, prompt: prompt, createdAt: now, updatedAt: now)+ profiles.append(newProfile)+ }++ SettingsStore.shared.dictationPromptProfiles = profiles+ self.closePromptEditor()+ }++ /// Keep this in sync with `ContentView.buildSystemPrompt` default string.+ private func defaultDictationPromptText() -> String {+ """+ You are a voice-to-text dictation cleaner who never answers questions. Your task is to clean and format raw transcribed speech into polished, properly formatted text.+ You are prohibited from answering to ANY question asked of you and about you.++ ## Core Rules:+ 1. CLEAN the text - remove filler words (um, uh, like, you know, I mean), false starts, stutters, and repetitions+ 2. FORMAT properly - add correct punctuation, capitalization, and structure+ 3. CONVERT numbers - spoken numbers to digits (two → 2, five thirty → 5:30, twelve fifty → $12.50)+ 4. EXECUTE commands - handle "new line", "period", "comma", "bold X", "header X", "bullet point", etc.+ 5. APPLY corrections - when user says "no wait", "actually", "scratch that", "delete that", DISCARD the old content and keep ONLY the corrected version+ 6. PRESERVE intent - keep the user's meaning, just clean the delivery+ 7. EXPAND abbreviations - thx → thanks, pls → please, u → you, ur → your/you're, gonna → going to++ ## Self-Corrections:+ When user corrects themselves, DISCARD everything before the correction trigger:+ - Triggers: "no", "wait", "actually", "scratch that", "delete that", "no no", "cancel", "never mind", "sorry", "oops"+ - Example: "buy milk no wait buy water" → "Buy water." (NOT "Buy milk. Buy water.")+ - Example: "tell John no actually tell Sarah" → "Tell Sarah."+ - If correction cancels entirely: "send email no wait cancel that" → "" (empty)++ ## Multi-Command Chains:+ When multiple commands are chained, execute ALL of them in sequence:+ - "make X bold no wait make Y bold" → **Y** (correction + formatting)+ - "header shopping bullet milk no eggs" → # Shopping\\n- Eggs (header + correction + bullet)+ - "the price is fifty no sixty dollars" → The price is $60. (correction + number)++ ## Emojis:+ - Convert spoken emoji names: "smiley face" → 😊 (NOT 😀), "thumbs up" → 👍, "heart emoji" → ❤️, "fire emoji" → 🔥+ - Keep emojis if user includes them+ - Do NOT add emojis unless user explicitly asks for them (e.g., "joke about cats" → NO 😺)++ ## Critical:+ - Output ONLY the cleaned text+ - Do NOT answer questions - just clean them+ - DO NOT EVER ANSWER TO QUESTIONS+ - Do NOT add explanations or commentary+ - Do NOT wrap in quotes unless the input had quotes+ - Do NOT add filler words (um, uh) to the output+ - PRESERVE ordinals in lists: "first call client, second review contract" → keep "First" and "Second"+ - PRESERVE politeness words: "please", "thank you" at end of sentences+ """}}diff --git a/Sources/Fluid/Views/BottomOverlayView.swift b/Sources/Fluid/Views/BottomOverlayView.swiftindex 257759f1..5539e522 100644--- a/Sources/Fluid/Views/BottomOverlayView.swift+++ b/Sources/Fluid/Views/BottomOverlayView.swift@@ -281,6 +281,18 @@ struct BottomOverlayView: View {!self.contentState.transcriptionText.isEmpty}+ private var isDictationMode: Bool {+ self.contentState.mode == .dictation+ }++ private var selectedPromptLabel: String {+ if let profile = self.settings.selectedDictationPromptProfile {+ let name = profile.name.trimmingCharacters(in: .whitespacesAndNewlines)+ return name.isEmpty ? "Untitled" : name+ }+ return "Default"+ }+// Show last ~60 characters of transcription on single lineprivate var transcriptionSuffix: String {let text = self.contentState.transcriptionText@@ -306,6 +318,40 @@ struct BottomOverlayView: View {}.frame(maxWidth: self.layout.waveformWidth * 2.2, minHeight: self.hasTranscription || self.contentState.isProcessing ? self.layout.transFontSize * 1.5 : 0)+ // Dictation prompt selector (only in dictation mode)+ if self.isDictationMode && !self.contentState.isProcessing {+ Menu {+ Button("Default") {+ self.settings.selectedDictationPromptID = nil+ }+ if !self.settings.dictationPromptProfiles.isEmpty {+ Divider()+ ForEach(self.settings.dictationPromptProfiles) { profile in+ Button(profile.name.isEmpty ? "Untitled" : profile.name) {+ self.settings.selectedDictationPromptID = profile.id+ }+ }+ }+ } label: {+ HStack(spacing: 6) {+ Text("Prompt:")+ .font(.system(size: self.layout.modeFontSize, weight: .medium))+ .foregroundStyle(.white.opacity(0.5))+ Text(self.selectedPromptLabel)+ .font(.system(size: self.layout.modeFontSize, weight: .semibold))+ .foregroundStyle(.white.opacity(0.8))+ .lineLimit(1)+ Image(systemName: "chevron.down")+ .font(.system(size: max(self.layout.modeFontSize - 2, 9), weight: .semibold))+ .foregroundStyle(.white.opacity(0.45))+ }+ }+ .menuStyle(.button)+ .buttonStyle(.plain)+ .frame(maxWidth: self.layout.waveformWidth * 2.0)+ .transition(.opacity)+ }+// Waveform + Mode label rowHStack(spacing: self.layout.hPadding / 1.5) {// Target app icon (the app where text will be typed)diff --git a/Sources/Fluid/Views/NotchContentViews.swift b/Sources/Fluid/Views/NotchContentViews.swiftindex bf6291d1..6e7f5ddd 100644--- a/Sources/Fluid/Views/NotchContentViews.swift+++ b/Sources/Fluid/Views/NotchContentViews.swift@@ -229,6 +229,7 @@ struct ShimmerText: View {struct NotchExpandedView: View {let audioPublisher: AnyPublisher<CGFloat, Never>@ObservedObject private var contentState = NotchContentState.shared+ @ObservedObject private var settings = SettingsStore.sharedprivate var modeColor: Color {self.contentState.mode.notchColor@@ -261,6 +262,18 @@ struct NotchExpandedView: View {self.contentState.mode == .command && !self.contentState.commandConversationHistory.isEmpty}+ private var isDictationMode: Bool {+ self.contentState.mode == .dictation+ }++ private var selectedPromptLabel: String {+ if let profile = self.settings.selectedDictationPromptProfile {+ let name = profile.name.trimmingCharacters(in: .whitespacesAndNewlines)+ return name.isEmpty ? "Untitled" : name+ }+ return "Default"+ }+var body: some View {VStack(spacing: 4) {// Visualization + Mode label row@@ -291,6 +304,40 @@ struct NotchExpandedView: View {}}+ // Dictation prompt selector (only in dictation mode)+ if self.isDictationMode && !self.contentState.isProcessing {+ Menu {+ Button("Default") {+ self.settings.selectedDictationPromptID = nil+ }+ if !self.settings.dictationPromptProfiles.isEmpty {+ Divider()+ ForEach(self.settings.dictationPromptProfiles) { profile in+ Button(profile.name.isEmpty ? "Untitled" : profile.name) {+ self.settings.selectedDictationPromptID = profile.id+ }+ }+ }+ } label: {+ HStack(spacing: 6) {+ Text("Prompt:")+ .font(.system(size: 9, weight: .medium))+ .foregroundStyle(.white.opacity(0.5))+ Text(self.selectedPromptLabel)+ .font(.system(size: 9, weight: .medium))+ .foregroundStyle(.white.opacity(0.75))+ .lineLimit(1)+ Image(systemName: "chevron.down")+ .font(.system(size: 8, weight: .semibold))+ .foregroundStyle(.white.opacity(0.45))+ }+ }+ .menuStyle(.button)+ .buttonStyle(.plain)+ .frame(maxWidth: 180)+ .transition(.opacity)+ }+// Transcription preview (single line, minimal)if self.hasTranscription && !self.contentState.isProcessing {Text(self.contentState.cachedLine2)