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(fi): remove obsolete mlx migration
altic-dev7a5ff67b9fcb
diff --git a/Sources/Fluid/AppDelegate.swift b/Sources/Fluid/AppDelegate.swiftindex b674e888..c379d2b9 100644--- a/Sources/Fluid/AppDelegate.swift+++ b/Sources/Fluid/AppDelegate.swift@@ -18,7 +18,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDeleprivate var shouldSuppressNextReopenActivation = falseprivate var wasLaunchedAsLoginItem = falseprivate var analyticsActivationSuppressionDeadline: Date?- private var hasDeferredMLXUpgradeOffer = falsevar shouldPresentStartupMicrophoneNotice: Bool {!self.wasLaunchedAsLoginItem || SettingsStore.shared.showMainWindowAtLoginLaunch@@ -41,7 +40,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele// Initialize app settings (dock visibility, etc.)SettingsStore.shared.initializeAppSettings()- let shouldOfferMLXUpgrade = PrivateAIMLXUpgradeCoordinator.prepareOfferIfNeeded()LocalAPIServer.shared.start()// Record first-open synchronously before async analytics bootstrap so@@ -60,14 +58,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele// Login Items can launch hidden; reveal the real SwiftUI window so ContentView startup runs.self.openMainWindowOnLaunch()- if shouldOfferMLXUpgrade {- if self.wasLaunchedAsLoginItem, !SettingsStore.shared.showMainWindowAtLoginLaunch {- self.hasDeferredMLXUpgradeOffer = true- } else {- self.scheduleMLXUpgradeOffer()- }- }-// Note: App UI is designed with dark color scheme in mind// All gradients and effects are optimized for dark mode}@@ -141,10 +131,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDeleself.analyticsActivationSuppressionDeadline = nilAnalyticsService.shared.recordAppActivity()}- if self.hasDeferredMLXUpgradeOffer {- self.hasDeferredMLXUpgradeOffer = false- self.scheduleMLXUpgradeOffer()- }}func userNotificationCenter(@@ -228,30 +214,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele}}- private func scheduleMLXUpgradeOffer() {- DispatchQueue.main.asyncAfter(deadline: .now() + 1.2) { [weak self] in- self?.showMLXUpgradeOffer()- }- }-- @MainActor- private func showMLXUpgradeOffer() {- let alert = NSAlert()- alert.messageText = "Fluid-1 is now 2.2x faster"- alert.informativeText = "A new 3.77 GB MLX model is available for Apple silicon. Continue to AI Providers to download and verify it. Your current slower model will keep working unless you choose to upgrade."- alert.alertStyle = .informational- alert.addButton(withTitle: "Continue to Download")- alert.addButton(withTitle: "Keep Current Model")-- if alert.runModal() == .alertFirstButtonReturn {- PrivateAIMLXUpgradeCoordinator.beginUpgrade()- AppNavigationRouter.shared.request(.aiEnhancements)- self.bringMainWindowToFront()- } else {- PrivateAIMLXUpgradeCoordinator.keepCurrentModel()- }- }-/// Realize the main window invisibly so ContentView's startup runs, then order it out./// Used for login-item launches when "Show window when launched at login" is off.@discardableResultdiff --git a/Sources/Fluid/Services/PrivateAIIntegrationService.swift b/Sources/Fluid/Services/PrivateAIIntegrationService.swiftindex 25526846..f1797bba 100644--- a/Sources/Fluid/Services/PrivateAIIntegrationService.swift+++ b/Sources/Fluid/Services/PrivateAIIntegrationService.swift@@ -1,188 +1,5 @@import Foundation-enum PrivateAIMLXUpgradeCoordinator {- private static let offerVersion = "1.6.3"- private static let offerHandledKey = "FluidIntelligenceMLXUpgrade163OfferHandled"- private static let offerPreparedKey = "FluidIntelligenceMLXUpgrade163OfferPrepared"- private static let upgradePendingKey = "FluidIntelligenceMLXUpgrade163Pending"- private static let previousVerificationKey = "FluidIntelligenceMLXUpgrade163PreviousVerification"- private static let legacyLlamaFilenames = ["fluid-1-q4_k_m.gguf", "Fluid-1-Q4_K_M.gguf"]-- static func prepareOfferIfNeeded(- settings: SettingsStore = .shared,- defaults: UserDefaults = .standard,- modelDirectoryURL: URL = PrivateAIIntegrationService.modelDirectoryURL,- isAppleSilicon: Bool = CPUArchitecture.isAppleSilicon,- appVersion: String = Bundle.main.object(- forInfoDictionaryKey: "CFBundleShortVersionString"- ) as? String ?? ""- ) -> Bool {- if defaults.bool(forKey: self.upgradePendingKey) {- self.restorePreviousLlama(settings: settings, defaults: defaults)- return false- }-- guard appVersion == self.offerVersion else {- defaults.set(false, forKey: self.offerPreparedKey)- return false- }-- if defaults.bool(forKey: self.offerPreparedKey),- !defaults.bool(forKey: self.offerHandledKey)- {- let rawBackend = defaults.string(forKey: SettingsStore.privateAIBackendPreferenceDefaultsKey)- guard self.shouldResumePreparedOffer(- hasPrivateProvider: PrivateFeatures.privateAIProvider,- isAppleSilicon: isAppleSilicon,- appVersion: appVersion,- backendPreference: rawBackend.flatMap(SettingsStore.PrivateAIBackendPreference.init(rawValue:)),- hasLegacyLlamaModel: self.hasLegacyLlamaModel(in: modelDirectoryURL),- hasMLXModel: PrivateAIIntegrationService.hasInactiveInstalledModel(- keeping: PrivateAIModelRegistry.defaultModel- )- ) else {- defaults.set(false, forKey: self.offerPreparedKey)- return false- }-- settings.privateAIBackendPreference = .llama- self.migrateLegacyVerificationToLlama(settings: settings)- return true- }-- guard self.shouldOffer(- hasPrivateProvider: PrivateFeatures.privateAIProvider,- isAppleSilicon: isAppleSilicon,- appVersion: appVersion,- backendPreferenceWasSet: defaults.object(- forKey: SettingsStore.privateAIBackendPreferenceDefaultsKey- ) != nil,- hasLegacyLlamaModel: self.hasLegacyLlamaModel(in: modelDirectoryURL),- hasMLXModel: PrivateAIIntegrationService.isModelInstalled(PrivateAIModelRegistry.defaultModel),- offerWasHandled: defaults.bool(forKey: self.offerHandledKey)- ) else {- return false- }-- settings.privateAIBackendPreference = .llama- self.migrateLegacyVerificationToLlama(settings: settings)- defaults.set(true, forKey: self.offerPreparedKey)- return true- }-- static func beginUpgrade(- settings: SettingsStore = .shared,- defaults: UserDefaults = .standard- ) {- let key = self.privateProviderKey- if let verification = settings.verifiedProviderFingerprints[key] {- defaults.set(verification, forKey: self.previousVerificationKey)- } else {- defaults.removeObject(forKey: self.previousVerificationKey)- }-- defaults.set(true, forKey: self.offerHandledKey)- defaults.set(false, forKey: self.offerPreparedKey)- defaults.set(true, forKey: self.upgradePendingKey)- settings.privateAIBackendPreference = .mlx- settings.verifiedProviderFingerprints.removeValue(forKey: key)- defaults.removeObject(forKey: PrivateAIIntegrationService.localModelPathDefaultsKey)- }-- static func keepCurrentModel(defaults: UserDefaults = .standard) {- defaults.set(true, forKey: self.offerHandledKey)- defaults.set(false, forKey: self.offerPreparedKey)- defaults.set(false, forKey: self.upgradePendingKey)- defaults.removeObject(forKey: self.previousVerificationKey)- }-- static func completeUpgrade(defaults: UserDefaults = .standard) {- defaults.set(false, forKey: self.upgradePendingKey)- defaults.removeObject(forKey: self.previousVerificationKey)- }-- static func restorePreviousLlama(- settings: SettingsStore = .shared,- defaults: UserDefaults = .standard- ) {- settings.privateAIBackendPreference = .llama- var fingerprints = settings.verifiedProviderFingerprints- if let verification = defaults.string(forKey: self.previousVerificationKey), !verification.isEmpty {- fingerprints[self.privateProviderKey] = verification- } else {- fingerprints.removeValue(forKey: self.privateProviderKey)- }- settings.verifiedProviderFingerprints = fingerprints- defaults.set(false, forKey: self.upgradePendingKey)- defaults.removeObject(forKey: self.previousVerificationKey)- defaults.removeObject(forKey: PrivateAIIntegrationService.localModelPathDefaultsKey)- }-- static func isUpgradePending(defaults: UserDefaults = .standard) -> Bool {- defaults.bool(forKey: self.upgradePendingKey)- }-- static func shouldOffer(- hasPrivateProvider: Bool,- isAppleSilicon: Bool,- appVersion: String,- backendPreferenceWasSet: Bool,- hasLegacyLlamaModel: Bool,- hasMLXModel: Bool,- offerWasHandled: Bool- ) -> Bool {- hasPrivateProvider &&- isAppleSilicon &&- appVersion == self.offerVersion &&- !backendPreferenceWasSet &&- hasLegacyLlamaModel &&- !hasMLXModel &&- !offerWasHandled- }-- static func shouldResumePreparedOffer(- hasPrivateProvider: Bool,- isAppleSilicon: Bool,- appVersion: String,- backendPreference: SettingsStore.PrivateAIBackendPreference?,- hasLegacyLlamaModel: Bool,- hasMLXModel: Bool- ) -> Bool {- hasPrivateProvider &&- isAppleSilicon &&- appVersion == self.offerVersion &&- backendPreference == .llama &&- hasLegacyLlamaModel &&- !hasMLXModel- }-- private static var privateProviderKey: String {- let providerID = PrivateAIProviderFeature.shared.providerID- if ModelRepository.shared.isBuiltIn(providerID) || providerID.hasPrefix("custom:") {- return providerID- }- return "custom:\(providerID)"- }-- private static func hasLegacyLlamaModel(in directoryURL: URL) -> Bool {- self.legacyLlamaFilenames.contains {- FileManager.default.fileExists(atPath: directoryURL.appendingPathComponent($0).path)- }- }-- private static func migrateLegacyVerificationToLlama(settings: SettingsStore) {- let key = self.privateProviderKey- let legacyFingerprint = "private-ai-provider|\(PrivateAIProviderFeature.shared.defaultModelID)"- guard settings.verifiedProviderFingerprints[key] == legacyFingerprint else { return }-- var fingerprints = settings.verifiedProviderFingerprints- fingerprints[key] = PrivateAIProviderFeature.verificationFingerprint(- for: PrivateAIProviderFeature.shared.defaultModelID- )- settings.verifiedProviderFingerprints = fingerprints- }-}-actor PrivateAIIntegrationService {static let shared = PrivateAIIntegrationService()@@ -347,7 +164,6 @@ actor PrivateAIIntegrationService {let status = try await Self.provider.loadModel(model)guard status.state == .ready else { return status }- guard !PrivateAIMLXUpgradeCoordinator.isUpgradePending() else { return status }await self.removeInactiveInstalledModels(keeping: model)return status}diff --git a/Sources/Fluid/UI/AISettings/AIEnhancementSettingsView.swift b/Sources/Fluid/UI/AISettings/AIEnhancementSettingsView.swiftindex 6d1aa31b..88873b31 100644--- a/Sources/Fluid/UI/AISettings/AIEnhancementSettingsView.swift+++ b/Sources/Fluid/UI/AISettings/AIEnhancementSettingsView.swift@@ -100,10 +100,6 @@ struct AIEnhancementSettingsView: View {self.viewModel.onAppear()self.privateAISelectedModelID = PrivateAIIntegrationService.configuredModelIDself.refreshPrivateAILoadState()- if PrivateAIMLXUpgradeCoordinator.isUpgradePending() {- self.selectedConfigurationSection = .providers- self.expandedProviderID = PrivateAIProviderFeature.shared.providerID- }}.onChange(of: self.viewModel.connectionStatus) { oldValue, newValue inif oldValue == .success && newValue != .success {diff --git a/Sources/Fluid/UI/AISettingsView+AIConfiguration.swift b/Sources/Fluid/UI/AISettingsView+AIConfiguration.swiftindex 72248ecc..1b1cd518 100644--- a/Sources/Fluid/UI/AISettingsView+AIConfiguration.swift+++ b/Sources/Fluid/UI/AISettingsView+AIConfiguration.swift@@ -965,41 +965,23 @@ extension AIEnhancementSettingsView {guard self.privateAISelectedModelID == model.id else { return }if verified {self.privateAILoadState = .loaded(modelID: model.id, latencyMilliseconds: latencyMilliseconds)- if PrivateAIMLXUpgradeCoordinator.isUpgradePending() {- PrivateAIMLXUpgradeCoordinator.completeUpgrade()- await PrivateAIIntegrationService.shared.removeInactiveInstalledModels(keeping: model)- }} else {let message = self.viewModel.connectionErrorMessage.isEmpty? "Model downloaded, but verification failed.": self.viewModel.connectionErrorMessage- self.restoreLlamaAfterFailedMLXUpgrade(message: message, modelID: model.id)+ self.privateAILoadState = .failed(modelID: model.id, message: message)}} catch {guard self.privateAISelectedModelID == model.id else { return }- self.restoreLlamaAfterFailedMLXUpgrade(- message: Self.errorMessage(for: error),- modelID: model.id+ self.privateAILoadState = .failed(+ modelID: model.id,+ message: Self.errorMessage(for: error))}self.viewModel.refreshProviderItems()}}- private func restoreLlamaAfterFailedMLXUpgrade(message: String, modelID: String) {- guard PrivateAIMLXUpgradeCoordinator.isUpgradePending() else {- self.privateAILoadState = .failed(modelID: modelID, message: message)- return- }-- PrivateAIMLXUpgradeCoordinator.restorePreviousLlama()- self.viewModel.onAppear()- self.privateAILoadState = .failed(- modelID: modelID,- message: "MLX upgrade failed. Your previous llama.cpp model is still active. \(message)"- )- }-private func verifyPrivateAIConnection(_ model: PrivateAIRegisteredModel) {self.privateAILoadState = .loading(modelID: model.id)Task { @MainActor indiff --git a/Tests/FluidDictationIntegrationTests/DictationE2ETests.swift b/Tests/FluidDictationIntegrationTests/DictationE2ETests.swiftindex 641ecca6..99206d98 100644--- a/Tests/FluidDictationIntegrationTests/DictationE2ETests.swift+++ b/Tests/FluidDictationIntegrationTests/DictationE2ETests.swift@@ -1882,106 +1882,6 @@ final class DictationE2ETests: XCTestCase {}}- func testMLXUpgradeOfferOnlyTargetsLegacyAppleSiliconInstalls() {- let eligible = PrivateAIMLXUpgradeCoordinator.shouldOffer(- hasPrivateProvider: true,- isAppleSilicon: true,- appVersion: "1.6.3",- backendPreferenceWasSet: false,- hasLegacyLlamaModel: true,- hasMLXModel: false,- offerWasHandled: false- )- XCTAssertTrue(eligible)-- XCTAssertFalse(PrivateAIMLXUpgradeCoordinator.shouldOffer(- hasPrivateProvider: true,- isAppleSilicon: false,- appVersion: "1.6.3",- backendPreferenceWasSet: false,- hasLegacyLlamaModel: true,- hasMLXModel: false,- offerWasHandled: false- ))- XCTAssertFalse(PrivateAIMLXUpgradeCoordinator.shouldOffer(- hasPrivateProvider: true,- isAppleSilicon: true,- appVersion: "1.6.3",- backendPreferenceWasSet: true,- hasLegacyLlamaModel: true,- hasMLXModel: false,- offerWasHandled: false- ))- XCTAssertFalse(PrivateAIMLXUpgradeCoordinator.shouldOffer(- hasPrivateProvider: true,- isAppleSilicon: true,- appVersion: "1.6.3",- backendPreferenceWasSet: false,- hasLegacyLlamaModel: false,- hasMLXModel: false,- offerWasHandled: false- ))- XCTAssertFalse(PrivateAIMLXUpgradeCoordinator.shouldOffer(- hasPrivateProvider: true,- isAppleSilicon: true,- appVersion: "1.6.3",- backendPreferenceWasSet: false,- hasLegacyLlamaModel: true,- hasMLXModel: true,- offerWasHandled: false- ))- XCTAssertFalse(PrivateAIMLXUpgradeCoordinator.shouldOffer(- hasPrivateProvider: true,- isAppleSilicon: true,- appVersion: "1.6.3",- backendPreferenceWasSet: false,- hasLegacyLlamaModel: true,- hasMLXModel: false,- offerWasHandled: true- ))- for version in ["1.6.2", "1.6.4", "2.0.0", ""] {- XCTAssertFalse(PrivateAIMLXUpgradeCoordinator.shouldOffer(- hasPrivateProvider: true,- isAppleSilicon: true,- appVersion: version,- backendPreferenceWasSet: false,- hasLegacyLlamaModel: true,- hasMLXModel: false,- offerWasHandled: false- ))- }- }-- func testMLXUpgradePreparedOfferIsRevalidatedBeforeResuming() {- XCTAssertTrue(PrivateAIMLXUpgradeCoordinator.shouldResumePreparedOffer(- hasPrivateProvider: true,- isAppleSilicon: true,- appVersion: "1.6.3",- backendPreference: .llama,- hasLegacyLlamaModel: true,- hasMLXModel: false- ))-- for state in [- (true, true, "1.6.3", SettingsStore.PrivateAIBackendPreference.mlx, true, false),- (true, true, "1.6.3", SettingsStore.PrivateAIBackendPreference.llama, false, false),- (true, true, "1.6.3", SettingsStore.PrivateAIBackendPreference.llama, true, true),- (true, true, "1.6.4", SettingsStore.PrivateAIBackendPreference.llama, true, false),- (true, false, "1.6.3", SettingsStore.PrivateAIBackendPreference.llama, true, false),- (false, true, "1.6.3", SettingsStore.PrivateAIBackendPreference.llama, true, false),- (true, true, "1.6.3", nil, true, false),- ] {- XCTAssertFalse(PrivateAIMLXUpgradeCoordinator.shouldResumePreparedOffer(- hasPrivateProvider: state.0,- isAppleSilicon: state.1,- appVersion: state.2,- backendPreference: state.3,- hasLegacyLlamaModel: state.4,- hasMLXModel: state.5- ))- }- }-func testPrivateAIProviderDoesNotConfigureCommandMode() {guard PrivateFeatures.privateAIProvider else { return }