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

Make Cleanup Styles say what each part is for

altic-dev2f7f5427a92e
diff --git a/Sources/Fluid/UI/AISettings/EditModeModelSection.swift b/Sources/Fluid/UI/AISettings/EditModeModelSection.swift
index 324088a7..0333cdf4 100644
--- a/Sources/Fluid/UI/AISettings/EditModeModelSection.swift
+++ b/Sources/Fluid/UI/AISettings/EditModeModelSection.swift
@@ -1,33 +1,26 @@
import Combine
import SwiftUI
-/// Edit Mode picks its own model, apart from dictation's. When that is the model on
-/// this Mac, this is also where it downloads: nothing downloads when the shortcut is
-/// pressed. API users never see the download.
-struct EditModeModelSection<ModelControls: View>: View {
- let showsLocalModel: Bool
- @ViewBuilder let modelControls: () -> ModelControls
+/// 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 {
- FluidManagementGroup(title: "Edit Mode") {
- self.modelControls()
- if self.showsLocalModel, let model = self.controller.model {
- Divider()
- HStack(spacing: self.theme.metrics.spacing.lg) {
- VStack(alignment: .leading, spacing: self.theme.metrics.spacing.xs) {
- Text(ModelDisplayName.forID(model.id))
- .font(self.theme.typography.bodyStrong)
- .foregroundStyle(self.theme.palette.primaryText)
- self.status(for: model)
- }
- Spacer(minLength: self.theme.metrics.spacing.md)
- self.action(for: model)
+ if let model = self.controller.model {
+ HStack(spacing: 24) {
+ VStack(alignment: .leading, spacing: 5) {
+ Text(ModelDisplayName.forID(model.id))
+ .font(self.theme.typography.bodyStrong)
+ .foregroundStyle(self.theme.palette.primaryText)
+ self.status(for: model)
}
+ Spacer(minLength: 0)
+ self.action(for: model)
}
+ .task { await self.controller.refresh() }
}
- .task { await self.controller.refresh() }
}
@ViewBuilder private func status(for model: PrivateAIRegisteredModel) -> some View {
@@ -46,11 +39,11 @@ struct EditModeModelSection<ModelControls: View>: View {
.foregroundStyle(self.theme.palette.warning)
.fixedSize(horizontal: false, vertical: true)
} else if self.controller.installed {
- Label("Ready · rewrites selected text on this Mac", systemImage: "checkmark.circle.fill")
+ Label("Ready · runs on this Mac", systemImage: "checkmark.circle.fill")
.font(self.theme.typography.caption)
.foregroundStyle(self.theme.palette.success)
} else {
- Text("Rewrites selected text when you press the Edit Mode shortcut. Stays on this Mac.")
+ 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)
diff --git a/Sources/Fluid/UI/AISettingsView+AIConfiguration.swift b/Sources/Fluid/UI/AISettingsView+AIConfiguration.swift
index 0616616d..a7e4b39b 100644
--- a/Sources/Fluid/UI/AISettingsView+AIConfiguration.swift
+++ b/Sources/Fluid/UI/AISettingsView+AIConfiguration.swift
@@ -1852,9 +1852,9 @@ extension AIEnhancementSettingsView {
}
var promptsStepContent: some View {
- VStack(alignment: .leading, spacing: FluidPageLayout.sectionSpacing) {
- self.editModeSection
+ VStack(alignment: .leading, spacing: AISettingsLayout.stylesSectionSpacing) {
self.advancedSettingsCard
+ self.editModeSection
}
}
diff --git a/Sources/Fluid/UI/AISettingsView+AdvancedSettings.swift b/Sources/Fluid/UI/AISettingsView+AdvancedSettings.swift
index 1e9c99ba..e13cc872 100644
--- a/Sources/Fluid/UI/AISettingsView+AdvancedSettings.swift
+++ b/Sources/Fluid/UI/AISettingsView+AdvancedSettings.swift
@@ -138,7 +138,6 @@ extension AIEnhancementSettingsView {
isEnabled: Bool = true
) -> some View {
let tone = Color.fluidGreen
- let shape = RoundedRectangle(cornerRadius: 12, style: .continuous)
return VStack(spacing: 10) {
HStack(alignment: .center, spacing: 12) {
@@ -170,7 +169,7 @@ extension AIEnhancementSettingsView {
} label: {
Image(systemName: "slider.horizontal.3")
.font(.fluidSystem(size: 12, weight: .semibold))
- .frame(width: AISettingsLayout.providerRowControlHeight, height: AISettingsLayout.providerRowControlHeight)
+ .frame(width: 18, height: 18)
}
.fluidGlassAction(circular: true)
.disabled(!isEnabled)
@@ -183,7 +182,7 @@ extension AIEnhancementSettingsView {
} label: {
Image(systemName: "trash")
.font(.fluidSystem(size: 12, weight: .semibold))
- .frame(width: AISettingsLayout.providerRowControlHeight, height: AISettingsLayout.providerRowControlHeight)
+ .frame(width: 18, height: 18)
}
.fluidGlassAction(circular: true, tone: .red)
.disabled(!isEnabled)
@@ -203,20 +202,8 @@ extension AIEnhancementSettingsView {
.padding(.leading, 46)
}
}
- .padding(16)
- .frame(minHeight: 76)
+ .padding(.vertical, 2)
.opacity(isEnabled ? 1 : 0.68)
- .background(
- shape
- .fill(self.theme.palette.cardBackground.opacity(0.7))
- .overlay(
- shape
- .stroke(
- self.theme.palette.cardBorder,
- lineWidth: 1
- )
- )
- )
}
private func promptCardIcon(
@@ -1046,27 +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) {
if privateAIAvailable {
let assignments = self.promptAssignments(selection: .privateAI, isPrivateAI: true)
self.builtInStyleCard(
title: SettingsStore.DictationModeLabels.smart,
symbol: "sparkles",
- subtitle: "On-device · \(assignments.modelPicker.map { ModelDisplayName.forID($0.selectedModel) } ?? "Fluid Intelligence")",
- detail: "Built-in style",
+ description: "Cleans up on this Mac. Nothing leaves your computer.",
+ configuration: "On-device · \(assignments.modelPicker.map { ModelDisplayName.forID($0.selectedModel) } ?? "Fluid Intelligence")",
assignments: assignments,
isEnabled: true,
action: ("Edit shortcut", { self.viewModel.openPrivateAIPromptEditor() })
@@ -1076,147 +1056,185 @@ extension AIEnhancementSettingsView {
self.builtInStyleCard(
title: SettingsStore.DictationModeLabels.externalDefault,
symbol: "textformat",
- subtitle: assignments.isReady ? self.styleConfigurationSummary(assignments) : "External AI provider",
- detail: assignments.isReady ? "Customizable cleanup" : "Setup required",
+ description: assignments.isReady
+ ? "Uses your AI provider. You can change its instructions."
+ : "Needs an AI provider before it can run.",
+ configuration: assignments.isReady ? self.styleConfigurationSummary(assignments) : "External AI provider",
assignments: assignments,
isEnabled: true,
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)
}
}
}
.padding(.top, 2)
}
- private func builtInStyleCard(
+ /// One titled part of the page. The title says what the part is for, so people
+ /// never have to work it out from the controls inside.
+ private func stylesSection<Trailing: View, Content: View>(
title: String,
- symbol: String,
subtitle: String,
- detail: String,
- assignments: PromptCardAssignments,
- isEnabled: Bool,
- action: (title: String, perform: () -> Void)
+ @ViewBuilder trailing: () -> Trailing = { EmptyView() },
+ @ViewBuilder content: () -> Content
) -> some View {
- HStack(alignment: .center, spacing: 16) {
- HStack(alignment: .center, spacing: 12) {
- Image(systemName: symbol)
- .font(.fluidSystem(size: 20, 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) {
+ VStack(alignment: .leading, spacing: 12) {
+ HStack(alignment: .center, spacing: 16) {
+ VStack(alignment: .leading, spacing: 3) {
Text(title)
- .font(.fluidSystem(size: 14, weight: .semibold))
+ .font(self.theme.typography.sectionTitle)
.foregroundStyle(self.theme.palette.primaryText)
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) {
+ 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,
+ isEnabled: Bool,
+ action: (title: String, perform: () -> Void)
+ ) -> 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 {
+ 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)
+ }
+ .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 shortcut = assignments.shortcutDisplay {
- Label(shortcut, systemImage: "keyboard")
- .font(.fluidSystem(.caption2))
- .foregroundStyle(self.theme.palette.secondaryText)
- }
}
- }
- .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)
}
}
@@ -1250,10 +1268,6 @@ extension AIEnhancementSettingsView {
}
Spacer(minLength: 12)
-
- if mode.normalized == .edit {
- self.editModeInlineModelControls
- }
}
.frame(minHeight: AISettingsLayout.controlHeight)
.padding(.top, 2)
@@ -1325,98 +1339,130 @@ extension AIEnhancementSettingsView {
)
}
+ /// Edit Mode picks its own model, apart from dictation's. Every choice gets its own
+ /// row, and the download only appears when the model on this Mac is the one in use.
var editModeSection: some View {
- EditModeModelSection(showsLocalModel: self.isPrivateAIProviderID(self.activeEditModeProviderID)) {
- self.editModeInlineModelControls
- }
- }
-
- private var editModeInlineModelControls: some View {
- let verified = self.editModeVerifiedProviders
-
- return HStack(alignment: .center, spacing: 10) {
- Text("Edit model")
- .font(.fluidSystem(size: 12, weight: .semibold))
- .foregroundStyle(self.theme.palette.secondaryText)
-
- if verified.isEmpty {
- HStack(spacing: 8) {
- Image(systemName: "info.circle")
- .font(.fluidSystem(size: 12))
- .foregroundStyle(.secondary)
- Text("No verified AI provider")
- .font(.fluidSystem(.caption))
- .foregroundStyle(.secondary)
- .lineLimit(1)
- }
- } else {
- let providerID = self.activeEditModeProviderID
- let models = self.editModeModels(for: providerID)
- Group {
- Toggle("Same as dictation", isOn: self.editModeLinkedToGlobalBinding)
- .toggleStyle(.checkbox)
- .font(.fluidSystem(.caption))
- .foregroundStyle(.secondary)
- .fixedSize(horizontal: true, vertical: false)
- .onChange(of: self.settings.rewriteModeLinkedToGlobal) { _, linked in
- if linked {
- self.syncEditModeToGlobalSelection()
- } else {
- self.normalizeEditModeProviderSelection()
+ let providerID = self.activeEditModeProviderID
+ let providers = self.editModeVerifiedProviders
+ return self.stylesSection(
+ title: "Edit Mode",
+ subtitle: "Select text, press the shortcut, and say what to change. It runs on its own model, separate from dictation."
+ ) {
+ ThemedCard(style: .subtle, padding: 16) {
+ VStack(alignment: .leading, spacing: 14) {
+ FluidManagementRow(title: "Runs on", detail: "Where your edits are processed.") {
+ FluidDropdownPicker(
+ "Runs on",
+ selectedTitle: self.editModeRunsOnTitle(providers: providers),
+ selection: self.editModeRunsOnBinding
+ ) {
+ Text("Same as dictation").tag(Self.editModeSameAsDictationID)
+ ForEach(providers) { provider in
+ Text(provider.name).tag(provider.id)
}
}
-
- Text("Provider")
- .font(.fluidSystem(.caption))
- .foregroundStyle(.secondary)
-
- FluidDropdownPicker(
- "Provider",
- selectedTitle: verified.first(where: { $0.id == self.editModeProviderBinding.wrappedValue })?.name ?? "Choose provider",
- selection: self.editModeProviderBinding
+ .fluidDropdownStyle()
+ .labelsHidden()
+ .fixedSize()
+ }
+ Divider()
+ if self.isPrivateAIProviderID(providerID) {
+ EditModeLocalModelRow()
+ } else {
+ self.editModeProviderModelRow(providerID: providerID)
+ }
+ Divider()
+ FluidManagementRow(
+ title: "Shortcut",
+ detail: self.settings.rewriteModeShortcutEnabled
+ ? "Press it with text selected."
+ : "Off. Turn it on in Settings to use Edit Mode."
) {
- ForEach(verified) { provider in
- Text(provider.name).tag(provider.id)
+ HStack(spacing: 10) {
+ self.shortcutKeycap(self.settings.rewriteModeHotkeyShortcut.displayString)
+ Button("Change") { AppNavigationRouter.shared.request(.dictationShortcuts) }
+ .fluidGlassAction()
}
}
- .fluidDropdownStyle()
- .labelsHidden()
- .frame(width: AISettingsLayout.promptInlinePickerWidth)
- .disabled(self.settings.rewriteModeLinkedToGlobal)
-
- Text("Model")
- .font(.fluidSystem(.caption))
- .foregroundStyle(.secondary)
-
- SearchableModelPicker(
- models: models,
- selectedModel: self.editModeModelBinding(for: providerID),
- onRefresh: {
- guard !self.isPrivateAIProviderID(providerID) else { return }
- await self.viewModel.fetchModels(for: providerID)
- },
- isRefreshing: self.viewModel.refreshingProviderID == providerID,
- refreshEnabled: !self.settings.rewriteModeLinkedToGlobal && self.canFetchModels(for: providerID),
- selectionEnabled: !self.settings.rewriteModeLinkedToGlobal && !models.isEmpty,
- controlWidth: AISettingsLayout.promptInlineModelWidth,
- controlHeight: 26
- )
- .disabled(self.settings.rewriteModeLinkedToGlobal)
}
- .opacity(self.settings.rewriteModeLinkedToGlobal ? 0.65 : 1)
+ .frame(maxWidth: .infinity, alignment: .leading)
}
}
- .frame(maxWidth: .infinity, alignment: .trailing)
.onAppear {
self.ensureDefaultEditModeSyncState()
if self.settings.rewriteModeLinkedToGlobal {
self.syncEditModeToGlobalSelection()
- } else if !verified.isEmpty {
+ } else if !providers.isEmpty {
self.normalizeEditModeProviderSelection()
}
}
}
+ @ViewBuilder
+ private func editModeProviderModelRow(providerID: String) -> some View {
+ let models = self.editModeModels(for: providerID)
+ let isLinked = self.settings.rewriteModeLinkedToGlobal
+ if providerID.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
+ FluidManagementRow(title: "Model", detail: "Add an AI provider to use Edit Mode.") {
+ Button("AI Providers") { AppNavigationRouter.shared.request(.aiEnhancements) }
+ .fluidGlassAction()
+ }
+ } else {
+ FluidManagementRow(
+ title: "Model",
+ detail: isLinked ? "The one dictation uses." : "Which of your provider's models to use."
+ ) {
+ SearchableModelPicker(
+ models: models,
+ selectedModel: self.editModeModelBinding(for: providerID),
+ onRefresh: {
+ guard !self.isPrivateAIProviderID(providerID) else { return }
+ await self.viewModel.fetchModels(for: providerID)
+ },
+ isRefreshing: self.viewModel.refreshingProviderID == providerID,
+ refreshEnabled: !isLinked && self.canFetchModels(for: providerID),
+ selectionEnabled: !isLinked && !models.isEmpty,
+ controlWidth: AISettingsLayout.editModeControlWidth,
+ controlHeight: AISettingsLayout.controlHeight
+ )
+ .disabled(isLinked)
+ }
+ }
+ }
+
+ private static let editModeSameAsDictationID = "__edit_mode_same_as_dictation__"
+
+ private func editModeRunsOnTitle(providers: [AIEnhancementSettingsViewModel.ProviderItemData]) -> String {
+ guard self.settings.rewriteModeLinkedToGlobal else {
+ return providers.first(where: { $0.id == self.editModeSelectedProviderID })?.name ?? "Choose provider"
+ }
+ guard let dictationProvider = providers.first(where: { $0.id == self.settings.effectiveRewriteModeProviderID }) else {
+ return "Same as dictation"
+ }
+ return "Same as dictation · \(dictationProvider.name)"
+ }
+
+ private var editModeRunsOnBinding: Binding<String> {
+ Binding(
+ get: {
+ self.settings.rewriteModeLinkedToGlobal ? Self.editModeSameAsDictationID : self.editModeSelectedProviderID
+ },
+ set: { selection in
+ if selection == Self.editModeSameAsDictationID {
+ self.settings.rewriteModeLinkedToGlobal = true
+ self.syncEditModeToGlobalSelection()
+ } else {
+ self.settings.rewriteModeLinkedToGlobal = false
+ self.settings.rewriteModeSelectedProviderID = selection
+ let models = self.editModeModels(for: selection)
+ if !models.contains(self.settings.rewriteModeSelectedModel ?? "") {
+ self.settings.rewriteModeSelectedModel = models.first
+ }
+ }
+ }
+ )
+ }
+
@ViewBuilder
private func appPromptBindingsSection(mode: SettingsStore.PromptMode, isEmphasized: Bool = false, isEnabled: Bool = true) -> some View {
let bindings = self.viewModel.appBindings(for: mode)
@@ -1612,33 +1658,11 @@ extension AIEnhancementSettingsView {
private var activeEditModeProviderID: String {
if self.settings.rewriteModeLinkedToGlobal {
- return self.settings.selectedProviderID
+ return self.settings.effectiveRewriteModeProviderID
}
return self.editModeSelectedProviderID
}
- private var editModeLinkedToGlobalBinding: Binding<Bool> {
- Binding(
- get: { self.settings.rewriteModeLinkedToGlobal },
- set: { self.settings.rewriteModeLinkedToGlobal = $0 }
- )
- }
-
- private var editModeProviderBinding: Binding<String> {
- Binding(
- get: { self.activeEditModeProviderID },
- set: { newProviderID in
- guard !self.settings.rewriteModeLinkedToGlobal else { return }
- self.settings.rewriteModeSelectedProviderID = newProviderID
- let models = self.editModeModels(for: newProviderID)
- let current = self.settings.rewriteModeSelectedModel ?? ""
- if !models.contains(current) {
- self.settings.rewriteModeSelectedModel = models.first
- }
- }
- )
- }
-
private func editModeModelBinding(for providerID: String) -> Binding<String> {
Binding(
get: {
@@ -1677,7 +1701,7 @@ extension AIEnhancementSettingsView {
}
private func syncEditModeToGlobalSelection() {
- let global = self.settings.selectedProviderID
+ let global = self.settings.effectiveRewriteModeProviderID
guard !global.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty else {
self.settings.rewriteModeSelectedProviderID = ""
self.settings.rewriteModeSelectedModel = nil
diff --git a/Sources/Fluid/UI/AISettingsView.swift b/Sources/Fluid/UI/AISettingsView.swift
index 43ceb05f..f6e515e4 100644
--- a/Sources/Fluid/UI/AISettingsView.swift
+++ b/Sources/Fluid/UI/AISettingsView.swift
@@ -96,6 +96,8 @@ enum AISettingsLayout {
static let promptScopeLabelWidth: CGFloat = 110
static let promptEditorLabelColumnWidth: CGFloat = 140
static let promptEditorControlColumnWidth: CGFloat = 340
+ static let stylesSectionSpacing: CGFloat = 28
+ static let editModeControlWidth: CGFloat = 260
static let rowLeadingIndent: CGFloat = labelWidth + 12
}