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

Show warning in overaly if edit mode used with fluid-1

grohith327ce8f3b6edc36
diff --git a/Sources/Fluid/ContentView.swift b/Sources/Fluid/ContentView.swift
index 5dd4b03e..f74bd4e5 100644
--- a/Sources/Fluid/ContentView.swift
+++ b/Sources/Fluid/ContentView.swift
@@ -2443,8 +2443,40 @@ struct ContentView: View {
self.hideOverlayAsync(reason: "after_output")
}
+ private func showPrivateAIEditModeUnavailableIfNeeded() -> Bool {
+ let settings = SettingsStore.shared
+ let providerID = settings.rewriteModeLinkedToGlobal
+ ? settings.selectedProviderID
+ : settings.rewriteModeSelectedProviderID
+ guard PrivateFeatures.privateAIProvider,
+ providerID.trimmingCharacters(in: .whitespacesAndNewlines) ==
+ PrivateAIProviderFeature.shared.providerID
+ else {
+ return false
+ }
+
+ self.menuBarManager.setOverlayMode(.edit)
+ self.advanceOverlayLifecycle()
+ let expectedOverlayLifecycleID = self.overlayLifecycleID
+ self.menuBarManager.showRecordingOverlayImmediately()
+ NotchContentState.shared.showAIProcessingFailure(
+ message: "Edit Mode cannot be used with Fluid-1",
+ canRetry: false
+ )
+ self.menuBarManager.finishProcessingKeepingOverlayVisible()
+
+ Task { @MainActor in
+ try? await Task.sleep(nanoseconds: 6_000_000_000)
+ guard self.overlayLifecycleID == expectedOverlayLifecycleID else { return }
+ NotchContentState.shared.clearAIProcessingFailure()
+ await self.menuBarManager.finishProcessingAndHideOverlay()
+ }
+ return true
+ }
+
private func advanceOverlayLifecycle() {
self.overlayLifecycleID &+= 1
+ NotchContentState.shared.clearAIProcessingFailure()
}
private func hideOverlayAsync(reason: String) {
@@ -3319,6 +3351,8 @@ struct ContentView: View {
}
},
rewriteModeCallback: {
+ guard !self.showPrivateAIEditModeUnavailableIfNeeded() else { return }
+
self.captureRecordingContext()
// Try to capture text first while still in the other app
diff --git a/Sources/Fluid/Views/BottomOverlayView.swift b/Sources/Fluid/Views/BottomOverlayView.swift
index 456c56f1..63a27835 100644
--- a/Sources/Fluid/Views/BottomOverlayView.swift
+++ b/Sources/Fluid/Views/BottomOverlayView.swift
@@ -2275,7 +2275,8 @@ struct BottomOverlayView: View {
}
private var shouldReservePreviewArea: Bool {
- self.layout.showsPreview && self.settings.enableStreamingPreview
+ self.layout.showsPreview &&
+ (self.settings.enableStreamingPreview || self.contentState.isAIProcessingFailureVisible)
}
private var overlayFrameHeight: CGFloat? {
@@ -2777,17 +2778,23 @@ struct BottomOverlayView: View {
private var aiProcessingFailureView: some View {
HStack(spacing: 8) {
- Text("AI Enhancement failed")
+ Text(self.contentState.aiProcessingFailureMessage)
.font(.system(size: self.layout.transFontSize, weight: .semibold))
- .foregroundStyle(.white.opacity(0.9))
+ .foregroundStyle(
+ self.contentState.canRetryAIProcessingFailure
+ ? Color.white.opacity(0.9)
+ : Color.orange.opacity(0.9)
+ )
.lineLimit(1)
.truncationMode(.tail)
Spacer(minLength: 4)
- self.failureIconButton(systemName: "arrow.clockwise", help: "Try again") {
- self.contentState.clearAIProcessingFailure()
- self.contentState.onReprocessLastRequested?()
+ if self.contentState.canRetryAIProcessingFailure {
+ self.failureIconButton(systemName: "arrow.clockwise", help: "Try again") {
+ self.contentState.clearAIProcessingFailure()
+ self.contentState.onReprocessLastRequested?()
+ }
}
self.failureIconButton(systemName: "xmark", help: "Dismiss") {
diff --git a/Sources/Fluid/Views/NotchContentViews.swift b/Sources/Fluid/Views/NotchContentViews.swift
index 8777d985..bf3e69c9 100644
--- a/Sources/Fluid/Views/NotchContentViews.swift
+++ b/Sources/Fluid/Views/NotchContentViews.swift
@@ -23,6 +23,8 @@ class NotchContentState: ObservableObject {
@Published var promptPickerMode: SettingsStore.PromptMode = .dictate
@Published var isProcessing: Bool = false // AI processing state
@Published var isAIProcessingFailureVisible: Bool = false
+ @Published private(set) var aiProcessingFailureMessage: String = "AI Enhancement failed"
+ @Published private(set) var canRetryAIProcessingFailure: Bool = true
@Published var activeDictationShortcutSlot: SettingsStore.DictationShortcutSlot? = nil
@Published var promptModeOverrideProfileName: String? = nil // Name shown in overlay when prompt mode hotkey is active
@Published var promptModeOverrideProfileID: String? = nil // ID of the active override profile (for checkmark in menu)
@@ -96,7 +98,12 @@ class NotchContentState: ObservableObject {
self.isProcessing = processing
}
- func showAIProcessingFailure() {
+ func showAIProcessingFailure(
+ message: String = "AI Enhancement failed",
+ canRetry: Bool = true
+ ) {
+ self.aiProcessingFailureMessage = message
+ self.canRetryAIProcessingFailure = canRetry
self.isAIProcessingFailureVisible = true
}
@@ -905,24 +912,30 @@ struct NotchExpandedView: View {
if self.contentState.isAIProcessingFailureVisible && !self.contentState.isProcessing {
HStack(spacing: 6) {
- Text("AI Enhancement failed")
+ Text(self.contentState.aiProcessingFailureMessage)
.font(.system(size: 10, weight: .semibold))
- .foregroundStyle(.white.opacity(0.82))
+ .foregroundStyle(
+ self.contentState.canRetryAIProcessingFailure
+ ? Color.white.opacity(0.82)
+ : Color.orange.opacity(0.9)
+ )
.lineLimit(1)
.truncationMode(.tail)
Spacer(minLength: 2)
- Button {
- self.contentState.clearAIProcessingFailure()
- self.contentState.onReprocessLastRequested?()
- } label: {
- Image(systemName: "arrow.clockwise")
- .font(.system(size: 9, weight: .bold))
- .frame(width: 16, height: 16)
+ if self.contentState.canRetryAIProcessingFailure {
+ Button {
+ self.contentState.clearAIProcessingFailure()
+ self.contentState.onReprocessLastRequested?()
+ } label: {
+ Image(systemName: "arrow.clockwise")
+ .font(.system(size: 9, weight: .bold))
+ .frame(width: 16, height: 16)
+ }
+ .buttonStyle(.plain)
+ .help("Try again")
}
- .buttonStyle(.plain)
- .help("Try again")
Button {
self.contentState.clearAIProcessingFailure()
diff --git a/Tests/FluidDictationIntegrationTests/DictationE2ETests.swift b/Tests/FluidDictationIntegrationTests/DictationE2ETests.swift
index ba08bc0f..451976a1 100644
--- a/Tests/FluidDictationIntegrationTests/DictationE2ETests.swift
+++ b/Tests/FluidDictationIntegrationTests/DictationE2ETests.swift
@@ -60,6 +60,28 @@ final class DictationE2ETests: XCTestCase {
]
}
+ func testOverlayFailureSupportsCustomNonRetryableMessage() {
+ let state = NotchContentState.shared
+ defer {
+ state.showAIProcessingFailure()
+ state.clearAIProcessingFailure()
+ }
+
+ state.showAIProcessingFailure(
+ message: "Edit Mode cannot be used with Fluid-1",
+ canRetry: false
+ )
+
+ XCTAssertTrue(state.isAIProcessingFailureVisible)
+ XCTAssertEqual(state.aiProcessingFailureMessage, "Edit Mode cannot be used with Fluid-1")
+ XCTAssertFalse(state.canRetryAIProcessingFailure)
+
+ state.showAIProcessingFailure()
+
+ XCTAssertEqual(state.aiProcessingFailureMessage, "AI Enhancement failed")
+ XCTAssertTrue(state.canRetryAIProcessingFailure)
+ }
+
func testTranscriptionHistoryEntryClipboardTextPrefersProcessedText() {
let entry = TranscriptionHistoryEntry(
rawText: " raw transcript ",