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

feat(ai): prewarm private dictation runtime

altic-dev1739fe2ab98d
diff --git a/Sources/Fluid/ContentView.swift b/Sources/Fluid/ContentView.swift
index 59e4339b..aa9f808a 100644
--- a/Sources/Fluid/ContentView.swift
+++ b/Sources/Fluid/ContentView.swift
@@ -2569,6 +2569,20 @@ struct ContentView: View {
DebugLogger.shared.error("Failed to pre-load model: \(error)", source: "ContentView")
}
}
+
+ // Pre-warm the local AI dictation runtime during recording so the first
+ // enhancement is a warm prefix-cache hit instead of paying model load +
+ // prompt prefill after the user stops speaking. Only when the private
+ // provider is the selected, configured dictation provider; best-effort.
+ if PrivateAIProviderPromptFormat.isAvailable(settings: SettingsStore.shared),
+ DictationAIPostProcessingGate.isConfigured()
+ {
+ Task {
+ DebugLogger.shared.debug("ContentView: AI dictation prewarm started", source: "ContentView")
+ await PrivateAIIntegrationService.shared.prewarmDictation()
+ DebugLogger.shared.debug("AI dictation prewarm complete", source: "ContentView")
+ }
+ }
}
/// Best-effort: re-activate the app that was focused when recording started.
diff --git a/Sources/Fluid/Services/PrivateAIIntegrationService.swift b/Sources/Fluid/Services/PrivateAIIntegrationService.swift
index f7ffb3d9..fa933d38 100644
--- a/Sources/Fluid/Services/PrivateAIIntegrationService.swift
+++ b/Sources/Fluid/Services/PrivateAIIntegrationService.swift
@@ -103,6 +103,10 @@ actor PrivateAIIntegrationService {
try await Self.provider.loadModel(model)
}
+ func prewarmDictation() async {
+ await Self.provider.prewarmDictation()
+ }
+
func unloadCachedRuntime(reason: String = "manual") async {
await Self.provider.unloadCachedRuntime(reason: reason)
}
diff --git a/Sources/Fluid/Services/PrivateAIProvider.swift b/Sources/Fluid/Services/PrivateAIProvider.swift
index 747fff02..6eead894 100644
--- a/Sources/Fluid/Services/PrivateAIProvider.swift
+++ b/Sources/Fluid/Services/PrivateAIProvider.swift
@@ -111,6 +111,7 @@ protocol PrivateAIIntegrationProviding: Sendable {
func status(for runtime: PrivateAIIntegrationService.RuntimeConfiguration) async -> PrivateAIStatus
func loadedModelState() async -> PrivateAIIntegrationService.LoadedModelState?
func loadModel(_ model: PrivateAIRegisteredModel) async throws -> PrivateAIStatus
+ func prewarmDictation() async
func unloadCachedRuntime(reason: String) async
func enhanceDictation(
_ inputText: String,
@@ -123,6 +124,11 @@ extension PrivateAIIntegrationProviding {
func prepareModel(_ model: PrivateAIRegisteredModel) async throws -> URL {
try await self.prepareModel(model, progressHandler: nil)
}
+
+ /// Best-effort, no-op by default. Backends that support prefix priming
+ /// (the local FluidIntelligence bridge) override this to load and prime the
+ /// dictation runtime ahead of the first request.
+ func prewarmDictation() async {}
}
enum PrivateAIProviderRegistry {