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

Fix onboarding playground output routing and voice model redirect

altic-devcbeb31f1d77b
diff --git a/Sources/Fluid/ContentView.swift b/Sources/Fluid/ContentView.swift
index b9eaec00..1608d73b 100644
--- a/Sources/Fluid/ContentView.swift
+++ b/Sources/Fluid/ContentView.swift
@@ -45,6 +45,11 @@ struct ContentView: View {
case command
}
+ private enum DictationOutputRoute: String {
+ case normal
+ case onboardingSandbox
+ }
+
@EnvironmentObject private var appServices: AppServices
@StateObject private var mouseTracker = MousePositionTracker()
@StateObject private var commandModeService = CommandModeService()
@@ -1560,8 +1565,9 @@ struct ContentView: View {
// MARK: - Stop and Process Transcription
- private func stopAndProcessTranscription() async {
+ private func stopAndProcessTranscription(route: DictationOutputRoute = .normal) async {
DebugLogger.shared.debug("stopAndProcessTranscription called", source: "ContentView")
+ DebugLogger.shared.info("Output route selected: \(route.rawValue)", source: "ContentView")
// Check if we're in rewrite or command mode
let modeAtStop = self.activeRecordingMode
@@ -1686,6 +1692,7 @@ struct ContentView: View {
// Apply GAAV formatting as the FINAL step (after AI post-processing)
// This ensures the user's preference for no capitalization/period is respected
finalText = ASRService.applyGAAVFormatting(finalText)
+ self.asr.finalText = finalText
DebugLogger.shared.info("Transcription finalized (chars: \(finalText.count))", source: "ContentView")
@@ -1699,8 +1706,16 @@ struct ContentView: View {
]
)
+ let shouldPersistOutputs = route == .normal
+ if !shouldPersistOutputs {
+ DebugLogger.shared.info(
+ "Sandbox route active: suppressing clipboard/history/external typing side effects",
+ source: "ContentView"
+ )
+ }
+
// Save to transcription history (transcription mode only, if enabled)
- if SettingsStore.shared.saveTranscriptionHistory {
+ if shouldPersistOutputs, SettingsStore.shared.saveTranscriptionHistory {
let appInfo = self.recordingAppInfo ?? self.getCurrentAppInfo()
TranscriptionHistoryStore.shared.addEntry(
rawText: transcribedText,
@@ -1711,7 +1726,7 @@ struct ContentView: View {
}
// Copy to clipboard if enabled (happens before typing as a backup)
- if SettingsStore.shared.copyTranscriptionToClipboard {
+ if shouldPersistOutputs, SettingsStore.shared.copyTranscriptionToClipboard {
ClipboardService.copyToClipboard(finalText)
AnalyticsService.shared.capture(
.outputDelivered,
@@ -1726,7 +1741,7 @@ struct ContentView: View {
let frontmostApp = NSWorkspace.shared.frontmostApplication
let frontmostName = frontmostApp?.localizedName ?? "Unknown"
let isFluidFrontmost = frontmostApp?.bundleIdentifier?.contains("fluid") == true
- let shouldTypeExternally = !isFluidFrontmost || self.isTranscriptionFocused == false
+ let shouldTypeExternally = shouldPersistOutputs && (!isFluidFrontmost || self.isTranscriptionFocused == false)
DebugLogger.shared.debug(
"Typing decision → frontmost: \(frontmostName), fluidFrontmost: \(isFluidFrontmost), editorFocused: \(self.isTranscriptionFocused), willTypeExternally: \(shouldTypeExternally)",
@@ -1766,7 +1781,8 @@ struct ContentView: View {
)
NotchOverlayManager.shared.hide()
- } else if SettingsStore.shared.copyTranscriptionToClipboard == false,
+ } else if shouldPersistOutputs,
+ SettingsStore.shared.copyTranscriptionToClipboard == false,
SettingsStore.shared.saveTranscriptionHistory
{
AnalyticsService.shared.capture(
@@ -1779,6 +1795,18 @@ struct ContentView: View {
}
}
+ private func currentDictationOutputRouteForHotkeyStop() -> DictationOutputRoute {
+ let onboardingPlaygroundStep = 4
+ let isOnboardingPlayground = !self.settings.onboardingCompleted &&
+ self.settings.onboardingCurrentStep == onboardingPlaygroundStep
+ let isDictationMode = self.activeRecordingMode == .dictate
+
+ if isOnboardingPlayground && isDictationMode {
+ return .onboardingSandbox
+ }
+ return .normal
+ }
+
private func reprocessLastDictationFromHistory() {
guard let last = TranscriptionHistoryStore.shared.entries.first else {
DebugLogger.shared.info("Actions: Reprocess requested but history is empty", source: "ContentView")
@@ -2418,7 +2446,9 @@ struct ContentView: View {
}
},
stopAndProcessCallback: {
- await self.stopAndProcessTranscription()
+ let route = self.currentDictationOutputRouteForHotkeyStop()
+ DebugLogger.shared.info("Hotkey stop callback using route: \(route.rawValue)", source: "ContentView")
+ await self.stopAndProcessTranscription(route: route)
},
commandModeCallback: {
DebugLogger.shared.info("Command mode triggered", source: "ContentView")
diff --git a/Sources/Fluid/UI/WelcomeView.swift b/Sources/Fluid/UI/WelcomeView.swift
index b8b32285..f32d6732 100644
--- a/Sources/Fluid/UI/WelcomeView.swift
+++ b/Sources/Fluid/UI/WelcomeView.swift
@@ -63,9 +63,9 @@ struct WelcomeView: View {
: "Download the AI model for offline voice transcription (~500MB)"),
status: (self.asr.isAsrReady || self.asr.modelsExistOnDisk) ? .completed : .pending,
action: {
- self.selectedSidebarItem = .aiEnhancements
+ self.selectedSidebarItem = .voiceEngine
},
- actionButtonTitle: "Go to AI Settings",
+ actionButtonTitle: "Go to Voice Engine",
showActionButton: !(self.asr.isAsrReady || self.asr.modelsExistOnDisk)
)
@@ -547,8 +547,6 @@ struct OnboardingFlowView: View {
let menuBarManager: MenuBarManager
let theme: AppTheme
- @State private var playgroundText: String = ""
- @State private var isPlaygroundRecording: Bool = false
@State private var preferredLanguageChoice: PreferredLanguageChoice = .englishOnly
private enum PreferredLanguageChoice: String, CaseIterable, Identifiable {
@@ -733,6 +731,11 @@ struct OnboardingFlowView: View {
self.settings.onboardingPlaygroundValidated
}
+ private var onboardingShortcutDisplay: String {
+ let display = self.settings.hotkeyShortcut.displayString.trimmingCharacters(in: .whitespacesAndNewlines)
+ return display.isEmpty ? "your shortcut" : display
+ }
+
private var canContinue: Bool {
switch self.step {
case .voiceModel:
@@ -1113,22 +1116,28 @@ struct OnboardingFlowView: View {
Text("Quick Playground Test")
.font(.headline)
Spacer()
- if self.isPlaygroundRecording {
+ if self.asr.isRunning {
Text("Recording...")
.font(.caption.weight(.semibold))
.foregroundStyle(.red)
}
}
- Button(self.isPlaygroundRecording ? "Stop Recording" : "Start Recording") {
+ VStack(alignment: .leading, spacing: 8) {
+ Text("Press Start Recording or use \(self.onboardingShortcutDisplay), then stop and confirm your text appears below.")
+ .font(.caption)
+ .foregroundStyle(.secondary)
+
+ Button(self.asr.isRunning ? "Stop Recording" : "Start Recording") {
self.togglePlaygroundRecording()
}
- .buttonStyle(PremiumButtonStyle(isRecording: self.isPlaygroundRecording))
- .disabled(self.asr.micStatus != .authorized)
+ .buttonStyle(PremiumButtonStyle(isRecording: self.asr.isRunning))
+ .disabled(self.asr.micStatus != .authorized)
+ }
TextEditor(text: Binding(
- get: { self.playgroundText },
- set: { _ in }
+ get: { self.asr.finalText },
+ set: { self.asr.finalText = $0 }
))
.font(.body)
.frame(height: 170)
@@ -1152,7 +1161,7 @@ struct OnboardingFlowView: View {
.foregroundStyle(.secondary)
}
} else {
- Text("Record a short sample and confirm transcription appears here.")
+ Text("Record a short sample with the button or your hotkey and confirm transcription appears here.")
.font(.caption)
.foregroundStyle(.secondary)
}
@@ -1162,6 +1171,11 @@ struct OnboardingFlowView: View {
}
.padding(24)
}
+ .onChange(of: self.asr.finalText) { _, newValue in
+ if !newValue.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
+ self.markPlaygroundValidated()
+ }
+ }
}
private var footer: some View {
@@ -1460,17 +1474,15 @@ struct OnboardingFlowView: View {
private func togglePlaygroundRecording() {
Task { @MainActor in
- if self.isPlaygroundRecording {
+ if self.asr.isRunning {
let transcribed = await self.asr.stop()
- self.isPlaygroundRecording = false
- self.playgroundText = ASRService.applyGAAVFormatting(transcribed)
- if !self.playgroundText.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
+ self.asr.finalText = ASRService.applyGAAVFormatting(transcribed)
+ if !self.asr.finalText.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
self.markPlaygroundValidated()
}
} else {
- self.playgroundText = ""
+ self.asr.finalText = ""
await self.asr.start()
- self.isPlaygroundRecording = self.asr.isRunning
}
}
}