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

chore(private-ai): add idle unload test override

altic-devc98acd53ddfc
diff --git a/Sources/Fluid/Persistence/SettingsStore.swift b/Sources/Fluid/Persistence/SettingsStore.swift
index 67bf8f9d..f5fbdb25 100644
--- a/Sources/Fluid/Persistence/SettingsStore.swift
+++ b/Sources/Fluid/Persistence/SettingsStore.swift
@@ -1715,6 +1715,15 @@ final class SettingsStore: ObservableObject {
}
}
+ /// The chosen quiet period. A local-testing override shortens it without
+ /// adding a UI option: `defaults write com.FluidApp.app
+ /// PrivateAIProviderIdleUnloadTestSeconds -int 60`.
+ var privateAIIdleUnloadDelay: Duration? {
+ guard let delay = self.privateAIIdleUnload.delay else { return nil }
+ let testSeconds = self.defaults.integer(forKey: Keys.privateAIIdleUnloadTestSeconds)
+ return testSeconds > 0 ? .seconds(testSeconds) : delay
+ }
+
/// Experimental. `.never` by default: the model stays loaded as before.
var privateAIIdleUnload: PrivateAIIdleUnload {
get { PrivateAIIdleUnload(rawValue: self.defaults.integer(forKey: Keys.privateAIIdleUnloadMinutes)) ?? .never }
@@ -5681,6 +5690,7 @@ private extension SettingsStore {
static let privateAIPrefixKVCacheEnabled = "PrivateAIProviderPrefixKVCacheEnabled"
static let privateAIBoostEnabled = "PrivateAIProviderBoostEnabled"
static let privateAIIdleUnloadMinutes = "PrivateAIProviderIdleUnloadMinutes"
+ static let privateAIIdleUnloadTestSeconds = "PrivateAIProviderIdleUnloadTestSeconds"
static let privateAIBackendPreference = SettingsStore.privateAIBackendPreferenceDefaultsKey
static let privateAIContextTokenLimit = "PrivateAIProviderContextTokenLimit"
static let privateAIContextDefaultMigratedTo4K = "PrivateAIProviderContextDefaultMigratedTo4K"
diff --git a/Sources/Fluid/Services/PrivateAIIntegrationService.swift b/Sources/Fluid/Services/PrivateAIIntegrationService.swift
index d519dda9..7631a513 100644
--- a/Sources/Fluid/Services/PrivateAIIntegrationService.swift
+++ b/Sources/Fluid/Services/PrivateAIIntegrationService.swift
@@ -240,7 +240,7 @@ actor PrivateAIIntegrationService {
/// Experimental: gives the model's memory back after a quiet period. The
/// next dictation reloads it while the user is still speaking.
nonisolated static let idleUnloader = PrivateAIIdleUnloader(
- delay: { await MainActor.run { SettingsStore.shared.privateAIIdleUnload.delay } },
+ delay: { await MainActor.run { SettingsStore.shared.privateAIIdleUnloadDelay } },
isBusy: { await MainActor.run { AppServices.shared.asr.isRunningOrStarting } },
unload: { await PrivateAIIntegrationService.shared.unloadCachedRuntime(reason: "idle") }
)