Skip to content

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

Bring Edit Mode into the next beta

altic-devee3bd36f8171
diff --cc Info.plist
index b3ad4dad,b3ad4dad..0763971f
--- a/Info.plist
+++ b/Info.plist
@@@ -13,7 -13,7 +13,7 @@@
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleVersion</key>
-- <string>31</string>
++ <string>32</string>
<key>CFBundleShortVersionString</key>
<string>1.6.13-beta.2</string>
<key>LSMinimumSystemVersion</key>
diff --cc Sources/Fluid/Services/PrivateAIIntegrationService.swift
index 11078d1d,efcfd335..72c998cf
--- a/Sources/Fluid/Services/PrivateAIIntegrationService.swift
+++ b/Sources/Fluid/Services/PrivateAIIntegrationService.swift
@@@ -34,6 -34,13 +34,13 @@@ actor PrivateAIIntegrationService
// Absence means no screen context was read.
// swiftlint:disable:next discouraged_optional_collection
var screenText: [String]? = nil
+ /// The text an Edit Mode instruction applies to, when any was selected.
+ var selectedText: String? = nil
- /// The front window, for Edit Mode models that read it.
++ // The front window, for Edit Mode models that read it.
+ // swiftlint:disable:next discouraged_optional_collection
+ var windowLines: [EditModeWindowLine]? = nil
+ /// Signs what Edit Mode writes.
+ var userDisplayName: String? = nil
}
struct EnhancementResult: Sendable, Equatable {
diff --cc Sources/Fluid/UI/AISettings/EditModeModelSection.swift
index 00000000,0333cdf4..27dca80e
mode 000000,100644..100644
--- a/Sources/Fluid/UI/AISettings/EditModeModelSection.swift
+++ b/Sources/Fluid/UI/AISettings/EditModeModelSection.swift
@@@ -1,0 -1,141 +1,147 @@@
+ import Combine
+ import SwiftUI
+
+ /// The model on this Mac that Edit Mode runs on. This row is where it downloads:
+ /// nothing downloads when the shortcut is pressed, and API users never see it.
+ struct EditModeLocalModelRow: View {
+ @Environment(\.theme) private var theme
+ @ObservedObject private var controller = EditModeModelController.shared
+
+ var body: some View {
+ if let model = self.controller.model {
+ HStack(spacing: 24) {
+ VStack(alignment: .leading, spacing: 5) {
- Text(ModelDisplayName.forID(model.id))
++ Text("Model")
+ .font(self.theme.typography.bodyStrong)
+ .foregroundStyle(self.theme.palette.primaryText)
+ self.status(for: model)
+ }
+ Spacer(minLength: 0)
- self.action(for: model)
++ HStack(spacing: self.theme.metrics.spacing.md) {
++ Text(ModelDisplayName.forID(model.id))
++ .font(self.theme.typography.bodySmall)
++ .foregroundStyle(self.theme.palette.secondaryText)
++ self.action(for: model)
++ }
++ .fixedSize(horizontal: true, vertical: false)
+ }
+ .task { await self.controller.refresh() }
+ }
+ }
+
+ @ViewBuilder private func status(for model: PrivateAIRegisteredModel) -> some View {
+ if self.controller.downloading {
+ VStack(alignment: .leading, spacing: self.theme.metrics.spacing.xs) {
+ ProgressView(value: self.controller.fraction)
+ .frame(maxWidth: 220)
+ Text("Downloading · \(Int(self.controller.fraction * 100))%")
+ .font(self.theme.typography.caption)
+ .foregroundStyle(self.theme.palette.secondaryText)
+ .monospacedDigit()
+ }
+ } else if let error = self.controller.error {
+ Text(error)
+ .font(self.theme.typography.caption)
+ .foregroundStyle(self.theme.palette.warning)
+ .fixedSize(horizontal: false, vertical: true)
+ } else if self.controller.installed {
+ Label("Ready · runs on this Mac", systemImage: "checkmark.circle.fill")
+ .font(self.theme.typography.caption)
+ .foregroundStyle(self.theme.palette.success)
+ } else {
+ Text("A one-time download. It stays on this Mac.")
+ .font(self.theme.typography.caption)
+ .foregroundStyle(self.theme.palette.secondaryText)
+ .fixedSize(horizontal: false, vertical: true)
+ }
+ }
+
+ @ViewBuilder private func action(for model: PrivateAIRegisteredModel) -> some View {
+ if self.controller.downloading {
+ Button("Cancel") { self.controller.cancelDownload() }
+ .fluidGlassAction()
+ } else if self.controller.installed {
+ Button("Remove") { self.controller.remove() }
+ .fluidGlassAction()
+ .disabled(self.controller.removing)
+ } else {
+ Button(self.downloadTitle(for: model)) { self.controller.download() }
+ .fluidGlassAction(prominent: true)
+ }
+ }
+
+ private func downloadTitle(for model: PrivateAIRegisteredModel) -> String {
+ guard let bytes = model.artifact.byteCount else { return "Download" }
+ return "Download · \(ByteCountFormatter.string(fromByteCount: bytes, countStyle: .file))"
+ }
+ }
+
+ @MainActor
+ final class EditModeModelController: ObservableObject {
+ static let shared = EditModeModelController()
+
+ let model = CPUArchitecture.isAppleSilicon && PrivateAIProviderFeature.shared.isAvailable
+ ? PrivateAIIntegrationService.editModel
+ : nil
+ @Published private(set) var installed = false
+ @Published private(set) var downloading = false
+ @Published private(set) var removing = false
+ @Published private(set) var fraction = 0.0
+ @Published private(set) var error: String?
+ private var operation: Task<Void, Never>?
+
+ func refresh() async {
+ guard let model else { return }
+ self.installed = await Task.detached(priority: .utility) {
+ PrivateAIIntegrationService.isModelInstalled(model, useCache: false)
+ }.value
+ }
+
+ func download() {
+ guard let model, !self.downloading else { return }
+ self.downloading = true
+ self.fraction = 0
+ self.error = nil
+ self.operation = Task { [weak self] in
+ defer {
+ self?.downloading = false
+ self?.operation = nil
+ }
+ do {
+ _ = try await PrivateAIIntegrationService.prepareModel(model) { [weak self] progress in
+ guard let expected = progress.totalBytesExpected, expected > 0 else { return }
+ let fraction = min(1, Double(progress.totalBytesWritten) / Double(expected))
+ await self?.receive(fraction: fraction)
+ }
+ await self?.refresh()
+ } catch is CancellationError {
+ self?.error = nil
+ } catch {
+ self?.error = Task.isCancelled ? nil : error.localizedDescription
+ }
+ }
+ }
+
+ func cancelDownload() {
+ self.operation?.cancel()
+ }
+
+ func remove() {
+ guard let model, !self.removing else { return }
+ self.removing = true
+ self.error = nil
+ Task { [weak self] in
+ defer { self?.removing = false }
+ do {
+ try await PrivateAIIntegrationService.shared.unloadAndRemoveInstalledModel(model, reason: "Edit Mode model removed")
+ } catch {
+ self?.error = error.localizedDescription
+ }
+ await self?.refresh()
+ }
+ }
+
+ private func receive(fraction: Double) {
+ self.fraction = fraction
+ }
+ }
diff --cc Sources/Fluid/UI/AISettingsView+AdvancedSettings.swift
index d49390d0,cd510ccb..2da64987
--- a/Sources/Fluid/UI/AISettingsView+AdvancedSettings.swift
+++ b/Sources/Fluid/UI/AISettingsView+AdvancedSettings.swift
@@@ -1046,20 -1033,13 +1033,20 @@@ extension AIEnhancementSettingsView
let privateAIAvailable = mode.normalized == .dictate && self.viewModel.isPrivateAIPromptAvailable()
let isSelectedAppsOnly = self.viewModel.promptRoutingScope(for: mode) == .selectedAppsOnly
- VStack(alignment: .leading, spacing: 18) {
- VStack(alignment: .leading, spacing: 6) {
- Label("Switch styles from the dictation overlay", systemImage: "info.circle")
- .font(self.theme.typography.bodyStrong)
- .foregroundStyle(self.theme.palette.accent)
- Text("Manage instructions, models, and shortcuts here.")
- .font(self.theme.typography.bodySmall)
- .foregroundStyle(self.theme.palette.secondaryText)
- }
- .fixedSize(horizontal: false, vertical: true)
-
- VStack(alignment: .leading, spacing: 16) {
+ VStack(alignment: .leading, spacing: AISettingsLayout.stylesSectionSpacing) {
+ self.stylesSection(
+ title: "When you dictate",
+ subtitle: "How your words get cleaned up. Switch anytime from the dictation pop-up."
+ ) {
FluidGlassControlGroup {
- LazyVGrid(columns: Array(repeating: GridItem(.flexible(), spacing: 16), count: privateAIAvailable ? 2 : 1), spacing: 16) {
- HStack(alignment: .top, spacing: 16) {
++ LazyVGrid(columns: [GridItem(.adaptive(minimum: AISettingsLayout.builtInStyleMinWidth), spacing: 16)], spacing: 16) {
++ self.builtInStyleCard(
++ title: "Basic",
++ symbol: "text.alignleft",
++ description: "Transcribes your words without AI cleanup.",
++ configuration: "No cleanup model needed",
++ isEnabled: true
++ )
if privateAIAvailable {
let assignments = self.promptAssignments(selection: .privateAI, isPrivateAI: true)
self.builtInStyleCard(
@@@ -1083,82 -1065,89 +1072,87 @@@
action: (assignments.isReady ? "Edit style" : "Set up", { self.viewModel.openDefaultPromptViewer(for: mode) })
)
}
- // Both cards take the taller one's height.
- .fixedSize(horizontal: false, vertical: true)
}
+ }
- VStack(alignment: .leading, spacing: 10) {
- HStack {
- Text("Custom instructions").font(self.theme.typography.bodyStrong)
- Spacer()
- Button {
- self.viewModel.openNewPromptEditor(prefillMode: mode)
- } label: {
- Label("Add instruction", systemImage: "plus")
- }
- .fluidGlassAction()
+ self.stylesSection(
+ title: "Custom instructions",
+ subtitle: "Your own rules for how text should read. They show up in the dictation pop-up.",
+ trailing: {
+ Button {
+ self.viewModel.openNewPromptEditor(prefillMode: mode)
+ } label: {
+ Label("Add instruction", systemImage: "plus")
}
-
- if customProfiles.isEmpty {
- Text("Create a style for the way you write, then choose it from the overlay.")
- .font(self.theme.typography.bodySmall)
- .foregroundStyle(self.theme.palette.secondaryText)
- } else {
- ForEach(customProfiles) { profile in
- let profileSelection = SettingsStore.DictationPromptSelection.profile(profile.id)
- self.promptProfileCard(
- title: profile.name.isEmpty ? "Untitled Prompt" : profile.name,
- subtitle: self.styleConfigurationSummary(self.promptAssignments(selection: profileSelection)),
- mode: profile.mode,
- assignments: profile.mode.normalized == .dictate
- ? self.promptAssignments(selection: profileSelection)
- : nil,
- onManage: { self.viewModel.openEditor(for: profile) },
- manageTitle: "Edit style",
- onDelete: { self.viewModel.requestDeletePrompt(profile) },
- isEnabled: true
- )
+ .fluidGlassAction(prominent: true)
+ }
+ ) {
+ ThemedCard(style: .subtle, padding: 16) {
+ VStack(alignment: .leading, spacing: 12) {
+ if customProfiles.isEmpty {
+ VStack(alignment: .leading, spacing: 4) {
+ Text("No custom instructions yet")
+ .font(self.theme.typography.bodyStrong)
+ .foregroundStyle(self.theme.palette.primaryText)
+ Text("For example: keep it casual in Slack, or formal in email.")
+ .font(self.theme.typography.bodySmall)
+ .foregroundStyle(self.theme.palette.secondaryText)
+ }
+ .frame(maxWidth: .infinity, alignment: .leading)
+ } else {
+ ForEach(customProfiles) { profile in
+ if profile.id != customProfiles.first?.id { Divider() }
+ let profileSelection = SettingsStore.DictationPromptSelection.profile(profile.id)
+ self.promptProfileCard(
+ title: profile.name.isEmpty ? "Untitled Prompt" : profile.name,
+ subtitle: self.styleConfigurationSummary(self.promptAssignments(selection: profileSelection)),
+ mode: profile.mode,
+ assignments: profile.mode.normalized == .dictate
+ ? self.promptAssignments(selection: profileSelection)
+ : nil,
+ onManage: { self.viewModel.openEditor(for: profile) },
+ manageTitle: "Edit style",
+ onDelete: { self.viewModel.requestDeletePrompt(profile) },
+ isEnabled: true
+ )
+ }
}
- }
- Divider().padding(.vertical, 4)
- DisclosureGroup(isExpanded: self.$showsAppSpecificStyles) {
- VStack(alignment: .leading, spacing: 12) {
- Text("Where custom styles apply")
- .font(self.theme.typography.bodyStrong)
- self.promptRoutingScopeRow(mode: mode)
- Text(isSelectedAppsOnly
- ? "Custom styles run only in the apps listed below. Other apps use the built-in prompt for the selected mode."
- : "Your chosen custom style can run in any app. Add an app rule below to use a different style there.")
- .font(.fluidSystem(.caption))
- .foregroundStyle(self.theme.palette.secondaryText)
- .fixedSize(horizontal: false, vertical: true)
- self.appPromptBindingsSection(mode: mode, isEmphasized: isSelectedAppsOnly, isEnabled: true)
- }
- .padding(.top, 12)
- } label: {
- HStack {
- Text("Advanced").font(self.theme.typography.bodyStrong)
- Spacer()
- if isSelectedAppsOnly {
- Text("Listed apps only")
+ Divider()
+ DisclosureGroup(isExpanded: self.$showsAppSpecificStyles) {
+ VStack(alignment: .leading, spacing: 12) {
+ Text("Where custom styles apply")
+ .font(self.theme.typography.bodyStrong)
+ self.promptRoutingScopeRow(mode: mode)
+ Text(isSelectedAppsOnly
+ ? "Custom styles run only in the apps listed below. Other apps use the built-in prompt for the selected mode."
+ : "Your chosen custom style can run in any app. Add an app rule below to use a different style there.")
.font(.fluidSystem(.caption))
.foregroundStyle(self.theme.palette.secondaryText)
+ .fixedSize(horizontal: false, vertical: true)
+ self.appPromptBindingsSection(mode: mode, isEmphasized: isSelectedAppsOnly, isEnabled: true)
}
- let ruleCount = self.viewModel.appBindings(for: mode).count
- if ruleCount > 0 {
- Text("\(ruleCount) app \(ruleCount == 1 ? "rule" : "rules")")
- .font(.fluidSystem(.caption))
- .foregroundStyle(self.theme.palette.secondaryText)
+ .padding(.top, 12)
+ } label: {
+ HStack {
+ Text("Use different styles in different apps").font(self.theme.typography.bodyStrong)
+ Spacer()
+ if isSelectedAppsOnly {
+ Text("Listed apps only")
+ .font(.fluidSystem(.caption))
+ .foregroundStyle(self.theme.palette.secondaryText)
+ }
+ let ruleCount = self.viewModel.appBindings(for: mode).count
+ if ruleCount > 0 {
+ Text("\(ruleCount) app \(ruleCount == 1 ? "rule" : "rules")")
+ .font(.fluidSystem(.caption))
+ .foregroundStyle(self.theme.palette.secondaryText)
+ }
}
}
+ .disclosureGroupStyle(PromptAdvancedDisclosureStyle())
}
- .disclosureGroupStyle(PromptAdvancedDisclosureStyle())
- }
- .padding(16)
- .background(self.theme.palette.cardBackground, in: RoundedRectangle(cornerRadius: 16))
- .overlay {
- RoundedRectangle(cornerRadius: 16)
- .strokeBorder(self.theme.palette.cardBorder, lineWidth: 1)
- .allowsHitTesting(false)
+ .frame(maxWidth: .infinity, alignment: .leading)
}
}
}
@@@ -1188,35 -1171,70 +1176,72 @@@
Text(subtitle)
.font(self.theme.typography.bodySmall)
.foregroundStyle(self.theme.palette.secondaryText)
- Text(detail)
- .font(self.theme.typography.bodySmall)
- .foregroundStyle(assignments.isReady ? self.theme.palette.secondaryText : self.theme.palette.warning)
+ .fixedSize(horizontal: false, vertical: true)
}
- .fixedSize(horizontal: false, vertical: true)
+ Spacer(minLength: 0)
+ trailing()
}
- Spacer(minLength: 0)
- VStack(alignment: .trailing, spacing: 6) {
- Button(action.title, action: action.perform)
- .fluidGlassAction()
- .fixedSize()
- .disabled(!isEnabled)
- if let shortcut = assignments.shortcutDisplay {
- Label(shortcut, systemImage: "keyboard")
- .font(.fluidSystem(.caption2))
- .foregroundStyle(self.theme.palette.secondaryText)
+ content()
+ }
+ }
+
+ private func shortcutKeycap(_ shortcut: String) -> some View {
+ Text(shortcut)
+ .font(self.theme.typography.captionStrong)
+ .foregroundStyle(self.theme.palette.secondaryText)
+ .padding(.horizontal, 7)
+ .padding(.vertical, 3)
+ .frame(minWidth: 24)
+ .background(Color.primary.opacity(0.08), in: RoundedRectangle(cornerRadius: 6, style: .continuous))
+ .accessibilityLabel("Shortcut \(shortcut)")
+ }
+
+ private func builtInStyleCard(
+ title: String,
+ symbol: String,
+ description: String,
+ configuration: String,
- assignments: PromptCardAssignments,
++ assignments: PromptCardAssignments? = nil,
+ isEnabled: Bool,
- action: (title: String, perform: () -> Void)
++ action: (title: String, perform: () -> Void)? = nil
+ ) -> some View {
+ ThemedCard(style: .subtle, padding: 16) {
+ HStack(alignment: .center, spacing: 16) {
+ HStack(alignment: .top, spacing: 12) {
+ Image(systemName: symbol)
+ .font(.fluidSystem(size: 18, weight: .medium))
+ .foregroundStyle(symbol == "sparkles" ? self.theme.palette.accent : self.theme.palette.secondaryText)
+ .frame(width: 24, height: 24)
+ .accessibilityHidden(true)
+ VStack(alignment: .leading, spacing: 4) {
+ HStack(spacing: 8) {
+ Text(title)
+ .font(self.theme.typography.sectionTitle)
+ .foregroundStyle(self.theme.palette.primaryText)
- if let shortcut = assignments.shortcutDisplay {
++ if let shortcut = assignments?.shortcutDisplay {
+ self.shortcutKeycap(shortcut)
+ }
+ }
+ .frame(minHeight: 22)
+ Text(description)
+ .font(self.theme.typography.bodySmall)
+ .foregroundStyle(self.theme.palette.secondaryText)
+ Text(configuration)
+ .font(self.theme.typography.caption)
- .foregroundStyle(assignments.isReady ? self.theme.palette.tertiaryText : self.theme.palette.warning)
++ .foregroundStyle(assignments?.isReady != false ? self.theme.palette.tertiaryText : self.theme.palette.warning)
+ }
+ .fixedSize(horizontal: false, vertical: true)
+ }
+ .frame(maxHeight: .infinity, alignment: .top)
+ Spacer(minLength: 0)
- Button(action.title, action: action.perform)
- .fluidGlassAction()
- .fixedSize()
- .disabled(!isEnabled)
++ if let action {
++ Button(action.title, action: action.perform)
++ .fluidGlassAction()
++ .fixedSize()
++ .disabled(!isEnabled)
+ }
}
- }
- .padding(16)
- .frame(maxWidth: .infinity, minHeight: 104, alignment: .leading)
- .background {
- RoundedRectangle(cornerRadius: 16)
- .fill(self.theme.palette.cardBackground)
- }
- .overlay {
- RoundedRectangle(cornerRadius: 16)
- .strokeBorder(self.theme.palette.cardBorder, lineWidth: 1)
- .allowsHitTesting(false)
+ .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .leading)
}
}
diff --cc Sources/Fluid/UI/AISettingsView.swift
index 43ceb05f,f6e515e4..17b6bf42
--- a/Sources/Fluid/UI/AISettingsView.swift
+++ b/Sources/Fluid/UI/AISettingsView.swift
@@@ -96,6 -96,8 +96,9 @@@ enum AISettingsLayout
static let promptScopeLabelWidth: CGFloat = 110
static let promptEditorLabelColumnWidth: CGFloat = 140
static let promptEditorControlColumnWidth: CGFloat = 340
++ static let builtInStyleMinWidth: CGFloat = 300
+ static let stylesSectionSpacing: CGFloat = 28
+ static let editModeControlWidth: CGFloat = 260
static let rowLeadingIndent: CGFloat = labelWidth + 12
}