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
refactor: split monolithic ContentView and revamp UI
altic-dev64501b10b99b
diff --git a/Sources/Fluid/ContentView.swift b/Sources/Fluid/ContentView.swiftindex 756ed1d5..337f1536 100644--- a/Sources/Fluid/ContentView.swift+++ b/Sources/Fluid/ContentView.swift@@ -23,10 +23,10 @@ import CoreGraphicsenum SidebarItem: Hashable {case welcome- case recording- case aiProcessing- case settings+ case aiSettings+ case preferencescase meetingTools+ case statscase feedback}@@ -92,7 +92,7 @@ struct ContentView: View {@FocusState private var isTranscriptionFocused: Bool@State private var selectedSidebarItem: SidebarItem? = .welcome- @State private var playgroundUsed: Bool = false+ @State private var playgroundUsed: Bool = SettingsStore.shared.playgroundUsed@State private var recordingAppInfo: (name: String, bundleId: String, windowTitle: String)? = nil// Audio Settings Tab State@@ -156,6 +156,7 @@ struct ContentView: View {@State private var showAPIKeyEditor: Bool = false@State private var newProviderBaseURL: String = ""@State private var keyJustSaved: Bool = false+ @State private var showAPIKeysGuide: Bool = false// Feedback State@State private var feedbackText: String = ""@@ -475,24 +476,24 @@ struct ContentView: View {Label("Welcome", systemImage: "house.fill").font(.system(size: 15, weight: .medium))}-- NavigationLink(value: SidebarItem.recording) {- Label("Recording", systemImage: "mic.fill")- .font(.system(size: 15, weight: .medium))- }- NavigationLink(value: SidebarItem.aiProcessing) {- Label("AI Processing", systemImage: "sparkles")+ NavigationLink(value: SidebarItem.aiSettings) {+ Label("AI Settings", systemImage: "sparkles").font(.system(size: 15, weight: .medium))}- NavigationLink(value: SidebarItem.settings) {- Label("Settings", systemImage: "gearshape.fill")+ NavigationLink(value: SidebarItem.preferences) {+ Label("Preferences", systemImage: "gearshape.fill").font(.system(size: 15, weight: .medium))}NavigationLink(value: SidebarItem.meetingTools) {- Label("Meeting Tools", systemImage: "person.2.wave.2.fill")+ Label("File Transcription", systemImage: "doc.text.fill")+ .font(.system(size: 15, weight: .medium))+ }++ NavigationLink(value: SidebarItem.stats) {+ Label("Stats", systemImage: "chart.bar.fill").font(.system(size: 15, weight: .medium))}@@ -527,14 +528,14 @@ struct ContentView: View {switch selectedSidebarItem ?? .welcome {case .welcome:welcomeView- case .recording:- recordingView- case .aiProcessing:- aiProcessingView- case .settings:- settingsView+ case .aiSettings:+ aiSettingsView+ case .preferences:+ preferencesViewcase .meetingTools:meetingToolsView+ case .stats:+ statsViewcase .feedback:feedbackView}@@ -548,6 +549,7 @@ struct ContentView: View {WelcomeView(asr: asr,selectedSidebarItem: $selectedSidebarItem,+ playgroundUsed: $playgroundUsed,isTranscriptionFocused: $isTranscriptionFocused,accessibilityEnabled: accessibilityEnabled,providerAPIKeys: providerAPIKeys,@@ -555,10 +557,10 @@ struct ContentView: View {openAIBaseURL: openAIBaseURL,availableModels: availableModels,selectedModel: selectedModel,- playgroundUsed: playgroundUsed,stopAndProcessTranscription: { await stopAndProcessTranscription() },startRecording: startRecording,- isLocalEndpoint: isLocalEndpoint+ isLocalEndpoint: isLocalEndpoint,+ openAccessibilitySettings: openAccessibilitySettings)}@@ -666,8 +668,8 @@ struct ContentView: View {}}- // MARK: - Settings View- private var settingsView: some View {+ // MARK: - Preferences View+ private var preferencesView: some View {SettingsView(asr: asr,appear: $appear,@@ -677,15 +679,6 @@ struct ContentView: View {selectedOutputUID: $selectedOutputUID,inputDevices: $inputDevices,outputDevices: $outputDevices,- startRecording: startRecording,- refreshDevices: refreshDevices- )- }-- private var recordingView: some View {- RecordingView(- asr: asr,- appear: $appear,accessibilityEnabled: $accessibilityEnabled,hotkeyShortcut: $hotkeyShortcut,isRecordingShortcut: $isRecordingShortcut,@@ -695,930 +688,535 @@ struct ContentView: View {copyToClipboard: $copyToClipboard,hotkeyManager: hotkeyManager,menuBarManager: menuBarManager,- stopAndProcessTranscription: { await stopAndProcessTranscription() },startRecording: startRecording,- downloadModels: { await downloadModels() },- deleteModels: { await deleteModels() },+ refreshDevices: refreshDevices,openAccessibilitySettings: openAccessibilitySettings,restartApp: restartApp,revealAppInFinder: revealAppInFinder,- openApplicationsFolder: openApplicationsFolder,- getModelStatusText: getModelStatusText,- labelFor: labelFor+ openApplicationsFolder: openApplicationsFolder)}-- // MARK: - OLD Recording View (To Remove Later)- private var _oldRecordingView: some View {++ private var recordingView: some View {+ RecordingView(+ asr: asr,+ appear: $appear,+ stopAndProcessTranscription: { await stopAndProcessTranscription() },+ startRecording: startRecording+ )+ }++ // MARK: - AI Settings Tab+ private var aiSettingsView: some View {ScrollView(.vertical, showsIndicators: false) {- VStack(spacing: 24) {- // Hero Header Card- ThemedCard(style: .standard) {- VStack(spacing: 16) {+ VStack(alignment: .leading, spacing: 16) {+ // Voice to Text Model Card+ ThemedCard(hoverEffect: false) {+ VStack(alignment: .leading, spacing: 10) {HStack {- Image(systemName: "waveform.circle.fill")- .font(.system(size: 32))+ Image(systemName: "brain.head.profile")+ .font(.title2).foregroundStyle(.white)-- VStack(alignment: .leading, spacing: 4) {- Text("Voice Dictation")- .font(.title2)- .fontWeight(.bold)- Text("AI-powered speech recognition")- .font(.subheadline)- .foregroundStyle(.secondary)- }-- Spacer()+ Text("Voice to Text Model")+ .font(.title3)+ .fontWeight(.semibold)}-- // Status and Recording Control- VStack(spacing: 12) {- // Status indicator- HStack {- Circle()- .fill(asr.isRunning ? .red : asr.isAsrReady ? .green : .secondary)- .frame(width: 8, height: 8)-- Text(asr.isRunning ? "Recording..." : asr.isAsrReady ? "Ready to record" : "Model not ready")- .font(.subheadline)- .foregroundStyle(asr.isRunning ? .red : asr.isAsrReady ? .green : .secondary)++ VStack(alignment: .leading, spacing: 10) {+ HStack(spacing: 12) {+ Text("Model")+ .fontWeight(.medium)+ Spacer()+ Menu(asr.selectedModel.displayName) {+ ForEach(ASRService.ModelOption.allCases) { option in+ Button(option.displayName) { asr.selectedModel = option }+ }+ }+ .disabled(asr.isRunning)}- // Recording Control (Single Toggle Button)- Button(action: {- if asr.isRunning {- Task {- await stopAndProcessTranscription()+ // Model status indicator with action buttons+ HStack(spacing: 12) {+ if asr.isDownloadingModel {+ HStack(spacing: 8) {+ ProgressView()+ .controlSize(.small)+ Text("Downloading…")+ .font(.caption)+ .foregroundStyle(.secondary)+ }+ } else if asr.isAsrReady {+ Image(systemName: "checkmark.circle.fill")+ .foregroundStyle(.green)+ .font(.caption)++ Button(action: {+ Task { await deleteModels() }+ }) {+ HStack(spacing: 4) {+ Image(systemName: "trash")+ Text("Delete")+ }+ .font(.caption)+ .foregroundStyle(.red)+ }+ .buttonStyle(.plain)+ .help("Delete downloaded models (~500MB)")+ } else if asr.modelsExistOnDisk {+ Image(systemName: "doc.fill")+ .foregroundStyle(theme.palette.accent)+ .font(.caption)++ Button(action: {+ Task { await deleteModels() }+ }) {+ HStack(spacing: 4) {+ Image(systemName: "trash")+ Text("Delete")+ }+ .font(.caption)+ .foregroundStyle(.red)}+ .buttonStyle(.plain)+ .help("Delete downloaded models (~500MB)")} else {- startRecording()- }- }) {- HStack {- Image(systemName: asr.isRunning ? "stop.fill" : "mic.fill")- .font(.system(size: 16, weight: .semibold))- Text(asr.isRunning ? "Stop Recording" : "Start Recording")+ Image(systemName: "arrow.down.circle")+ .foregroundStyle(.orange)+ .font(.caption)++ Button(action: {+ Task { await downloadModels() }+ }) {+ HStack(spacing: 4) {+ Image(systemName: "arrow.down.circle.fill")+ Text("Download")+ }+ .font(.caption)+ .foregroundStyle(theme.palette.accent)+ }+ .buttonStyle(.plain)+ .help("Download ASR models (~500MB)")}- .frame(maxWidth: .infinity)}- .buttonStyle(PremiumButtonStyle(isRecording: asr.isRunning))- .buttonHoverEffect()- .scaleEffect(asr.isRunning ? 1.05 : 1.0)- .animation(.spring(response: 0.3), value: asr.isRunning)- .disabled(!asr.isAsrReady && !asr.isRunning)- }- }- .padding(24)- }- .modifier(CardAppearAnimation(delay: 0.1, appear: $appear))+ .padding(.horizontal, 12)+ .padding(.vertical, 8)+ .background(+ RoundedRectangle(cornerRadius: 8)+ .fill(.ultraThinMaterial.opacity(0.3))+ .overlay(+ RoundedRectangle(cornerRadius: 8)+ .stroke(.white.opacity(0.1), lineWidth: 1)+ )+ )++ // Download warning message+ if asr.isDownloadingModel {+ Text("Download might take a while...")+ .font(.caption2)+ .foregroundStyle(.secondary)+ .padding(.leading, 4)+ }- // Permissions Card- ThemedCard(style: .standard) {- VStack(alignment: .leading, spacing: 16) {- HStack {- Image(systemName: "shield.checkered")- .font(.title2)- .foregroundStyle(.white)- Text("Permissions")- .font(.title3)- .fontWeight(.semibold)+ // Helpful link: Supported languages+ HStack(alignment: .firstTextBaseline, spacing: 8) {+ Image(systemName: "link")+ .foregroundStyle(.secondary)+ Link(+ "Supported languages",+ destination: URL(string: "https://huggingface.co/nvidia/parakeet-tdt-0.6b-v3")!+ )+ }+ .font(.caption)+ .foregroundStyle(.secondary)}-- microphonePermissionView}- .padding(24)+ .padding(20)}- .modifier(CardAppearAnimation(delay: 0.2, appear: $appear))-- // Model Configuration Card (disable hover transforms to avoid AppKit constraint logs)- ThemedCard(hoverEffect: false) {- VStack(alignment: .leading, spacing: 16) {++ aiConfigurationCard+ }+ .padding(16)+ }+ .onAppear {+ // Ensure the toggle reflects persisted value when navigating between tabs+ enableAIProcessing = SettingsStore.shared.enableAIProcessing+ }+ }++ private var aiConfigurationCard: some View {+ VStack(spacing: 16) {+ // API Configuration Section+ ThemedCard(style: .prominent, hoverEffect: false) {+ VStack(alignment: .leading, spacing: 14) {HStack {- Image(systemName: "brain.head.profile")- .font(.title2)- .foregroundStyle(.white)- Text("Voice to Text Model")+ Image(systemName: "key.fill").font(.title3)+ .foregroundStyle(theme.palette.accent)+ Text("API Configuration")+ .font(.headline).fontWeight(.semibold)++ Spacer()++ Button(action: { showHelp.toggle() }) {+ Image(systemName: showHelp ? "questionmark.circle.fill" : "questionmark.circle")+ .font(.system(size: 20))+ .foregroundStyle(theme.palette.accent.opacity(0.8))+ }+ .buttonStyle(.plain)+ .buttonHoverEffect()}- VStack(alignment: .leading, spacing: 12) {- HStack(spacing: 12) {- Text("Model")- .fontWeight(.medium)- Spacer()- Menu(asr.selectedModel.displayName) {- ForEach(ASRService.ModelOption.allCases) { option in- Button(option.displayName) { asr.selectedModel = option }- }- }- .disabled(asr.isRunning)+ Divider()+ .padding(.vertical, 4)++ // AI Enhancement Toggle - Aligned with Grid below+ HStack(alignment: .top, spacing: 16) {+ VStack(alignment: .leading, spacing: 4) {+ Text("Enable AI Enhancement")+ .font(.system(size: 15, weight: .semibold))+ .foregroundStyle(theme.palette.primaryText)++ Text("Automatically enhance transcriptions with AI")+ .font(.system(size: 13))+ .foregroundStyle(theme.palette.secondaryText)}- Text(getModelStatusText())- .font(.caption)- .foregroundStyle(asr.isAsrReady ? .white : .secondary)- .padding(.leading, 4)+ Spacer()- Text("Automatically detects and transcribes 25 European languages")- .font(.caption)- .foregroundStyle(.secondary)- .padding(.leading, 4)+ Toggle("", isOn: $enableAIProcessing)+ .toggleStyle(.switch)+ .labelsHidden()+ .onChange(of: enableAIProcessing) { newValue in+ SettingsStore.shared.enableAIProcessing = newValue+ }+ }+ .padding(.horizontal, 4)++ // API Key Warning+ if enableAIProcessing &&+ !isLocalEndpoint(openAIBaseURL.trimmingCharacters(in: .whitespacesAndNewlines)) &&+ (providerAPIKeys[currentProvider] ?? "").trimmingCharacters(in: CharacterSet.whitespacesAndNewlines).isEmpty {+ HStack(spacing: 10) {+ Image(systemName: "exclamationmark.triangle.fill")+ .foregroundStyle(.orange)+ .font(.system(size: 16))++ Text("API key required for AI enhancement to work")+ .font(.system(size: 13, weight: .medium))+ .foregroundStyle(.orange)++ Spacer()+ }+ .padding(12)+ .background(.orange.opacity(0.12))+ .clipShape(RoundedRectangle(cornerRadius: 8))+ .overlay(+ RoundedRectangle(cornerRadius: 8)+ .stroke(.orange.opacity(0.3), lineWidth: 1)+ )+ .padding(.horizontal, 4)+ }- // Model status indicator with action buttons- HStack(spacing: 12) {- if asr.isDownloadingModel {- HStack(spacing: 8) {- ProgressView()- .controlSize(.small)- Text("Downloading Model…")+ // Help Section+ if showHelp {+ VStack(alignment: .leading, spacing: 12) {+ HStack {+ Image(systemName: "lightbulb.fill")+ .foregroundStyle(.yellow)+ Text("Quick Start Guide")+ .font(.subheadline)+ .fontWeight(.semibold)+ }++ VStack(alignment: .leading, spacing: 6) {+ HStack(alignment: .top, spacing: 8) {+ Text("1.")+ .font(.caption)+ .fontWeight(.semibold)+ .frame(width: 16, alignment: .trailing)+ Text("Enable AI enhancement if needed").font(.caption).foregroundStyle(.secondary)}- } else if asr.isAsrReady {- HStack(spacing: 8) {- Image(systemName: "checkmark.circle.fill")- .foregroundStyle(.green)- Text("Model Ready")++ HStack(alignment: .top, spacing: 8) {+ Text("2.").font(.caption)- .fontWeight(.medium)- .foregroundStyle(.white)- }-- Button(action: {- Task { await deleteModels() }- }) {- HStack(spacing: 4) {- Image(systemName: "trash")- Text("Delete")- }- .font(.caption)- .foregroundStyle(.red)+ .fontWeight(.semibold)+ .frame(width: 16, alignment: .trailing)+ Text("Add/choose any provider of your choice along with its API key")+ .font(.caption)+ .foregroundStyle(.secondary)}- .buttonStyle(.plain)- .help("Delete downloaded models (~500MB)")- } else if asr.modelsExistOnDisk {- HStack(spacing: 8) {- Image(systemName: "doc.fill")- .foregroundStyle(theme.palette.accent)- Text("Models on Disk (Not Loaded)")++ HStack(alignment: .top, spacing: 8) {+ Text("3.")+ .font(.caption)+ .fontWeight(.semibold)+ .frame(width: 16, alignment: .trailing)+ Text("Add/choose any good model of your liking").font(.caption).foregroundStyle(.secondary)}-- Button(action: {- Task { await deleteModels() }- }) {- HStack(spacing: 4) {- Image(systemName: "trash")- Text("Delete")- }- .font(.caption)- .foregroundStyle(.red)++ HStack(alignment: .top, spacing: 8) {+ Text("4.")+ .font(.caption)+ .fontWeight(.semibold)+ .frame(width: 16, alignment: .trailing)+ Text("If it's OpenAI compatible endpoint, then update the base URL")+ .font(.caption)+ .foregroundStyle(.secondary)}- .buttonStyle(.plain)- .help("Delete downloaded models (~500MB)")- } else {- HStack(spacing: 8) {- Image(systemName: "arrow.down.circle")- .foregroundStyle(.orange)- Text("Models Not Downloaded")++ HStack(alignment: .top, spacing: 8) {+ Text("5.")+ .font(.caption)+ .fontWeight(.semibold)+ .frame(width: 16, alignment: .trailing)+ Text("Once everything is set, click verify to check if the connection works").font(.caption).foregroundStyle(.secondary)}-- Button(action: {- Task { await downloadModels() }- }) {- HStack(spacing: 4) {- Image(systemName: "arrow.down.circle.fill")- Text("Download")- }- .font(.caption)- .foregroundStyle(theme.palette.accent)++ HStack(alignment: .top, spacing: 8) {+ Text("6.")+ .font(.caption)+ .fontWeight(.semibold)+ .frame(width: 16, alignment: .trailing)+ Text("Try something like \"Bullet point 1 - Apple, 2 - Orange, 3 - Banana\" and see AI write it perfectly")+ .font(.caption)+ .foregroundStyle(.secondary)}- .buttonStyle(.plain)- .help("Download ASR models (~500MB)")}}- .padding(.horizontal, 12)- .padding(.vertical, 8)- .background(- RoundedRectangle(cornerRadius: 8)- .fill(.ultraThinMaterial.opacity(0.3))- .overlay(- RoundedRectangle(cornerRadius: 8)- .stroke(.white.opacity(0.1), lineWidth: 1)- )+ .padding(16)+ .background(theme.palette.accent.opacity(0.08))+ .cornerRadius(12)+ .overlay(+ RoundedRectangle(cornerRadius: 12)+ .stroke(theme.palette.accent.opacity(0.2), lineWidth: 1))+ .padding(.horizontal, 4)+ .transition(.opacity)+ }++ Divider()+ .padding(.vertical, 4)- // Helpful link: Supported languages- HStack(alignment: .firstTextBaseline, spacing: 8) {- Image(systemName: "link")+ VStack(alignment: .leading, spacing: 12) {+ // Compatibility note+ HStack(spacing: 6) {+ Image(systemName: "checkmark.seal.fill")+ .font(.caption2)+ .foregroundStyle(theme.palette.accent)+ Text("Supports any OpenAI compatible API endpoints")+ .font(.caption).foregroundStyle(.secondary)- Link(- "Supported languages",- destination: URL(string: "https://huggingface.co/nvidia/parakeet-tdt-0.6b-v3")!- )}- .font(.caption)- .foregroundStyle(.secondary)-+ .padding(.horizontal, 4)- }- }- .padding(24)- }- .modifier(CardAppearAnimation(delay: 0.3, appear: $appear))--- // Global Hotkey Card- ThemedCard(style: .standard) {- VStack(alignment: .leading, spacing: 16) {- HStack {- Image(systemName: "keyboard")- .font(.title2)- .foregroundStyle(.white)- Text("Global Hotkey")- .font(.title3)- .fontWeight(.semibold)- }-- if accessibilityEnabled {- VStack(alignment: .leading, spacing: 16) {- // Current Hotkey Display- VStack(alignment: .leading, spacing: 8) {- Text("Current Hotkey")- .font(.subheadline)+ Divider()++ // Provider Row+ HStack(spacing: 12) {+ HStack {+ Text("Provider:").fontWeight(.medium)- .foregroundStyle(.secondary)-- // Hotkey Display Row- HStack(spacing: 16) {- // Clean Hotkey Display- HStack(spacing: 8) {- Text(hotkeyShortcut.displayString)- .font(.system(size: 16, weight: .semibold, design: .monospaced))- .foregroundStyle(.primary)- .padding(.horizontal, 12)- .padding(.vertical, 6)- .background(- RoundedRectangle(cornerRadius: 8)- .fill(.quaternary.opacity(0.5))- .overlay(- RoundedRectangle(cornerRadius: 8)- .stroke(.primary.opacity(0.2), lineWidth: 1)- )- )- }-- Spacer()-- // Enhanced Change Button- Button {- DebugLogger.shared.debug("Starting to record new shortcut", source: "ContentView")- isRecordingShortcut = true- } label: {- HStack(spacing: 8) {- Image(systemName: "pencil")- .font(.system(size: 13, weight: .semibold))- Text("Change")- .fontWeight(.semibold)- }+ }+ .frame(width: 90, alignment: .leading)+ .padding(.horizontal, 10)+ .padding(.vertical, 4)+ .background(+ LinearGradient(+ colors: [theme.palette.accent.opacity(0.15), theme.palette.accent.opacity(0.05)],+ startPoint: .leading,+ endPoint: .trailing+ )+ )+ .cornerRadius(6)++ Picker("", selection: $selectedProviderID) {+ Text("OpenAI").tag("openai")+ Text("Groq").tag("groq")++ if !savedProviders.isEmpty {+ Divider()+ ForEach(savedProviders) { provider in+ Text(provider.name).tag(provider.id)}- .buttonStyle(GlassButtonStyle())- .buttonHoverEffect()-- // Restart button for accessibility changes- if !hotkeyManagerInitialized && accessibilityEnabled {- Button {- DebugLogger.shared.debug("User requested app restart for accessibility changes", source: "ContentView")- restartApp()- } label: {- HStack(spacing: 6) {- Image(systemName: "arrow.clockwise.circle")- .font(.system(size: 12, weight: .semibold))- Text("Restart")- .font(.system(size: 12, weight: .semibold))- }- }- .buttonStyle(InlineButtonStyle())- .buttonHoverEffect()- }}}-- // Enhanced Status/Instruction Text- HStack(spacing: 10) {- if isRecordingShortcut {- Image(systemName: "hand.point.up.left.fill")- .foregroundStyle(.white)- .font(.system(size: 16, weight: .medium))- Text("Press your new hotkey combination now...")- .font(.system(.subheadline, weight: .medium))- .foregroundStyle(.white)- } else if hotkeyManagerInitialized {- Image(systemName: "checkmark.circle.fill")- .foregroundStyle(.green)- .font(.system(size: 16))- VStack(alignment: .leading, spacing: 2) {- Text("Global Shortcut Active")- .font(.system(.caption, weight: .semibold))- .foregroundStyle(.white)- Text(pressAndHoldModeEnabled- ? "Hold \(hotkeyShortcut.displayString) to record and release to stop"- : "Press \(hotkeyShortcut.displayString) anywhere to start/stop recording")- .font(.system(.caption))- .foregroundStyle(.secondary)- }- } else {- ProgressView()- .scaleEffect(0.8)- .frame(width: 16, height: 16)- .foregroundStyle(.orange)- VStack(alignment: .leading, spacing: 2) {- Text("Hotkey Initializing...")- .font(.system(.caption, weight: .semibold))- .foregroundStyle(.orange)- Text("Please wait while the global hotkey system starts up")- .font(.system(.caption))- .foregroundStyle(.secondary)+ .pickerStyle(.menu)+ .labelsHidden()+ .frame(width: 200)+ .onChange(of: selectedProviderID) { newValue in+ switch newValue {+ case "openai":+ openAIBaseURL = "https://api.openai.com/v1"+ updateCurrentProvider()+ let key = "openai"+ if let stored = availableModelsByProvider[key], !stored.isEmpty { availableModels = stored }+ else { availableModels = defaultModels(for: key) }+ if let sel = selectedModelByProvider[key], availableModels.contains(sel) { selectedModel = sel }+ else { selectedModel = availableModels.first ?? selectedModel }+ case "groq":+ openAIBaseURL = "https://api.groq.com/openai/v1"+ updateCurrentProvider()+ let key = "groq"+ if let stored = availableModelsByProvider[key], !stored.isEmpty { availableModels = stored }+ else { availableModels = defaultModels(for: key) }+ if let sel = selectedModelByProvider[key], availableModels.contains(sel) { selectedModel = sel }+ else { selectedModel = availableModels.first ?? selectedModel }+ default:+ if let provider = savedProviders.first(where: { $0.id == newValue }) {+ openAIBaseURL = provider.baseURL+ updateCurrentProvider()+ providerAPIKeys[currentProvider] = provider.apiKey+ saveProviderAPIKeys()+ let key = providerKey(for: newValue)+ availableModels = provider.models.isEmpty ? (availableModelsByProvider[key] ?? defaultModels(for: key)) : provider.models+ if let sel = selectedModelByProvider[key], availableModels.contains(sel) { selectedModel = sel }+ else { selectedModel = availableModels.first ?? selectedModel }}}}- .padding(.horizontal, 12)- .padding(.vertical, 8)- .background(- RoundedRectangle(cornerRadius: 8)- .fill(.ultraThinMaterial.opacity(0.5))- .overlay(- RoundedRectangle(cornerRadius: 8)- .stroke(.white.opacity(0.1), lineWidth: 1)- )- )- VStack(alignment: .leading, spacing: 12) {- Toggle("Press and Hold Mode", isOn: $pressAndHoldModeEnabled)- .toggleStyle(GlassToggleStyle())- Text("When enabled, the shortcut only records while you hold it down, giving you quick push-to-talk style control.")- .font(.caption)- .foregroundStyle(.secondary)- }- .padding(.horizontal, 12)- .padding(.vertical, 10)- .background(- RoundedRectangle(cornerRadius: 8)- .fill(.ultraThinMaterial.opacity(0.5))- .overlay(- RoundedRectangle(cornerRadius: 8)- .stroke(.white.opacity(0.08), lineWidth: 1)- )- )- .onChange(of: pressAndHoldModeEnabled) { newValue in- SettingsStore.shared.pressAndHoldMode = newValue- hotkeyManager?.enablePressAndHoldMode(newValue)- }- VStack(alignment: .leading, spacing: 12) {- Toggle("Show Live Preview", isOn: $enableStreamingPreview)- .toggleStyle(GlassToggleStyle())- Text("Display transcription text in real-time in the overlay as you speak. When disabled, only the animation is shown.")- .font(.caption)- .foregroundStyle(.secondary)- }- .padding(.horizontal, 12)- .padding(.vertical, 10)- .background(- RoundedRectangle(cornerRadius: 8)- .fill(.ultraThinMaterial.opacity(0.5))- .overlay(- RoundedRectangle(cornerRadius: 8)- .stroke(.white.opacity(0.08), lineWidth: 1)- )- )- .onChange(of: enableStreamingPreview) { newValue in- SettingsStore.shared.enableStreamingPreview = newValue- // Dynamically resize overlay based on preview state (via MenuBarManager)- menuBarManager.updateOverlayPreviewSetting(newValue)- // Clear overlay text if disabled- if !newValue {- menuBarManager.updateOverlayTranscription("")+ // Always show delete button+ Button(action: {+ // Only delete if it's a custom provider+ if !selectedProviderID.isEmpty && selectedProviderID != "openai" && selectedProviderID != "groq" {+ savedProviders.removeAll { $0.id == selectedProviderID }+ saveSavedProviders()+ let key = providerKey(for: selectedProviderID)+ availableModelsByProvider.removeValue(forKey: key)+ selectedModelByProvider.removeValue(forKey: key)+ providerAPIKeys.removeValue(forKey: key)+ saveProviderAPIKeys()+ SettingsStore.shared.availableModelsByProvider = availableModelsByProvider+ SettingsStore.shared.selectedModelByProvider = selectedModelByProvider+ selectedProviderID = "openai"+ openAIBaseURL = "https://api.openai.com/v1"+ updateCurrentProvider()+ availableModels = defaultModels(for: "openai")+ selectedModel = availableModels.first ?? selectedModel+ }+ }) {+ HStack(spacing: 4) {+ Image(systemName: "trash")+ Text("Delete")}+ .font(.caption)+ .foregroundStyle(.red)}+ .buttonStyle(CompactButtonStyle())+ .buttonHoverEffect()+ .disabled(selectedProviderID == "openai" || selectedProviderID == "groq")- VStack(alignment: .leading, spacing: 12) {- Toggle("Copy to Clipboard", isOn: $copyToClipboard)- .toggleStyle(GlassToggleStyle())- Text("Automatically copy transcribed text to clipboard as a backup, useful when no text field is selected.")- .font(.caption)- .foregroundStyle(.secondary)- }- .padding(.horizontal, 12)- .padding(.vertical, 10)- .background(- RoundedRectangle(cornerRadius: 8)- .fill(.ultraThinMaterial.opacity(0.5))- .overlay(- RoundedRectangle(cornerRadius: 8)- .stroke(.white.opacity(0.08), lineWidth: 1)- )- )- .onChange(of: copyToClipboard) { newValue in- SettingsStore.shared.copyTranscriptionToClipboard = newValue+ Button("+ Add Provider") {+ showingSaveProvider = true+ newProviderName = ""+ newProviderBaseURL = ""+ newProviderApiKey = ""+ newProviderModels = ""}+ .buttonStyle(CompactButtonStyle())+ .buttonHoverEffect()}- } else {- VStack(alignment: .leading, spacing: 16) {++ // Base URL (for custom providers)+ if !["openai", "groq"].contains(selectedProviderID) {HStack(spacing: 12) {- // Status indicator- Circle()- .fill(theme.palette.warning)- .frame(width: 10, height: 10)-- VStack(alignment: .leading, spacing: 4) {- HStack {- Image(systemName: "exclamationmark.triangle.fill")- .foregroundStyle(theme.palette.warning)- Text("Accessibility permissions required")- .fontWeight(.medium)- .foregroundStyle(theme.palette.warning)- }- Text("Required for global hotkey functionality")- .font(.caption)- .foregroundStyle(.secondary)- }- Spacer()-- Button("Open Accessibility Settings") {- openAccessibilitySettings()- }- .buttonStyle(GlassButtonStyle())- .buttonHoverEffect()- }-- // Prominent step-by-step instructions- VStack(alignment: .leading, spacing: 12) {- HStack(spacing: 8) {- Image(systemName: "info.circle.fill")- .foregroundStyle(theme.palette.accent)- .font(.caption)- Text("Follow these steps to enable Accessibility:")- .font(.caption)+ HStack {+ Text("Base URL:").fontWeight(.medium)- .foregroundStyle(.secondary)- }-- VStack(alignment: .leading, spacing: 8) {- HStack(spacing: 8) {- Text("1.")- .font(.caption2)- .foregroundStyle(theme.palette.accent)- .fontWeight(.semibold)- .frame(width: 16)- Text("Click **Open Accessibility Settings** above")- .font(.caption)- .foregroundStyle(.primary)- }- HStack(spacing: 8) {- Text("2.")- .font(.caption2)- .foregroundStyle(theme.palette.accent)- .fontWeight(.semibold)- .frame(width: 16)- Text("In the Accessibility window, click the **+ button**")- .font(.caption)- .foregroundStyle(.primary)- }- HStack(spacing: 8) {- Text("3.")- .font(.caption2)- .foregroundStyle(theme.palette.accent)- .fontWeight(.semibold)- .frame(width: 16)- Text("Navigate to Applications and select **FluidVoice**")- .font(.caption)- .foregroundStyle(.primary)- }- HStack(spacing: 8) {- Text("4.")- .font(.caption2)- .foregroundStyle(theme.palette.accent)- .fontWeight(.semibold)- .frame(width: 16)- Text("Click **Open**, then toggle **FluidVoice ON** in the list")- .font(.caption)- .foregroundStyle(.primary)- }}- .padding(.leading, 4)+ .frame(width: 90, alignment: .leading)+ .padding(.horizontal, 10)+ .padding(.vertical, 4)+ .background(+ LinearGradient(+ colors: [theme.palette.accent.opacity(0.15), theme.palette.accent.opacity(0.05)],+ startPoint: .leading,+ endPoint: .trailing+ )+ )+ .cornerRadius(6)- // Helper buttons- HStack(spacing: 12) {- Button("Reveal FluidVoice in Finder") {- revealAppInFinder()- }- .buttonStyle(InlineButtonStyle())- .buttonHoverEffect()-- Button("Open Applications Folder") {- openApplicationsFolder()+ TextField("e.g., http://localhost:11434/v1", text: $openAIBaseURL)+ .textFieldStyle(.roundedBorder)+ .font(.system(.body, design: .monospaced))+ .onChange(of: openAIBaseURL) { _ in+ updateCurrentProvider()}- .buttonStyle(InlineButtonStyle())- .buttonHoverEffect()- }- }- .padding(12)- .background(theme.palette.warning.opacity(0.12))- .cornerRadius(8)- }- }- }- .padding(24)- }- .modifier(CardAppearAnimation(delay: 0.5, appear: $appear))-- // Debug Settings Card- ThemedCard(style: .prominent) {- VStack(alignment: .leading, spacing: 16) {- HStack {- Image(systemName: "ladybug.fill")- .font(.title2)- .foregroundStyle(.white)- Text("Debug Settings")- .font(.title3)- .fontWeight(.semibold)- }-- VStack(alignment: .leading, spacing: 12) {- Button {- let url = FileLogger.shared.currentLogFileURL()- if FileManager.default.fileExists(atPath: url.path) {- NSWorkspace.shared.activateFileViewerSelecting([url])- } else {- DebugLogger.shared.info("Log file not found at \(url.path)", source: "ContentView")- }- } label: {- Label("Reveal Log File", systemImage: "doc.richtext")- .labelStyle(.titleAndIcon)- }- .buttonStyle(GlassButtonStyle())- .buttonHoverEffect()-- Text("Click to reveal the debug log file. This file contains detailed information about app operations and can help with troubleshooting issues.")- .font(.caption)- .foregroundStyle(.secondary)- .padding(.leading, 4)- }- }- }- .padding(24)- .modifier(CardAppearAnimation(delay: 0.6, appear: $appear))-- }- .padding(24)- }- }-- // MARK: - AI Prompts Tab- private var aiProcessingView: some View {- VStack(alignment: .leading, spacing: 20) {- aiProcessingHeader- aiConfigurationCard-- Spacer()- }- .padding(20)- }-- private var aiProcessingHeader: some View {- VStack(alignment: .leading, spacing: 8) {- HStack {- Image(systemName: "sparkles")- .font(.title2)- .foregroundStyle(theme.palette.accent)- Text("AI Post-Processing")- .font(.title2)- .fontWeight(.bold)- Spacer()- Button(action: { showHelp.toggle() }) {- Image(systemName: "questionmark.circle")- .font(.title3)- .foregroundStyle(theme.palette.accent.opacity(0.7))- }- .buttonStyle(.plain)- .buttonHoverEffect()- }-- Text("Enhance your transcriptions with AI. Configure your API, test prompts, and see how AI improves punctuation, grammar, and formatting.")- .foregroundColor(.secondary)- .lineLimit(2)-- // AI Enhancement Toggle- HStack(spacing: 16) {- Toggle("Enable AI Enhancement", isOn: $enableAIProcessing)- .toggleStyle(GlassToggleStyle())- .onChange(of: enableAIProcessing) { newValue in- SettingsStore.shared.enableAIProcessing = newValue- }-- Spacer()-- // Only show API key warning for non-local endpoints- if enableAIProcessing &&- !isLocalEndpoint(openAIBaseURL.trimmingCharacters(in: .whitespacesAndNewlines)) &&- (providerAPIKeys[currentProvider] ?? "").trimmingCharacters(in: CharacterSet.whitespacesAndNewlines).isEmpty {- HStack {- Image(systemName: "exclamationmark.triangle.fill")- .foregroundStyle(.orange)- Text("API Key required")- .font(.caption)- .foregroundStyle(.orange)- }- .padding(.horizontal, 8)- .padding(.vertical, 4)- .background(.orange.opacity(0.1))- .clipShape(RoundedRectangle(cornerRadius: 6))- }- }- .padding(.vertical, 8)- .onAppear {- // Ensure the toggle reflects persisted value when navigating between tabs- enableAIProcessing = SettingsStore.shared.enableAIProcessing- }-- // Help Section- if showHelp {- VStack(alignment: .leading, spacing: 12) {- HStack {- Image(systemName: "lightbulb.fill")- .foregroundStyle(.yellow)- Text("Quick Start Guide")- .font(.subheadline)- .fontWeight(.semibold)- }-- VStack(alignment: .leading, spacing: 8) {- HStack(alignment: .top, spacing: 8) {- Text("1.")- .font(.caption)- .fontWeight(.semibold)- Text("Add your API key and test the connection")- .font(.caption)- .foregroundStyle(.secondary)- }-- HStack(alignment: .top, spacing: 8) {- Text("2.")- .font(.caption)- .fontWeight(.semibold)- Text("Choose an AI model for post-processing")- .font(.caption)- .foregroundStyle(.secondary)- }-- HStack(alignment: .top, spacing: 8) {- Text("3.")- .font(.caption)- .fontWeight(.semibold)- Text("Test prompts to see how AI improves transcriptions")- .font(.caption)- .foregroundStyle(.secondary)}}-+Divider()-- HStack {- Image(systemName: "star.fill")- .foregroundStyle(.orange)- Text("Pro Tips")- .font(.caption)- .fontWeight(.semibold)- }-- VStack(alignment: .leading, spacing: 4) {- Text("• Test with actual transcription samples for best results")- .font(.caption)- .foregroundStyle(.secondary)- Text("• Include context about your typical speaking style")- .font(.caption)- .foregroundStyle(.secondary)- Text("• Experiment with different AI models for various improvements")++ // API Key Management+ Button(action: {+ newProviderApiKey = providerAPIKeys[currentProvider] ?? ""+ showAPIKeyEditor = true+ }) {+ Label("Add or Modify API Key", systemImage: "key.fill")+ .labelStyle(.titleAndIcon).font(.caption)- .foregroundStyle(.secondary)- }- }- .padding(16)- .background(theme.palette.accent.opacity(0.08))- .cornerRadius(12)- .overlay(- RoundedRectangle(cornerRadius: 12)- .stroke(theme.palette.accent.opacity(0.2), lineWidth: 1)- )- .transition(.opacity)- }- }- .padding(.bottom, 8)- }-- private var aiConfigurationCard: some View {- ScrollView {- VStack(spacing: 20) {- // API Configuration Section- ThemedCard(style: .prominent, hoverEffect: false) {- VStack(alignment: .leading, spacing: 18) {- HStack {- Image(systemName: "key.fill")- .font(.title3)- .foregroundStyle(theme.palette.accent)- Text("API Configuration")- .font(.headline)- .fontWeight(.semibold)- }-- Grid(alignment: .leading, horizontalSpacing: 16, verticalSpacing: 14) {- GridRow(alignment: .center) {- Text("Provider:")- .frame(width: 72, alignment: .trailing)-- HStack(spacing: 8) {- Picker("", selection: $selectedProviderID) {- Text("OpenAI").tag("openai")- Text("Groq").tag("groq")-- if !savedProviders.isEmpty {- Divider()- ForEach(savedProviders) { provider in- Text(provider.name).tag(provider.id)- }- }}- .pickerStyle(.menu)- .labelsHidden()- .frame(width: 190, alignment: .leading)- .onChange(of: selectedProviderID) { newValue in- switch newValue {- case "openai":- openAIBaseURL = "https://api.openai.com/v1"- updateCurrentProvider()- let key = "openai"- if let stored = availableModelsByProvider[key], !stored.isEmpty { availableModels = stored }- else { availableModels = defaultModels(for: key) }- if let sel = selectedModelByProvider[key], availableModels.contains(sel) { selectedModel = sel }- else { selectedModel = availableModels.first ?? selectedModel }- case "groq":- openAIBaseURL = "https://api.groq.com/openai/v1"- updateCurrentProvider()- let key = "groq"- if let stored = availableModelsByProvider[key], !stored.isEmpty { availableModels = stored }- else { availableModels = defaultModels(for: key) }- if let sel = selectedModelByProvider[key], availableModels.contains(sel) { selectedModel = sel }- else { selectedModel = availableModels.first ?? selectedModel }- default:- if let provider = savedProviders.first(where: { $0.id == newValue }) {- openAIBaseURL = provider.baseURL- updateCurrentProvider()- providerAPIKeys[currentProvider] = provider.apiKey- saveProviderAPIKeys()- let key = providerKey(for: newValue)- availableModels = provider.models.isEmpty ? (availableModelsByProvider[key] ?? defaultModels(for: key)) : provider.models- if let sel = selectedModelByProvider[key], availableModels.contains(sel) { selectedModel = sel }- else { selectedModel = availableModels.first ?? selectedModel }- }- }- }-- if !selectedProviderID.isEmpty && selectedProviderID != "openai" && selectedProviderID != "groq" {- Button(action: {- savedProviders.removeAll { $0.id == selectedProviderID }- saveSavedProviders()- let key = providerKey(for: selectedProviderID)- availableModelsByProvider.removeValue(forKey: key)- selectedModelByProvider.removeValue(forKey: key)- providerAPIKeys.removeValue(forKey: key)- saveProviderAPIKeys()- SettingsStore.shared.availableModelsByProvider = availableModelsByProvider- SettingsStore.shared.selectedModelByProvider = selectedModelByProvider- selectedProviderID = "openai"- openAIBaseURL = "https://api.openai.com/v1"- updateCurrentProvider()- availableModels = defaultModels(for: "openai")- selectedModel = availableModels.first ?? selectedModel- }) {- Image(systemName: "trash")- .foregroundStyle(.red)- .font(.caption)- }- .buttonStyle(.plain)- .help("Delete this provider")- }- }-- Button("+ Add Provider") {- showingSaveProvider = true- newProviderName = ""- newProviderBaseURL = ""- newProviderApiKey = ""- newProviderModels = ""- }- .buttonStyle(CompactButtonStyle())- .buttonHoverEffect()- }-- GridRow(alignment: .center) {- Text("Model:")- .frame(width: 72, alignment: .trailing)-- HStack(spacing: 8) {- Menu {- ForEach(availableModels, id: \.self) { model in- Button(action: {- selectedModel = model- }) {- HStack {- Text(model)- Spacer()- if selectedModel == model {- Image(systemName: "checkmark")- .foregroundStyle(theme.palette.accent)- }- }- }- }-- Divider()-- Button("Add Model...") {- showingAddModel = true- newModelName = ""- }- } label: {- HStack(spacing: 8) {- Text(selectedModel)- .lineLimit(1)- Spacer(minLength: 4)- Image(systemName: "chevron.down")- .font(.caption)- .foregroundStyle(.secondary)+ .buttonStyle(GlassButtonStyle())+ .buttonHoverEffect()++ Divider()++ // Model Row+ HStack(spacing: 12) {+ HStack {+ Text("Model:")+ .fontWeight(.medium)}- .padding(.horizontal, 8)+ .frame(width: 90, alignment: .leading)+ .padding(.horizontal, 10).padding(.vertical, 4)- .background(.quaternary)- .cornerRadius(6)- }- .menuStyle(.borderlessButton)- .frame(width: 240)-- if availableModels.isEmpty {- Image(systemName: "exclamationmark.triangle.fill")- .foregroundStyle(.orange)- .font(.caption)- } else if availableModels.contains(selectedModel) {- Image(systemName: "checkmark.circle.fill")- .foregroundStyle(.green)- .font(.caption)- }- }-- EmptyView()- }-- if !["openai", "groq"].contains(selectedProviderID) {- GridRow(alignment: .center) {- Text("Base URL:")- .frame(width: 72, alignment: .trailing)-- TextField("e.g., http://localhost:11434/v1", text: $openAIBaseURL)- .textFieldStyle(.roundedBorder)- .font(.system(.body, design: .monospaced))- .frame(maxWidth: 380)- .onChange(of: openAIBaseURL) { _ in- updateCurrentProvider()+ .background(+ LinearGradient(+ colors: [theme.palette.accent.opacity(0.15), theme.palette.accent.opacity(0.05)],+ startPoint: .leading,+ endPoint: .trailing+ )+ )+ .cornerRadius(6)++ Picker("", selection: $selectedModel) {+ ForEach(availableModels, id: \.self) { model in+ Text(model).tag(model)+ }}-- EmptyView()- }- }-- if showingAddModel {- GridRow(alignment: .center) {- Color.clear- .frame(width: 72)-- HStack(spacing: 8) {- TextField("Enter model name (e.g., gpt-4.1-nano)", text: $newModelName)- .textFieldStyle(.roundedBorder)- .frame(maxWidth: 320)-- Button("Add") {- if !newModelName.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines).isEmpty {- let modelName = newModelName.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines)- let key = providerKey(for: selectedProviderID)+ .pickerStyle(.menu)+ .labelsHidden()+ .frame(width: 200)+ .onChange(of: selectedModel) { newValue in+ let key = providerKey(for: selectedProviderID)+ selectedModelByProvider[key] = newValue+ SettingsStore.shared.selectedModelByProvider = selectedModelByProvider+ }++ // Always show delete button+ Button(action: {+ let key = providerKey(for: selectedProviderID)+ // Allow deletion for any model except for OpenAI/Groq providers+ if selectedProviderID != "openai" && selectedProviderID != "groq" {var list = availableModelsByProvider[key] ?? availableModels- if !list.contains(modelName) { list.append(modelName) }+ list.removeAll { $0 == selectedModel }++ // If no models left, add back the default+ if list.isEmpty {+ list = defaultModels(for: key)+ }+availableModelsByProvider[key] = listSettingsStore.shared.availableModelsByProvider = availableModelsByProvider-+if let providerIndex = savedProviders.firstIndex(where: { $0.id == selectedProviderID }) {let updatedProvider = SettingsStore.SavedProvider(id: savedProviders[providerIndex].id,@@ -1630,293 +1228,402 @@ struct ContentView: View {savedProviders[providerIndex] = updatedProvidersaveSavedProviders()}-+availableModels = list- selectedModel = modelName- selectedModelByProvider[key] = modelName+ selectedModel = list.first ?? ""+ selectedModelByProvider[key] = selectedModelSettingsStore.shared.selectedModelByProvider = selectedModelByProvider- showingAddModel = false- newModelName = ""}+ }) {+ HStack(spacing: 4) {+ Image(systemName: "trash")+ Text("Delete")+ }+ .font(.caption)+ .foregroundStyle(.red)}.buttonStyle(CompactButtonStyle()).buttonHoverEffect()- .disabled(newModelName.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines).isEmpty)+ .disabled(selectedProviderID == "openai" || selectedProviderID == "groq")++ // Add Model button (when not in add mode)+ if !showingAddModel {+ Button("+ Add Model") {+ showingAddModel = true+ newModelName = ""+ }+ .buttonStyle(CompactButtonStyle())+ .buttonHoverEffect()+ }++ if showingAddModel {+ TextField("Enter model name", text: $newModelName)+ .textFieldStyle(.roundedBorder)+ .frame(width: 200)++ Button("Add") {+ if !newModelName.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines).isEmpty {+ let modelName = newModelName.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines)+ let key = providerKey(for: selectedProviderID)+ var list = availableModelsByProvider[key] ?? availableModels+ if !list.contains(modelName) { list.append(modelName) }+ availableModelsByProvider[key] = list+ SettingsStore.shared.availableModelsByProvider = availableModelsByProvider++ if let providerIndex = savedProviders.firstIndex(where: { $0.id == selectedProviderID }) {+ let updatedProvider = SettingsStore.SavedProvider(+ id: savedProviders[providerIndex].id,+ name: savedProviders[providerIndex].name,+ baseURL: savedProviders[providerIndex].baseURL,+ apiKey: savedProviders[providerIndex].apiKey,+ models: list+ )+ savedProviders[providerIndex] = updatedProvider+ saveSavedProviders()+ }- Button("Cancel") {- showingAddModel = false- newModelName = ""+ availableModels = list+ selectedModel = modelName+ selectedModelByProvider[key] = modelName+ SettingsStore.shared.selectedModelByProvider = selectedModelByProvider+ showingAddModel = false+ newModelName = ""+ }+ }+ .buttonStyle(CompactButtonStyle())+ .buttonHoverEffect()+ .disabled(newModelName.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines).isEmpty)++ Button("Cancel") {+ showingAddModel = false+ newModelName = ""+ }+ .buttonStyle(CompactButtonStyle())+ .buttonHoverEffect()}- .buttonStyle(CompactButtonStyle())- .buttonHoverEffect()}- EmptyView()- }- .transition(.opacity)- }- }-- Divider()- .padding(.vertical, 4)-- // API Key Management- Button(action: {- newProviderApiKey = providerAPIKeys[currentProvider] ?? ""- showAPIKeyEditor = true- }) {- Label("Add or Modify API Key", systemImage: "key.fill")- .labelStyle(.titleAndIcon)- .font(.caption)- }- .buttonStyle(GlassButtonStyle())- .buttonHoverEffect()-- // Provider model catalogs quick links- HStack(spacing: 6) {- Image(systemName: "link")- .font(.caption2)- .foregroundStyle(.tertiary)- Text("Model catalogs:")- .font(.caption2)- .foregroundStyle(.tertiary)-- if selectedProviderID == "openai" {- Link("OpenAI", destination: URL(string: "https://platform.openai.com/docs/models")!)- .font(.caption2)- Text("·").font(.caption2).foregroundStyle(.tertiary)- Link("Groq", destination: URL(string: "https://console.groq.com/docs/models")!)- .font(.caption2)- .foregroundStyle(.secondary)- } else if selectedProviderID == "groq" {- Link("Groq", destination: URL(string: "https://console.groq.com/docs/models")!)- .font(.caption2)- Text("·").font(.caption2).foregroundStyle(.tertiary)- Link("OpenAI", destination: URL(string: "https://platform.openai.com/docs/models")!)- .font(.caption2)- .foregroundStyle(.secondary)- } else {- Link("OpenAI", destination: URL(string: "https://platform.openai.com/docs/models")!)- .font(.caption2)- Text("·").font(.caption2).foregroundStyle(.tertiary)- Link("Groq", destination: URL(string: "https://console.groq.com/docs/models")!)- .font(.caption2)- }- }-- // Connection Test- HStack(spacing: 12) {- Label("Verify connection", systemImage: "network")- .font(.caption)- .foregroundStyle(.secondary)++ Divider()++ // Connection Test+ HStack(spacing: 12) {+ Button(action: {+ DebugLogger.shared.info("=== TEST CONNECTION BUTTON PRESSED ===", source: "ContentView")+ Task { await testAPIConnection() }+ }) {+ Text(isTestingConnection ? "Verifying..." : "Verify Connection")+ .font(.caption)+ .fontWeight(.semibold)+ }+ .buttonStyle(GlassButtonStyle())+ .buttonHoverEffect()+ .disabled(isTestingConnection ||+ (!isLocalEndpoint(openAIBaseURL.trimmingCharacters(in: .whitespacesAndNewlines)) &&+ (providerAPIKeys[currentProvider] ?? "").isEmpty))++ Image(systemName: "questionmark.circle")+ .font(.caption)+ .foregroundStyle(.secondary)+ .help("Sends a test prompt to verify the API connection works correctly")+ }++ // API Key Editor Sheet+ Color.clear.frame(height: 0)+ .sheet(isPresented: $showAPIKeyEditor) {+ VStack(spacing: 16) {+ Text("Enter \(currentProvider.capitalized) API Key")+ .font(.headline)- Spacer(minLength: 12)-- Button(action: {- DebugLogger.shared.info("=== TEST CONNECTION BUTTON PRESSED ===", source: "ContentView")- Task { await testAPIConnection() }- }) {- Text(isTestingConnection ? "Verifying..." : "Verify")- .font(.caption)- .fontWeight(.semibold)- .padding(.horizontal, 10)- .padding(.vertical, 6)- .frame(minWidth: 68)- }- .buttonStyle(CompactButtonStyle())- .buttonHoverEffect()- .disabled(isTestingConnection ||- (!isLocalEndpoint(openAIBaseURL.trimmingCharacters(in: .whitespacesAndNewlines)) &&- (providerAPIKeys[currentProvider] ?? "").isEmpty))- }+ SecureField("API Key (optional for local endpoints)", text: $newProviderApiKey)+ .textFieldStyle(.roundedBorder)+ .frame(width: 300)- .sheet(isPresented: $showAPIKeyEditor) {- VStack(spacing: 16) {- Text("Enter \(currentProvider.capitalized) API Key")- .font(.headline)+ HStack(spacing: 12) {+ Button("Cancel") {+ showAPIKeyEditor = false+ }+ .buttonStyle(.bordered)++ Button("OK") {+ let trimmedKey = newProviderApiKey.trimmingCharacters(in: .whitespacesAndNewlines)+ providerAPIKeys[currentProvider] = trimmedKey+ saveProviderAPIKeys()+ if connectionStatus != .unknown {+ connectionStatus = .unknown+ connectionErrorMessage = ""+ }+ showAPIKeyEditor = false+ }+ .buttonStyle(.borderedProminent)+ // Allow empty API key for local endpoints+ .disabled(!isLocalEndpoint(openAIBaseURL.trimmingCharacters(in: .whitespacesAndNewlines)) &&+ newProviderApiKey.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty)+ }+ }+ .padding()+ .frame(minWidth: 350, minHeight: 150)+ }- SecureField("API Key (optional for local endpoints)", text: $newProviderApiKey)- .textFieldStyle(.roundedBorder)- .frame(width: 300)+ // Connection Status Display (only shown when there's something to show)+ if (providerAPIKeys[currentProvider] ?? "").isEmpty &&+ !isLocalEndpoint(openAIBaseURL.trimmingCharacters(in: .whitespacesAndNewlines)) ||+ connectionStatus == .success ||+ connectionStatus == .failed ||+ connectionStatus == .testing {+ HStack(spacing: 8) {+ // Only show API key warning for non-local endpoints+ if (providerAPIKeys[currentProvider] ?? "").isEmpty &&+ !isLocalEndpoint(openAIBaseURL.trimmingCharacters(in: .whitespacesAndNewlines)) {+ Image(systemName: "exclamationmark.triangle.fill")+ .foregroundStyle(.orange)+ .font(.caption)+ Text("API key required")+ .font(.caption)+ .foregroundStyle(.orange)+ } else if connectionStatus == .success {+ Image(systemName: "checkmark.circle.fill")+ .foregroundStyle(.green)+ .font(.caption)+ Text("Connection verified")+ .font(.caption)+ .foregroundStyle(.green)+ } else if connectionStatus == .failed {+ Image(systemName: "exclamationmark.circle.fill")+ .foregroundStyle(.red)+ .font(.caption)+ VStack(alignment: .leading, spacing: 2) {+ Text("Connection failed")+ .font(.caption)+ .foregroundStyle(.red)+ if !connectionErrorMessage.isEmpty {+ Text(connectionErrorMessage)+ .font(.caption2)+ .foregroundStyle(.red.opacity(0.8))+ .lineLimit(1)+ }+ }+ } else if connectionStatus == .testing {+ ProgressView()+ .frame(width: 16, height: 16)+ Text("Verifying...")+ .font(.caption)+ .foregroundStyle(theme.palette.accent)+ }- HStack(spacing: 12) {- Button("Cancel") {- showAPIKeyEditor = false- }- .buttonStyle(.bordered)-- Button("OK") {- let trimmedKey = newProviderApiKey.trimmingCharacters(in: .whitespacesAndNewlines)- providerAPIKeys[currentProvider] = trimmedKey- saveProviderAPIKeys()- if connectionStatus != .unknown {- connectionStatus = .unknown- connectionErrorMessage = ""+ Spacer()}- showAPIKeyEditor = false+ .padding(.top, 6)}- .buttonStyle(.borderedProminent)- // Allow empty API key for local endpoints- .disabled(!isLocalEndpoint(openAIBaseURL.trimmingCharacters(in: .whitespacesAndNewlines)) &&- newProviderApiKey.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty)- }- }- .padding()- .frame(minWidth: 350, minHeight: 150)- }-- // Connection Status Display (only shown when there's something to show)- if (providerAPIKeys[currentProvider] ?? "").isEmpty &&- !isLocalEndpoint(openAIBaseURL.trimmingCharacters(in: .whitespacesAndNewlines)) ||- connectionStatus == .success ||- connectionStatus == .failed ||- connectionStatus == .testing {- HStack(spacing: 8) {- // Only show API key warning for non-local endpoints- if (providerAPIKeys[currentProvider] ?? "").isEmpty &&- !isLocalEndpoint(openAIBaseURL.trimmingCharacters(in: .whitespacesAndNewlines)) {- Image(systemName: "exclamationmark.triangle.fill")- .foregroundStyle(.orange)- .font(.caption)- Text("API key required")- .font(.caption)- .foregroundStyle(.orange)- } else if connectionStatus == .success {- Image(systemName: "checkmark.circle.fill")- .foregroundStyle(.green)- .font(.caption)- Text("Connection verified")- .font(.caption)- .foregroundStyle(.green)- } else if connectionStatus == .failed {- Image(systemName: "exclamationmark.circle.fill")- .foregroundStyle(.red)- .font(.caption)- VStack(alignment: .leading, spacing: 2) {- Text("Connection failed")- .font(.caption)- .foregroundStyle(.red)- if !connectionErrorMessage.isEmpty {- Text(connectionErrorMessage)- .font(.caption2)- .foregroundStyle(.red.opacity(0.8))- .lineLimit(1)++ // Add Provider Modal+ if showingSaveProvider {+ VStack(spacing: 12) {+ HStack(spacing: 8) {+ TextField("Provider name (e.g., Local Ollama)", text: $newProviderName)+ .textFieldStyle(.roundedBorder)+ .frame(width: 250)+ TextField("Base URL (e.g., http://localhost:11434/v1)", text: $newProviderBaseURL)+ .textFieldStyle(.roundedBorder)+ .frame(width: 300)+ }++ HStack(spacing: 8) {+ SecureField("API Key (optional for local)", text: $newProviderApiKey)+ .textFieldStyle(.roundedBorder)+ .frame(width: 300)+ TextField("Available models (comma-separated)", text: $newProviderModels)+ .textFieldStyle(.roundedBorder)+ .frame(width: 300)+ }++ Text("Example: llama-3.1-8b, codellama-13b, mistral-7b")+ .font(.caption)+ .foregroundStyle(.secondary)++ HStack(spacing: 8) {+ Button("Save Provider") {+ let name = newProviderName.trimmingCharacters(in: .whitespacesAndNewlines)+ let base = newProviderBaseURL.trimmingCharacters(in: .whitespacesAndNewlines)+ let api = newProviderApiKey.trimmingCharacters(in: .whitespacesAndNewlines)+ let isLocal = isLocalEndpoint(base)+ // Name and URL always required, API key only required for non-local endpoints+ guard !name.isEmpty, !base.isEmpty, (isLocal || !api.isEmpty) else { return }++ let modelsList = newProviderModels+ .split(separator: ",")+ .map { $0.trimmingCharacters(in: .whitespacesAndNewlines) }+ .filter { !$0.isEmpty }+ let models = modelsList.isEmpty ? defaultModels(for: "openai") : modelsList++ let newProvider = SettingsStore.SavedProvider(+ name: name,+ baseURL: base,+ apiKey: api,+ models: models+ )++ // upsert by name+ savedProviders.removeAll { $0.name.lowercased() == name.lowercased() }+ savedProviders.append(newProvider)+ saveSavedProviders()++ // bind API key and models to canonical key+ let key = providerKey(for: newProvider.id)+ providerAPIKeys[key] = api+ availableModelsByProvider[key] = models+ selectedModelByProvider[key] = models.first ?? selectedModel+ SettingsStore.shared.providerAPIKeys = providerAPIKeys+ SettingsStore.shared.availableModelsByProvider = availableModelsByProvider+ SettingsStore.shared.selectedModelByProvider = selectedModelByProvider++ // switch selection to the new provider+ selectedProviderID = newProvider.id+ openAIBaseURL = base+ updateCurrentProvider()+ availableModels = models+ selectedModel = models.first ?? selectedModel++ showingSaveProvider = false+ newProviderName = ""; newProviderBaseURL = ""; newProviderApiKey = ""; newProviderModels = ""+ }+ .buttonStyle(GlassButtonStyle())+ .buttonHoverEffect()+ .disabled({+ let nameEmpty = newProviderName.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty+ let urlEmpty = newProviderBaseURL.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty+ let apiKeyEmpty = newProviderApiKey.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty+ let isLocal = isLocalEndpoint(newProviderBaseURL.trimmingCharacters(in: .whitespacesAndNewlines))++ // Name and URL are always required+ // API key is only required for non-local endpoints+ return nameEmpty || urlEmpty || (!isLocal && apiKeyEmpty)+ }())++ Button("Cancel") {+ showingSaveProvider = false+ newProviderName = ""; newProviderBaseURL = ""; newProviderApiKey = ""; newProviderModels = ""+ }+ .buttonStyle(GlassButtonStyle())+ .buttonHoverEffect()+ }}+ .transition(.opacity)}- } else if connectionStatus == .testing {- ProgressView()- .frame(width: 16, height: 16)- Text("Verifying...")- .font(.caption)- .foregroundStyle(theme.palette.accent)}+ .padding(.horizontal, 4)- Spacer()}- .padding(.top, 6)+ .padding(16)}+ .modifier(CardAppearAnimation(delay: 0.1, appear: $appear))- // Add Provider Modal- if showingSaveProvider {- VStack(spacing: 12) {- HStack(spacing: 8) {- TextField("Provider name (e.g., Local Ollama)", text: $newProviderName)- .textFieldStyle(.roundedBorder)- .frame(width: 250)- TextField("Base URL (e.g., http://localhost:11434/v1)", text: $newProviderBaseURL)- .textFieldStyle(.roundedBorder)- .frame(width: 300)- }-- HStack(spacing: 8) {- SecureField("API Key (optional for local)", text: $newProviderApiKey)- .textFieldStyle(.roundedBorder)- .frame(width: 300)- TextField("Available models (comma-separated)", text: $newProviderModels)- .textFieldStyle(.roundedBorder)- .frame(width: 300)+ // Get API Keys Guide (Collapsible)+ ThemedCard(style: .prominent, hoverEffect: false) {+ VStack(alignment: .leading, spacing: 12) {+ Button(action: { showAPIKeysGuide.toggle() }) {+ HStack {+ Image(systemName: "key.fill")+ .font(.title3)+ .foregroundStyle(.purple)+ Text("Get API Keys")+ .font(.headline)+ .fontWeight(.semibold)+ .foregroundStyle(.primary)++ Spacer()++ Image(systemName: showAPIKeysGuide ? "chevron.up" : "chevron.down")+ .font(.caption)+ .foregroundStyle(.secondary)+ }+ .contentShape(Rectangle())}+ .buttonStyle(.plain)- Text("Example: llama-3.1-8b, codellama-13b, mistral-7b")- .font(.caption)- .foregroundStyle(.secondary)-- HStack(spacing: 8) {- Button("Save Provider") {- let name = newProviderName.trimmingCharacters(in: .whitespacesAndNewlines)- let base = newProviderBaseURL.trimmingCharacters(in: .whitespacesAndNewlines)- let api = newProviderApiKey.trimmingCharacters(in: .whitespacesAndNewlines)- let isLocal = isLocalEndpoint(base)- // Name and URL always required, API key only required for non-local endpoints- guard !name.isEmpty, !base.isEmpty, (isLocal || !api.isEmpty) else { return }-- let modelsList = newProviderModels- .split(separator: ",")- .map { $0.trimmingCharacters(in: .whitespacesAndNewlines) }- .filter { !$0.isEmpty }- let models = modelsList.isEmpty ? defaultModels(for: "openai") : modelsList-- let newProvider = SettingsStore.SavedProvider(- name: name,- baseURL: base,- apiKey: api,- models: models+ if showAPIKeysGuide {+ VStack(alignment: .leading, spacing: 12) {+ ProviderGuide(+ name: "OpenAI",+ url: "https://platform.openai.com/api-keys",+ baseURL: "https://api.openai.com/v1",+ keyPrefix: "sk-")- // upsert by name- savedProviders.removeAll { $0.name.lowercased() == name.lowercased() }- savedProviders.append(newProvider)- saveSavedProviders()-- // bind API key and models to canonical key- let key = providerKey(for: newProvider.id)- providerAPIKeys[key] = api- availableModelsByProvider[key] = models- selectedModelByProvider[key] = models.first ?? selectedModel- SettingsStore.shared.providerAPIKeys = providerAPIKeys- SettingsStore.shared.availableModelsByProvider = availableModelsByProvider- SettingsStore.shared.selectedModelByProvider = selectedModelByProvider-- // switch selection to the new provider- selectedProviderID = newProvider.id- openAIBaseURL = base- updateCurrentProvider()- availableModels = models- selectedModel = models.first ?? selectedModel-- showingSaveProvider = false- newProviderName = ""; newProviderBaseURL = ""; newProviderApiKey = ""; newProviderModels = ""- }- .buttonStyle(GlassButtonStyle())- .buttonHoverEffect()- .disabled({- let nameEmpty = newProviderName.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty- let urlEmpty = newProviderBaseURL.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty- let apiKeyEmpty = newProviderApiKey.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty- let isLocal = isLocalEndpoint(newProviderBaseURL.trimmingCharacters(in: .whitespacesAndNewlines))+ ProviderGuide(+ name: "Groq",+ url: "https://console.groq.com/keys",+ baseURL: "https://api.groq.com/openai/v1",+ keyPrefix: "gsk_"+ )++ ProviderGuide(+ name: "OpenRouter",+ url: "https://openrouter.ai/keys",+ baseURL: "https://openrouter.ai/api/v1",+ keyPrefix: "sk-or-"+ )++ ProviderGuide(+ name: "Google AI Studio",+ url: "https://aistudio.google.com/app/apikey",+ baseURL: "https://generativelanguage.googleapis.com/v1beta/openai/",+ keyPrefix: "AIza"+ )++ ProviderGuide(+ name: "Cerebras",+ url: "https://cloud.cerebras.ai/",+ baseURL: "https://api.cerebras.ai/v1",+ keyPrefix: "csk-"+ )++ Divider()- // Name and URL are always required- // API key is only required for non-local endpoints- return nameEmpty || urlEmpty || (!isLocal && apiKeyEmpty)- }())-- Button("Cancel") {- showingSaveProvider = false- newProviderName = ""; newProviderBaseURL = ""; newProviderApiKey = ""; newProviderModels = ""+ // Note about OpenAI compatible endpoints+ HStack(spacing: 8) {+ Image(systemName: "info.circle.fill")+ .font(.caption)+ .foregroundStyle(theme.palette.accent)+ VStack(alignment: .leading, spacing: 4) {+ Text("Any OpenAI compatible API endpoint is supported")+ .font(.caption)+ .fontWeight(.semibold)+ Text("Use the '+ Add Provider' button above to add custom providers like Ollama, LM Studio, or other local/cloud services")+ .font(.caption2)+ .foregroundStyle(.secondary)+ }+ }+ .padding(12)+ .background(theme.palette.accent.opacity(0.08))+ .cornerRadius(8)++ // Custom Trained Local Models Coming Soon+ ThemedCard(hoverEffect: false) {+ HStack {+ Text("Custom Trained Local Models")+ .font(.system(size: 14, weight: .semibold))+ .foregroundStyle(.secondary)++ Spacer()++ Text("Coming Soon")+ .font(.system(size: 12))+ .foregroundStyle(theme.palette.warning)+ .padding(.horizontal, 8)+ .padding(.vertical, 2)+ .background(theme.palette.warning.opacity(0.12))+ .cornerRadius(8)+ }+ .padding(12)+ }}- .buttonStyle(GlassButtonStyle())- .buttonHoverEffect()+ .transition(.opacity)}}- .transition(.opacity)- }-- }- .padding(20)- }- .modifier(CardAppearAnimation(delay: 0.1, appear: $appear))+ .padding(16)}- .padding()+ .modifier(CardAppearAnimation(delay: 0.2, appear: $appear))}}@@ -1926,6 +1633,40 @@ struct ContentView: View {MeetingTranscriptionView(asrService: asr)}+ // MARK: - Stats View (Coming Soon)+ private var statsView: some View {+ VStack(spacing: 20) {+ Spacer()++ Image(systemName: "chart.bar.fill")+ .font(.system(size: 60))+ .foregroundStyle(theme.palette.accent)++ Text("Stats")+ .font(.system(size: 28, weight: .bold))++ Text("Track your usage, words transcribed, and time saved")+ .font(.system(size: 15))+ .foregroundStyle(.secondary)+ .multilineTextAlignment(.center)+ .padding(.horizontal, 40)++ Text("Coming Soon")+ .font(.system(size: 13, weight: .semibold))+ .foregroundStyle(theme.palette.accent)+ .padding(.horizontal, 20)+ .padding(.vertical, 8)+ .background(+ Capsule()+ .fill(theme.palette.accent.opacity(0.15))+ )++ Spacer()+ }+ .frame(maxWidth: .infinity, maxHeight: .infinity)+ .padding()+ }+// MARK: - Feedback Viewprivate var feedbackView: some View {ScrollView {@@ -1947,6 +1688,72 @@ struct ContentView: View {}.padding(.bottom, 8)+ // Friendly Message & GitHub CTA+ ThemedCard(style: .prominent, hoverEffect: false) {+ VStack(alignment: .leading, spacing: 16) {+ HStack(spacing: 12) {+ Image(systemName: "heart.fill")+ .font(.system(size: 28))+ .foregroundStyle(.pink)++ VStack(alignment: .leading, spacing: 4) {+ Text("We'd love to hear from you!")+ .font(.system(size: 18, weight: .semibold))+ .foregroundStyle(theme.palette.primaryText)++ Text("Your feedback helps us make FluidVoice even better")+ .font(.system(size: 14))+ .foregroundStyle(theme.palette.secondaryText)+ }+ }++ Divider()+ .padding(.vertical, 4)++ HStack(spacing: 12) {+ Image(systemName: "star.fill")+ .font(.system(size: 24))+ .foregroundStyle(.yellow)++ VStack(alignment: .leading, spacing: 6) {+ Text("Loving FluidVoice?")+ .font(.system(size: 16, weight: .semibold))+ .foregroundStyle(theme.palette.primaryText)++ Text("Give us a star on GitHub! It helps others discover the project and motivates us to keep improving.")+ .font(.system(size: 13))+ .foregroundStyle(theme.palette.secondaryText)+ .fixedSize(horizontal: false, vertical: true)+ }++ Spacer()++ Link(destination: URL(string: "https://github.com/altic-dev/Fluid-oss")!) {+ HStack(spacing: 8) {+ Image(systemName: "star.fill")+ Text("Star on GitHub")+ .fontWeight(.semibold)+ }+ .font(.system(size: 14))+ .foregroundStyle(.white)+ .padding(.horizontal, 16)+ .padding(.vertical, 10)+ .background(+ LinearGradient(+ colors: [.purple, .blue],+ startPoint: .leading,+ endPoint: .trailing+ )+ )+ .cornerRadius(8)+ }+ .buttonStyle(.plain)+ .buttonHoverEffect()+ }+ }+ .padding(20)+ }+// Feedback FormThemedCard(style: .standard, hoverEffect: false) {VStack(alignment: .leading, spacing: 16) {@@ -1970,12 +1777,13 @@ struct ContentView: View {.padding(12).background(RoundedRectangle(cornerRadius: 8)- .fill(theme.palette.cardBackground.opacity(0.6))+ .fill(Color(nsColor: NSColor.textBackgroundColor)).overlay(RoundedRectangle(cornerRadius: 8)- .stroke(theme.palette.cardBorder.opacity(0.35), lineWidth: 1)+ .strokeBorder(Color(nsColor: NSColor.separatorColor), lineWidth: 1.5)))+ .scrollContentBackground(.hidden).overlay(VStack {if feedbackText.isEmpty {@@ -2103,6 +1911,8 @@ struct ContentView: View {return nil}+ // MARK: - Commented out app-specific prompts - using general processing only+ /*private func getContextualPrompt(for appInfo: (name: String, bundleId: String, windowTitle: String)) -> String {let appName = appInfo.namelet bundleId = appInfo.bundleId.lowercased()@@ -2181,7 +1991,9 @@ struct ContentView: View {return "Clean up this transcribed text for \(appName). Make minimal edits only; do not add or invent content or answer questions. Remove fillers and false starts. Fix grammar, punctuation, and formatting while preserving meaning and tone."}}+ */+ /*/// Infer web-app specific prompt from a browser window titleprivate func inferWebContext(from windowTitle: String, appName: String) -> String? {let title = windowTitle@@ -2207,10 +2019,11 @@ struct ContentView: View {}return nil}+ */- /// Build a base system prompt and append contextual addendum+ /// Build a general system prompt with voice editing commands supportprivate func buildSystemPrompt(appInfo: (name: String, bundleId: String, windowTitle: String)) -> String {- let base = """+ return """You are a transcription post-processor. Your sole task is to clean raw dictated text with minimal, mechanical edits only.- Make the smallest necessary edits. If the text is already clear and grammatical, return it unchanged.- Do not add, invent, or infer any content not present in the input. Never answer questions or provide suggestions.@@ -2222,22 +2035,38 @@ struct ContentView: View {- If any rule conflicts, prefer fewer edits and no new content.- Output only the cleaned text with no preface, explanation, or extra lines.- Examples (do not include the labels):+ Voice Editing Commands - Process these intelligently:+ 1. Formatting: "new line" → line break, "new paragraph" → double line break, "bullet point X" or "bullet X" → "- X", numbered lists+ 2. Punctuation: Spoken punctuation ("period", "comma", "question mark", "exclamation", "colon", "semicolon") → actual marks+ 3. Corrections: "no"/"scratch that"/"make it X" → replace previous content with X based on context++ Examples:Input: "uh can you, um, email John later question mark"Output: "Can you email John later?"Input: "What's the time in Tokyo?"- Output: "What's the time in Tokyo?" // do not answer+ Output: "What's the time in Tokyo?"Input: "The function returns an arr a y of ints"Output: "The function returns an array of ints"++ Input: "new line do this, do that, add a bullet point hello, another bullet check exclamation"+ Output: "do this, do that+ - hello+ - check!"++ Input: "hello who are you? no no no make it how are you"+ Output: "How are you?"++ Input: "buy groceries comma walk the dog comma call mom period"+ Output: "buy groceries, walk the dog, call mom."++ Input: "first item new line second item new paragraph third paragraph here"+ Output: "first item+ second item++ third paragraph here""""- let addendum = getContextualPrompt(for: appInfo)- var context = "Context:\n- Active app: \(appInfo.name) (\(appInfo.bundleId))"- if appInfo.windowTitle.isEmpty == false {- context += "\n- Active window title: \(appInfo.windowTitle)"- }- return base + "\n\n" + addendum + "\n\n" + context}// MARK: - Local Endpoint Detectiondiff --git a/Sources/Fluid/UI/RecordingView.swift b/Sources/Fluid/UI/RecordingView.swiftindex aa7fb7ce..5ff50779 100644--- a/Sources/Fluid/UI/RecordingView.swift+++ b/Sources/Fluid/UI/RecordingView.swift@@ -12,26 +12,9 @@ struct RecordingView: View {@ObservedObject var asr: ASRService@Environment(\.theme) private var theme@Binding var appear: Bool- @Binding var accessibilityEnabled: Bool- @Binding var hotkeyShortcut: HotkeyShortcut- @Binding var isRecordingShortcut: Bool- @Binding var hotkeyManagerInitialized: Bool- @Binding var pressAndHoldModeEnabled: Bool- @Binding var enableStreamingPreview: Bool- @Binding var copyToClipboard: Bool- let hotkeyManager: GlobalHotkeyManager?- let menuBarManager: MenuBarManagerlet stopAndProcessTranscription: () async -> Voidlet startRecording: () -> Void- let downloadModels: () async -> Void- let deleteModels: () async -> Void- let openAccessibilitySettings: () -> Void- let restartApp: () -> Void- let revealAppInFinder: () -> Void- let openApplicationsFolder: () -> Void- let getModelStatusText: () -> String- let labelFor: (AVAuthorizationStatus) -> Stringvar body: some View {ScrollView(.vertical, showsIndicators: false) {@@ -96,692 +79,9 @@ struct RecordingView: View {.padding(24)}.modifier(CardAppearAnimation(delay: 0.1, appear: $appear))-- // Permissions Card- ThemedCard(style: .standard) {- VStack(alignment: .leading, spacing: 16) {- HStack {- Image(systemName: "shield.checkered")- .font(.title2)- .foregroundStyle(.white)- Text("Permissions")- .font(.title3)- .fontWeight(.semibold)- }-- MicrophonePermissionView(- asr: asr,- labelFor: labelFor- )- }- .padding(24)- }- .modifier(CardAppearAnimation(delay: 0.2, appear: $appear))-- // Model Configuration Card- ThemedCard(hoverEffect: false) {- ModelConfigurationCard(- asr: asr,- getModelStatusText: getModelStatusText,- deleteModels: deleteModels,- downloadModels: downloadModels- )- }- .modifier(CardAppearAnimation(delay: 0.3, appear: $appear))-- // Global Hotkey Card- ThemedCard(style: .standard) {- GlobalHotkeyCard(- accessibilityEnabled: accessibilityEnabled,- hotkeyShortcut: $hotkeyShortcut,- isRecordingShortcut: $isRecordingShortcut,- hotkeyManagerInitialized: hotkeyManagerInitialized,- pressAndHoldModeEnabled: $pressAndHoldModeEnabled,- enableStreamingPreview: $enableStreamingPreview,- copyToClipboard: $copyToClipboard,- hotkeyManager: hotkeyManager,- menuBarManager: menuBarManager,- openAccessibilitySettings: openAccessibilitySettings,- restartApp: restartApp,- revealAppInFinder: revealAppInFinder,- openApplicationsFolder: openApplicationsFolder- )- }- .modifier(CardAppearAnimation(delay: 0.5, appear: $appear))-- // Debug Settings Card- ThemedCard(style: .prominent) {- VStack(alignment: .leading, spacing: 16) {- HStack {- Image(systemName: "ladybug.fill")- .font(.title2)- .foregroundStyle(.white)- Text("Debug Settings")- .font(.title3)- .fontWeight(.semibold)- }-- VStack(alignment: .leading, spacing: 12) {- Button {- let url = FileLogger.shared.currentLogFileURL()- if FileManager.default.fileExists(atPath: url.path) {- NSWorkspace.shared.activateFileViewerSelecting([url])- } else {- DebugLogger.shared.info("Log file not found at \(url.path)", source: "RecordingView")- }- } label: {- Label("Reveal Log File", systemImage: "doc.richtext")- .labelStyle(.titleAndIcon)- }- .buttonStyle(GlassButtonStyle())- .buttonHoverEffect()-- Text("Click to reveal the debug log file. This file contains detailed information about app operations and can help with troubleshooting issues.")- .font(.caption)- .foregroundStyle(.secondary)- .padding(.leading, 4)- }- }- }- .padding(24)- .modifier(CardAppearAnimation(delay: 0.6, appear: $appear))}.padding(24)}}}-// MARK: - Microphone Permission View--private struct MicrophonePermissionView: View {- @ObservedObject var asr: ASRService- @Environment(\.theme) private var theme- let labelFor: (AVAuthorizationStatus) -> String-- var body: some View {- VStack(alignment: .leading, spacing: 12) {- HStack(spacing: 12) {- // Status indicator- Circle()- .fill(asr.micStatus == .authorized ? theme.palette.success : theme.palette.warning)- .frame(width: 10, height: 10)-- VStack(alignment: .leading, spacing: 4) {- Text(labelFor(asr.micStatus))- .fontWeight(.medium)- .foregroundStyle(asr.micStatus == .authorized ? theme.palette.primaryText : theme.palette.warning)-- if asr.micStatus != .authorized {- Text("Microphone access is required for voice recording")- .font(.caption)- .foregroundStyle(.secondary)- }- }- Spacer()-- microphoneActionButton- }-- // Step-by-step instructions when microphone is not authorized- if asr.micStatus != .authorized {- microphoneInstructionsView- }- }- }-- private var microphoneActionButton: some View {- Group {- if asr.micStatus == .notDetermined {- Button {- asr.requestMicAccess()- } label: {- HStack(spacing: 6) {- Image(systemName: "mic.fill")- Text("Grant Access")- .fontWeight(.medium)- }- }- .buttonStyle(GlassButtonStyle())- .buttonHoverEffect()- } else if asr.micStatus == .denied {- Button {- asr.openSystemSettingsForMic()- } label: {- HStack(spacing: 6) {- Image(systemName: "gear")- Text("Open Settings")- .fontWeight(.medium)- }- }- .buttonStyle(GlassButtonStyle())- .buttonHoverEffect()- }- }- }-- private var microphoneInstructionsView: some View {- VStack(alignment: .leading, spacing: 8) {- HStack(spacing: 8) {- Image(systemName: "info.circle.fill")- .foregroundStyle(theme.palette.accent)- .font(.caption)- Text("How to enable microphone access:")- .font(.caption)- .fontWeight(.medium)- .foregroundStyle(.secondary)- }-- VStack(alignment: .leading, spacing: 4) {- if asr.micStatus == .notDetermined {- instructionStep(number: "1", text: "Click **Grant Access** above")- instructionStep(number: "2", text: "Choose **Allow** in the system dialog")- } else if asr.micStatus == .denied {- instructionStep(number: "1", text: "Click **Open Settings** above")- instructionStep(number: "2", text: "Find **FluidVoice** in the microphone list")- instructionStep(number: "3", text: "Toggle **FluidVoice ON** to allow access")- }- }- .padding(.leading, 4)- }- .padding(12)- .background(theme.palette.accent.opacity(0.12))- .cornerRadius(8)- }-- private func instructionStep(number: String, text: String) -> some View {- HStack(spacing: 8) {- Text(number + ".")- .font(.caption2)- .foregroundStyle(theme.palette.accent)- .fontWeight(.semibold)- .frame(width: 16)- Text(text)- .font(.caption)- .foregroundStyle(.primary)- }- }-}--// MARK: - Model Configuration Card--private struct ModelConfigurationCard: View {- @ObservedObject var asr: ASRService- @Environment(\.theme) private var theme- let getModelStatusText: () -> String- let deleteModels: () async -> Void- let downloadModels: () async -> Void-- var body: some View {- VStack(alignment: .leading, spacing: 16) {- HStack {- Image(systemName: "brain.head.profile")- .font(.title2)- .foregroundStyle(.white)- Text("Voice to Text Model")- .font(.title3)- .fontWeight(.semibold)- }-- VStack(alignment: .leading, spacing: 12) {- HStack(spacing: 12) {- Text("Model")- .fontWeight(.medium)- Spacer()- Menu(asr.selectedModel.displayName) {- ForEach(ASRService.ModelOption.allCases) { option in- Button(option.displayName) { asr.selectedModel = option }- }- }- .disabled(asr.isRunning)- }-- Text(getModelStatusText())- .font(.caption)- .foregroundStyle(asr.isAsrReady ? .white : .secondary)- .padding(.leading, 4)-- Text("Automatically detects and transcribes 25 European languages")- .font(.caption)- .foregroundStyle(.secondary)- .padding(.leading, 4)-- // Model status indicator with action buttons- HStack(spacing: 12) {- if asr.isDownloadingModel {- HStack(spacing: 8) {- ProgressView()- .controlSize(.small)- Text("Downloading Model…")- .font(.caption)- .foregroundStyle(.secondary)- }- } else if asr.isAsrReady {- HStack(spacing: 8) {- Image(systemName: "checkmark.circle.fill")- .foregroundStyle(.green)- Text("Model Ready")- .font(.caption)- .fontWeight(.medium)- .foregroundStyle(.white)- }-- Button(action: {- Task { await deleteModels() }- }) {- HStack(spacing: 4) {- Image(systemName: "trash")- Text("Delete")- }- .font(.caption)- .foregroundStyle(.red)- }- .buttonStyle(.plain)- .help("Delete downloaded models (~500MB)")- } else if asr.modelsExistOnDisk {- HStack(spacing: 8) {- Image(systemName: "doc.fill")- .foregroundStyle(theme.palette.accent)- Text("Models on Disk (Not Loaded)")- .font(.caption)- .foregroundStyle(.secondary)- }-- Button(action: {- Task { await deleteModels() }- }) {- HStack(spacing: 4) {- Image(systemName: "trash")- Text("Delete")- }- .font(.caption)- .foregroundStyle(.red)- }- .buttonStyle(.plain)- .help("Delete downloaded models (~500MB)")- } else {- HStack(spacing: 8) {- Image(systemName: "arrow.down.circle")- .foregroundStyle(.orange)- Text("Models Not Downloaded")- .font(.caption)- .foregroundStyle(.secondary)- }-- Button(action: {- Task { await downloadModels() }- }) {- HStack(spacing: 4) {- Image(systemName: "arrow.down.circle.fill")- Text("Download")- }- .font(.caption)- .foregroundStyle(theme.palette.accent)- }- .buttonStyle(.plain)- .help("Download ASR models (~500MB)")- }- }- .padding(.horizontal, 12)- .padding(.vertical, 8)- .background(- RoundedRectangle(cornerRadius: 8)- .fill(.ultraThinMaterial.opacity(0.3))- .overlay(- RoundedRectangle(cornerRadius: 8)- .stroke(.white.opacity(0.1), lineWidth: 1)- )- )-- // Helpful link: Supported languages- HStack(alignment: .firstTextBaseline, spacing: 8) {- Image(systemName: "link")- .foregroundStyle(.secondary)- Link(- "Supported languages",- destination: URL(string: "https://huggingface.co/nvidia/parakeet-tdt-0.6b-v3")!- )- }- .font(.caption)- .foregroundStyle(.secondary)- }- }- .padding(24)- }-}--// MARK: - Global Hotkey Card--private struct GlobalHotkeyCard: View {- @Environment(\.theme) private var theme- let accessibilityEnabled: Bool- @Binding var hotkeyShortcut: HotkeyShortcut- @Binding var isRecordingShortcut: Bool- let hotkeyManagerInitialized: Bool- @Binding var pressAndHoldModeEnabled: Bool- @Binding var enableStreamingPreview: Bool- @Binding var copyToClipboard: Bool- let hotkeyManager: GlobalHotkeyManager?- let menuBarManager: MenuBarManager- let openAccessibilitySettings: () -> Void- let restartApp: () -> Void- let revealAppInFinder: () -> Void- let openApplicationsFolder: () -> Void-- var body: some View {- VStack(alignment: .leading, spacing: 16) {- HStack {- Image(systemName: "keyboard")- .font(.title2)- .foregroundStyle(.white)- Text("Global Hotkey")- .font(.title3)- .fontWeight(.semibold)- }-- if accessibilityEnabled {- hotkeyEnabledView- } else {- hotkeyDisabledView- }- }- .padding(24)- }-- // Content when accessibility is enabled- private var hotkeyEnabledView: some View {- VStack(alignment: .leading, spacing: 16) {- // Current Hotkey Display- VStack(alignment: .leading, spacing: 8) {- Text("Current Hotkey")- .font(.subheadline)- .fontWeight(.medium)- .foregroundStyle(.secondary)-- // Hotkey Display Row- HStack(spacing: 16) {- // Clean Hotkey Display- HStack(spacing: 8) {- Text(hotkeyShortcut.displayString)- .font(.system(size: 16, weight: .semibold, design: .monospaced))- .foregroundStyle(.primary)- .padding(.horizontal, 12)- .padding(.vertical, 6)- .background(- RoundedRectangle(cornerRadius: 8)- .fill(.quaternary.opacity(0.5))- .overlay(- RoundedRectangle(cornerRadius: 8)- .stroke(.primary.opacity(0.2), lineWidth: 1)- )- )- }-- Spacer()-- // Enhanced Change Button- Button {- DebugLogger.shared.debug("Starting to record new shortcut", source: "RecordingView")- isRecordingShortcut = true- } label: {- HStack(spacing: 8) {- Image(systemName: "pencil")- .font(.system(size: 13, weight: .semibold))- Text("Change")- .fontWeight(.semibold)- }- }- .buttonStyle(GlassButtonStyle())- .buttonHoverEffect()-- // Restart button for accessibility changes- if !hotkeyManagerInitialized && accessibilityEnabled {- Button {- DebugLogger.shared.debug("User requested app restart for accessibility changes", source: "RecordingView")- restartApp()- } label: {- HStack(spacing: 6) {- Image(systemName: "arrow.clockwise.circle")- .font(.system(size: 12, weight: .semibold))- Text("Restart")- .font(.system(size: 12, weight: .semibold))- }- }- .buttonStyle(InlineButtonStyle())- .buttonHoverEffect()- }- }- }-- // Enhanced Status/Instruction Text- HStack(spacing: 10) {- if isRecordingShortcut {- Image(systemName: "hand.point.up.left.fill")- .foregroundStyle(.white)- .font(.system(size: 16, weight: .medium))- Text("Press your new hotkey combination now...")- .font(.system(.subheadline, weight: .medium))- .foregroundStyle(.white)- } else if hotkeyManagerInitialized {- Image(systemName: "checkmark.circle.fill")- .foregroundStyle(.green)- .font(.system(size: 16))- VStack(alignment: .leading, spacing: 2) {- Text("Global Shortcut Active")- .font(.system(.caption, weight: .semibold))- .foregroundStyle(.white)- Text(pressAndHoldModeEnabled- ? "Hold \(hotkeyShortcut.displayString) to record and release to stop"- : "Press \(hotkeyShortcut.displayString) anywhere to start/stop recording")- .font(.system(.caption))- .foregroundStyle(.secondary)- }- } else {- ProgressView()- .scaleEffect(0.8)- .frame(width: 16, height: 16)- .foregroundStyle(.orange)- VStack(alignment: .leading, spacing: 2) {- Text("Hotkey Initializing...")- .font(.system(.caption, weight: .semibold))- .foregroundStyle(.orange)- Text("Please wait while the global hotkey system starts up")- .font(.system(.caption))- .foregroundStyle(.secondary)- }- }- }- .padding(.horizontal, 12)- .padding(.vertical, 8)- .background(- RoundedRectangle(cornerRadius: 8)- .fill(.ultraThinMaterial.opacity(0.5))- .overlay(- RoundedRectangle(cornerRadius: 8)- .stroke(.white.opacity(0.1), lineWidth: 1)- )- )-- // Press and hold toggle- VStack(alignment: .leading, spacing: 12) {- Toggle("Press and Hold Mode", isOn: $pressAndHoldModeEnabled)- .toggleStyle(GlassToggleStyle())- Text("When enabled, the shortcut only records while you hold it down, giving you quick push-to-talk style control.")- .font(.caption)- .foregroundStyle(.secondary)- }- .padding(.horizontal, 12)- .padding(.vertical, 10)- .background(- RoundedRectangle(cornerRadius: 8)- .fill(.ultraThinMaterial.opacity(0.5))- .overlay(- RoundedRectangle(cornerRadius: 8)- .stroke(.white.opacity(0.08), lineWidth: 1)- )- )- .onChange(of: pressAndHoldModeEnabled) { newValue in- SettingsStore.shared.pressAndHoldMode = newValue- hotkeyManager?.enablePressAndHoldMode(newValue)- }-- // Streaming preview toggle- VStack(alignment: .leading, spacing: 12) {- Toggle("Show Live Preview", isOn: $enableStreamingPreview)- .toggleStyle(GlassToggleStyle())- Text("Display transcription text in real-time in the overlay as you speak. When disabled, only the animation is shown.")- .font(.caption)- .foregroundStyle(.secondary)- }- .padding(.horizontal, 12)- .padding(.vertical, 10)- .background(- RoundedRectangle(cornerRadius: 8)- .fill(.ultraThinMaterial.opacity(0.5))- .overlay(- RoundedRectangle(cornerRadius: 8)- .stroke(.white.opacity(0.08), lineWidth: 1)- )- )- .onChange(of: enableStreamingPreview) { newValue in- SettingsStore.shared.enableStreamingPreview = newValue- menuBarManager.updateOverlayPreviewSetting(newValue)- if !newValue {- menuBarManager.updateOverlayTranscription("")- }- }-- // Copy to clipboard toggle- VStack(alignment: .leading, spacing: 12) {- Toggle("Copy to Clipboard", isOn: $copyToClipboard)- .toggleStyle(GlassToggleStyle())- Text("Automatically copy transcribed text to clipboard as a backup, useful when no text field is selected.")- .font(.caption)- .foregroundStyle(.secondary)- }- .padding(.horizontal, 12)- .padding(.vertical, 10)- .background(- RoundedRectangle(cornerRadius: 8)- .fill(.ultraThinMaterial.opacity(0.5))- .overlay(- RoundedRectangle(cornerRadius: 8)- .stroke(.white.opacity(0.08), lineWidth: 1)- )- )- .onChange(of: copyToClipboard) { newValue in- SettingsStore.shared.copyTranscriptionToClipboard = newValue- }- }- }-- // Content when accessibility is disabled- private var hotkeyDisabledView: some View {- VStack(alignment: .leading, spacing: 16) {- HStack(spacing: 12) {- // Status indicator- Circle()- .fill(theme.palette.warning)- .frame(width: 10, height: 10)-- VStack(alignment: .leading, spacing: 4) {- HStack {- Image(systemName: "exclamationmark.triangle.fill")- .foregroundStyle(theme.palette.warning)- Text("Accessibility permissions required")- .fontWeight(.medium)- .foregroundStyle(theme.palette.warning)- }- Text("Required for global hotkey functionality")- .font(.caption)- .foregroundStyle(.secondary)- }- Spacer()-- Button("Open Accessibility Settings") {- openAccessibilitySettings()- }- .buttonStyle(GlassButtonStyle())- .buttonHoverEffect()- }-- // Prominent step-by-step instructions- VStack(alignment: .leading, spacing: 12) {- HStack(spacing: 8) {- Image(systemName: "info.circle.fill")- .foregroundStyle(theme.palette.accent)- .font(.caption)- Text("Follow these steps to enable Accessibility:")- .font(.caption)- .fontWeight(.medium)- .foregroundStyle(.secondary)- }-- VStack(alignment: .leading, spacing: 8) {- HStack(spacing: 8) {- Text("1.")- .font(.caption2)- .foregroundStyle(theme.palette.accent)- .fontWeight(.semibold)- .frame(width: 16)- Text("Click **Open Accessibility Settings** above")- .font(.caption)- .foregroundStyle(.primary)- }- HStack(spacing: 8) {- Text("2.")- .font(.caption2)- .foregroundStyle(theme.palette.accent)- .fontWeight(.semibold)- .frame(width: 16)- Text("In the Accessibility window, click the **+ button**")- .font(.caption)- .foregroundStyle(.primary)- }- HStack(spacing: 8) {- Text("3.")- .font(.caption2)- .foregroundStyle(theme.palette.accent)- .fontWeight(.semibold)- .frame(width: 16)- Text("Navigate to Applications and select **FluidVoice**")- .font(.caption)- .foregroundStyle(.primary)- }- HStack(spacing: 8) {- Text("4.")- .font(.caption2)- .foregroundStyle(theme.palette.accent)- .fontWeight(.semibold)- .frame(width: 16)- Text("Click **Open**, then toggle **FluidVoice ON** in the list")- .font(.caption)- .foregroundStyle(.primary)- }- }- .padding(.leading, 4)-- // Helper buttons- HStack(spacing: 12) {- Button("Reveal FluidVoice in Finder") {- revealAppInFinder()- }- .buttonStyle(InlineButtonStyle())- .buttonHoverEffect()-- Button("Open Applications Folder") {- openApplicationsFolder()- }- .buttonStyle(InlineButtonStyle())- .buttonHoverEffect()- }- }- .padding(12)- .background(theme.palette.warning.opacity(0.12))- .cornerRadius(8)- }- }-}----diff --git a/Sources/Fluid/UI/WelcomeView.swift b/Sources/Fluid/UI/WelcomeView.swiftindex ffd42b2e..1d53de9f 100644--- a/Sources/Fluid/UI/WelcomeView.swift+++ b/Sources/Fluid/UI/WelcomeView.swift@@ -12,6 +12,7 @@ import AVFoundationstruct WelcomeView: View {@ObservedObject var asr: ASRService@Binding var selectedSidebarItem: SidebarItem?+ @Binding var playgroundUsed: Boolvar isTranscriptionFocused: FocusState<Bool>.Binding@Environment(\.theme) private var theme@@ -21,71 +22,87 @@ struct WelcomeView: View {let openAIBaseURL: Stringlet availableModels: [String]let selectedModel: String- let playgroundUsed: Boollet stopAndProcessTranscription: () async -> Voidlet startRecording: () -> Voidlet isLocalEndpoint: (String) -> Bool+ let openAccessibilitySettings: () -> Voidvar body: some View {ScrollView {- VStack(alignment: .leading, spacing: 20) {+ VStack(alignment: .leading, spacing: 14) {// Header- VStack(alignment: .leading, spacing: 8) {- HStack {- Image(systemName: "book.fill")- .font(.system(size: 32))- .foregroundStyle(theme.palette.accent)- VStack(alignment: .leading) {- Text("Welcome to FluidVoice")- .font(.system(size: 28, weight: .bold))- Text("Your AI-powered voice transcription assistant")- .font(.system(size: 16))- .foregroundStyle(.secondary)- }- }- Text("Follow this quick setup to start using FluidVoice.")- .font(.system(size: 14))- .foregroundStyle(.secondary)- .padding(.top, 4)+ HStack(spacing: 12) {+ Image(systemName: "book.fill")+ .font(.system(size: 24))+ .foregroundStyle(theme.palette.accent)+ Text("Welcome to FluidVoice")+ .font(.system(size: 22, weight: .bold))}- .padding(.bottom, 8)+ .padding(.bottom, 6)// Quick Setup ChecklistThemedCard(style: .prominent) {- VStack(alignment: .leading, spacing: 16) {+ VStack(alignment: .leading, spacing: 10) {HStack {Image(systemName: "checkmark.circle.fill")+ .font(.system(size: 16)).foregroundStyle(theme.palette.accent)Text("Quick Setup")- .font(.headline)+ .font(.system(size: 15, weight: .semibold))}- VStack(alignment: .leading, spacing: 12) {+ VStack(alignment: .leading, spacing: 8) {SetupStepView(step: 1,- title: "Grant Microphone Permission",- description: "Allow FluidVoice to access your microphone for voice input",+ title: asr.micStatus == .authorized ? "Microphone Permission Granted" : "Grant Microphone Permission",+ description: asr.micStatus == .authorized+ ? "FluidVoice has access to your microphone"+ : "Allow FluidVoice to access your microphone for voice input",status: asr.micStatus == .authorized ? .completed : .pending,action: {- selectedSidebarItem = .recording- }+ if asr.micStatus == .notDetermined {+ asr.requestMicAccess()+ } else if asr.micStatus == .denied {+ asr.openSystemSettingsForMic()+ }+ },+ actionButtonTitle: asr.micStatus == .notDetermined ? "Grant Access" : "Open Settings",+ showActionButton: asr.micStatus != .authorized)SetupStepView(step: 2,- title: "Enable Accessibility",- description: "Grant accessibility permission to type text into other apps",+ title: accessibilityEnabled ? "Accessibility Enabled" : "Enable Accessibility",+ description: accessibilityEnabled+ ? "Accessibility permission granted for typing into apps"+ : "Grant accessibility permission to type text into other apps",status: accessibilityEnabled ? .completed : .pending,action: {- selectedSidebarItem = .recording- }+ openAccessibilitySettings()+ },+ actionButtonTitle: "Open Settings",+ showActionButton: !accessibilityEnabled)SetupStepView(step: 3,- title: "Set Up AI Enhancement (Optional)",- description: "Configure API keys for AI-powered text enhancement",+ title: {+ let hasApiKey = providerAPIKeys[currentProvider]?.isEmpty == false+ let isLocal = isLocalEndpoint(openAIBaseURL.trimmingCharacters(in: .whitespacesAndNewlines))+ let hasModel = availableModels.contains(selectedModel)+ let isConfigured = (isLocal || hasApiKey) && hasModel+ return isConfigured ? "AI Enhancement Configured" : "Set Up AI Enhancement (Optional)"+ }(),+ description: {+ let hasApiKey = providerAPIKeys[currentProvider]?.isEmpty == false+ let isLocal = isLocalEndpoint(openAIBaseURL.trimmingCharacters(in: .whitespacesAndNewlines))+ let hasModel = availableModels.contains(selectedModel)+ let isConfigured = (isLocal || hasApiKey) && hasModel+ return isConfigured+ ? "AI-powered text enhancement is ready to use"+ : "Configure API keys for AI-powered text enhancement"+ }(),status: {let hasApiKey = providerAPIKeys[currentProvider]?.isEmpty == falselet isLocal = isLocalEndpoint(openAIBaseURL.trimmingCharacters(in: .whitespacesAndNewlines))@@ -93,46 +110,146 @@ struct WelcomeView: View {return ((isLocal || hasApiKey) && hasModel) ? .completed : .pending}(),action: {- selectedSidebarItem = .aiProcessing- }+ selectedSidebarItem = .aiSettings+ },+ actionButtonTitle: "Configure AI")SetupStepView(step: 4,- title: "Test Your Setup below",- description: "Try the playground below to test your complete setup",+ title: playgroundUsed ? "Setup Tested Successfully" : "Test Your Setup",+ description: playgroundUsed+ ? "You've successfully tested voice transcription"+ : "Try the playground below to test your complete setup",status: playgroundUsed ? .completed : .pending,action: {- // No action needed - playground is right below+ // Scroll to playground or focus on it+ withAnimation {+ isTranscriptionFocused.wrappedValue = true+ }},- showConfigureButton: false+ actionButtonTitle: "Go to Playground",+ showActionButton: !playgroundUsed)+ .id("playground-step-\(playgroundUsed)")+ }+ }+ .padding(14)+ }++ // How to Use - Before playground+ ThemedCard(style: .standard) {+ VStack(alignment: .leading, spacing: 10) {+ HStack {+ Image(systemName: "play.fill")+ .font(.system(size: 16))+ .foregroundStyle(.green)+ Text("How to Use")+ .font(.system(size: 15, weight: .semibold))+ }++ VStack(alignment: .leading, spacing: 8) {+ HStack(alignment: .top, spacing: 10) {+ ZStack {+ Circle()+ .fill(theme.palette.accent.opacity(0.15))+ .frame(width: 28, height: 28)+ Text("1")+ .font(.system(size: 13, weight: .bold))+ .foregroundStyle(theme.palette.accent)+ }+ VStack(alignment: .leading, spacing: 2) {+ Text("Start Recording")+ .font(.system(size: 14, weight: .semibold))+ Text("Press your hotkey (default: Right Option/Alt) or click the button")+ .font(.system(size: 12))+ .foregroundStyle(.secondary)+ }+ }++ HStack(alignment: .top, spacing: 10) {+ ZStack {+ Circle()+ .fill(theme.palette.accent.opacity(0.15))+ .frame(width: 28, height: 28)+ Text("2")+ .font(.system(size: 13, weight: .bold))+ .foregroundStyle(theme.palette.accent)+ }+ VStack(alignment: .leading, spacing: 2) {+ Text("Speak Clearly")+ .font(.system(size: 14, weight: .semibold))+ Text("Speak naturally - works best in quiet environments")+ .font(.system(size: 12))+ .foregroundStyle(.secondary)+ }+ }++ HStack(alignment: .top, spacing: 10) {+ ZStack {+ Circle()+ .fill(theme.palette.accent.opacity(0.15))+ .frame(width: 28, height: 28)+ Text("3")+ .font(.system(size: 13, weight: .bold))+ .foregroundStyle(theme.palette.accent)+ }+ VStack(alignment: .leading, spacing: 2) {+ Text("Auto-Type Result")+ .font(.system(size: 14, weight: .semibold))+ Text("Transcription is automatically typed into your focused app")+ .font(.system(size: 12))+ .foregroundStyle(.secondary)+ }+ }}}- .padding(20)+ .padding(14)}- // Test Playground - Right after setup checklist+ // Test Playground - At the endThemedCard(hoverEffect: false) {- VStack(alignment: .leading, spacing: 16) {+ VStack(alignment: .leading, spacing: 12) {HStack {Image(systemName: "text.bubble")- .font(.title2)+ .font(.system(size: 18)).foregroundStyle(.white)- Text("Test Playground")- .font(.title3)- .fontWeight(.semibold)+ VStack(alignment: .leading, spacing: 2) {+ Text("Test Playground")+ .font(.system(size: 16, weight: .semibold))+ Text("Click record, speak, and see your transcription")+ .font(.system(size: 12))+ .foregroundStyle(.secondary)+ }Spacer()++ // Status indicator+ if asr.isRunning {+ HStack(spacing: 6) {+ Circle()+ .fill(.red)+ .frame(width: 8, height: 8)+ Text("Recording...")+ .font(.system(size: 12, weight: .medium))+ .foregroundStyle(.red)+ }+ } else if !asr.finalText.isEmpty {+ Text("\(asr.finalText.count) characters")+ .font(.system(size: 12))+ .foregroundStyle(.secondary)+ }if !asr.finalText.isEmpty {Button(action: {NSPasteboard.general.clearContents()NSPasteboard.general.setString(asr.finalText, forType: .string)}) {- HStack {+ HStack(spacing: 4) {Image(systemName: "doc.on.doc")+ .font(.system(size: 11))Text("Copy")+ .font(.system(size: 11))}}.buttonStyle(InlineButtonStyle())@@ -140,81 +257,39 @@ struct WelcomeView: View {}}- VStack(alignment: .leading, spacing: 12) {- HStack {- VStack(alignment: .leading, spacing: 4) {- Text("Test your voice transcription here!")- .font(.subheadline)- .fontWeight(.medium)- .foregroundStyle(.secondary)-- Text("• Click 'Start Recording' or use hotkey (Right Option/Alt)")- .font(.caption)- .foregroundStyle(.secondary)+ VStack(alignment: .leading, spacing: 10) {- Text("• Speak naturally - words appear in real-time")- .font(.caption)- .foregroundStyle(.secondary)-- Text("• Click 'Stop Recording' when finished")- .font(.caption)- .foregroundStyle(.secondary)- }-- Spacer()-- VStack(alignment: .trailing, spacing: 4) {+ // Recording Control - Big Premium Button+ VStack(spacing: 10) {+ Button(action: {if asr.isRunning {- HStack {- Image(systemName: "waveform")- .foregroundStyle(.red)- Text("Recording...")- .font(.caption)- .foregroundStyle(.red)- }- } else if !asr.finalText.isEmpty {- Text("\(asr.finalText.count) characters")- .font(.caption)- .foregroundStyle(.secondary)- }- }- }-- // Recording Controls- HStack(spacing: 16) {- if asr.isRunning {- Button(action: {Task {await stopAndProcessTranscription()+ // Mark playground as used when transcription completes successfully+ await MainActor.run {+ // Only mark as used if we actually got some text+ if !asr.finalText.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {+ playgroundUsed = true+ SettingsStore.shared.playgroundUsed = true+ }+ }}- }) {- HStack(spacing: 8) {- Image(systemName: "stop.fill")- .foregroundStyle(.red)- Text("Stop Recording")- .fontWeight(.medium)- }- .padding(.horizontal, 16)- .padding(.vertical, 8)- .background(theme.palette.warning.opacity(0.12))- .clipShape(RoundedRectangle(cornerRadius: 8))- }- } else {- Button(action: {+ } else {startRecording()- }) {- HStack(spacing: 8) {- Image(systemName: "mic.fill")- .foregroundStyle(.green)- Text("Start Recording")- .fontWeight(.medium)- }- .padding(.horizontal, 16)- .padding(.vertical, 8)- .background(theme.palette.success.opacity(0.12))- .clipShape(RoundedRectangle(cornerRadius: 8))}+ }) {+ HStack {+ Image(systemName: asr.isRunning ? "stop.fill" : "mic.fill")+ .font(.system(size: 16, weight: .semibold))+ Text(asr.isRunning ? "Stop Recording" : "Start Recording")+ }+ .frame(maxWidth: .infinity)}+ .buttonStyle(PremiumButtonStyle(isRecording: asr.isRunning))+ .buttonHoverEffect()+ .scaleEffect(asr.isRunning ? 1.05 : 1.0)+ .animation(.spring(response: 0.3), value: asr.isRunning)+ .disabled(!asr.isAsrReady && !asr.isRunning)if !asr.isRunning && !asr.finalText.isEmpty {Button("Clear Results") {@@ -225,91 +300,76 @@ struct WelcomeView: View {}}- // TRANSCRIPTION TEXT AREA - ACTUAL TEXT FIELD- VStack(alignment: .leading, spacing: 12) {- HStack {- Text("Transcription Playground")- .font(.headline)- .fontWeight(.semibold)-- Spacer()-- if !asr.finalText.isEmpty {- Text("\(asr.finalText.count) characters")- .font(.caption)- .foregroundStyle(.secondary)- }- }-+ // TRANSCRIPTION TEXT AREA+ VStack(alignment: .leading, spacing: 8) {// REAL TEXT EDITOR - Can receive focus and display transcriptionTextEditor(text: $asr.finalText)- .font(.system(size: 16))+ .font(.system(size: 13)).focused(isTranscriptionFocused)- .frame(height: 200)- .padding(16)+ .frame(height: 150)+ .padding(12).background(- RoundedRectangle(cornerRadius: 12)+ RoundedRectangle(cornerRadius: 8).fill(- asr.isRunning ? theme.palette.accent.opacity(0.12) : theme.palette.cardBackground.opacity(0.85)+ asr.isRunning ? theme.palette.accent.opacity(0.08) : Color(nsColor: NSColor.textBackgroundColor)).overlay(- RoundedRectangle(cornerRadius: 12)- .stroke(- asr.isRunning ? theme.palette.accent.opacity(0.4) : theme.palette.cardBorder.opacity(0.35),- lineWidth: asr.isRunning ? 2 : 1+ RoundedRectangle(cornerRadius: 8)+ .strokeBorder(+ asr.isRunning ? theme.palette.accent.opacity(0.5) : Color(nsColor: NSColor.separatorColor),+ lineWidth: asr.isRunning ? 2 : 1.5)))+ .scrollContentBackground(.hidden).overlay(VStack {if asr.isRunning {- VStack(spacing: 12) {+ VStack(spacing: 8) {// Animated recording indicator overlay- HStack(spacing: 8) {+ HStack(spacing: 6) {Image(systemName: "waveform")- .font(.system(size: 24))+ .font(.system(size: 18)).foregroundStyle(theme.palette.accent).scaleEffect(1.0).animation(.easeInOut(duration: 0.8).repeatForever(), value: asr.isRunning)Image(systemName: "waveform")- .font(.system(size: 20))+ .font(.system(size: 16)).foregroundStyle(theme.palette.accent.opacity(0.7)).scaleEffect(1.0).animation(.easeInOut(duration: 0.6).repeatForever(), value: asr.isRunning)Image(systemName: "waveform")- .font(.system(size: 16))+ .font(.system(size: 14)).foregroundStyle(theme.palette.accent.opacity(0.5)).scaleEffect(1.0).animation(.easeInOut(duration: 0.4).repeatForever(), value: asr.isRunning)}- VStack(spacing: 4) {+ VStack(spacing: 2) {Text("Listening... Speak now!")- .font(.title3)- .fontWeight(.semibold)+ .font(.system(size: 16, weight: .semibold)).foregroundStyle(theme.palette.accent)- Text("Your words will appear here in real-time")- .font(.subheadline)+ Text("Transcription will appear when you stop recording")+ .font(.system(size: 12)).foregroundStyle(theme.palette.accent.opacity(0.8))}}} else if asr.finalText.isEmpty {- VStack(spacing: 12) {+ VStack(spacing: 8) {Image(systemName: "text.bubble")- .font(.system(size: 32))+ .font(.system(size: 24)).foregroundStyle(.secondary.opacity(0.6))- VStack(spacing: 4) {+ VStack(spacing: 2) {Text("Ready to test!")- .font(.title3)- .fontWeight(.semibold)+ .font(.system(size: 16, weight: .semibold)).foregroundStyle(.primary)Text("Click 'Start Recording' or press your hotkey")- .font(.subheadline)+ .font(.system(size: 12)).foregroundStyle(.secondary)}}@@ -320,139 +380,42 @@ struct WelcomeView: View {// Quick Action Buttonsif !asr.finalText.isEmpty {- HStack(spacing: 12) {+ HStack(spacing: 8) {Button(action: {NSPasteboard.general.clearContents()NSPasteboard.general.setString(asr.finalText, forType: .string)}) {- HStack(spacing: 6) {+ HStack(spacing: 4) {Image(systemName: "doc.on.doc")+ .font(.system(size: 11))Text("Copy Text")+ .font(.system(size: 12))}- .padding(.horizontal, 16)- .padding(.vertical, 8)+ .padding(.horizontal, 10)+ .padding(.vertical, 5).background(theme.palette.accent.opacity(0.12)).foregroundStyle(theme.palette.accent)- .cornerRadius(8)+ .cornerRadius(6)}Button("Clear & Test Again") {asr.finalText = ""}.buttonStyle(.bordered)- .controlSize(.regular)+ .controlSize(.small)Spacer()}- .padding(.top, 8)+ .padding(.top, 6)}}}}- .padding(20)- }-- // How to Use- ThemedCard(style: .standard) {- VStack(alignment: .leading, spacing: 16) {- HStack {- Image(systemName: "play.fill")- .foregroundStyle(.green)- Text("How to Use")- .font(.headline)- }-- VStack(alignment: .leading, spacing: 16) {- InstructionStep(- number: 1,- title: "Start Recording",- description: "Use your hotkey (default: Right Option/Alt) or click the record button in the main window"- )-- InstructionStep(- number: 2,- title: "Speak Clearly",- description: "Speak your text naturally. The app works best in quiet environments"- )-- InstructionStep(- number: 3,- title: "AI Enhancement",- description: "Your speech is transcribed, then enhanced by AI for better grammar and clarity"- )-- InstructionStep(- number: 4,- title: "Auto-Type Result",- description: "The enhanced text is automatically typed into your focused application"- )- }- }- .padding(20)+ .padding(14)}- // API Configuration Guide- ThemedCard(style: .prominent) {- VStack(alignment: .leading, spacing: 16) {- HStack {- Image(systemName: "key.fill")- .foregroundStyle(.purple)- Text("Get API Keys")- .font(.headline)- }-- VStack(alignment: .leading, spacing: 16) {- Text("Choose your AI provider:")- .font(.subheadline)- .foregroundStyle(.secondary)-- ProviderGuide(- name: "OpenAI",- url: "https://platform.openai.com/api-keys",- description: "Most popular choice with GPT-4.1 models",- baseURL: "https://api.openai.com/v1",- keyPrefix: "sk-"- )-- ProviderGuide(- name: "Groq",- url: "https://console.groq.com/keys",- description: "Fast inference with Llama and Mixtral models",- baseURL: "https://api.groq.com/openai/v1",- keyPrefix: "gsk_"- )-- // Local Models Coming Soon- ThemedCard(hoverEffect: false) {- VStack(alignment: .leading, spacing: 8) {- HStack {- Text("Local Models")- .font(.system(size: 14, weight: .semibold))- .foregroundStyle(.secondary)-- Spacer()-- Text("Coming Soon")- .font(.system(size: 12))- .foregroundStyle(theme.palette.warning)- .padding(.horizontal, 8)- .padding(.vertical, 2)- .background(theme.palette.warning.opacity(0.12))- .cornerRadius(8)- }-- Text("Run models locally for privacy and offline use")- .font(.system(size: 13))- .foregroundStyle(.secondary)- }- .padding(12)- }- }- }- .padding(20)- }}- .padding(20)+ .padding(16)}}}diff --git a/Sources/Fluid/UI/WhatsNewView.swift b/Sources/Fluid/UI/WhatsNewView.swiftindex 49553862..8929fb48 100644--- a/Sources/Fluid/UI/WhatsNewView.swift+++ b/Sources/Fluid/UI/WhatsNewView.swift@@ -142,67 +142,121 @@ struct WhatsNewView: View {private func parseReleaseNotes(_ notes: String) -> [WhatsNewFeature] {var features: [WhatsNewFeature] = []+ print("📝 Parsing release notes:")+ print(notes)+ print("---")+// Parse markdown format:- // - Look for bullet points (-, *, +)- // - Look for headings (##, ###)- // - Extract feature descriptions+ // Expected structure:+ // ## What's New in vX.X.X+ // ### Section (e.g., "New", "Improvements")+ // - Feature item+ // - Another featurelet lines = notes.components(separatedBy: .newlines)var currentTitle: String?var currentDescription = ""+ var currentSection = "" // Track section headers like "New", "Improvements"for line in lines {let trimmed = line.trimmingCharacters(in: .whitespaces)// Skip empty linesif trimmed.isEmpty {+ // Empty line might signal end of current feature+ if let title = currentTitle, !title.isEmpty {+ let desc = currentDescription.isEmpty ? "New feature or improvement" : currentDescription+ features.append(createFeature(title: title, description: desc))+ print("✅ Added feature: \(title)")+ currentTitle = nil+ currentDescription = ""+ }+ continue+ }++ // Skip main heading (## What's New...)+ if trimmed.hasPrefix("##") && !trimmed.hasPrefix("###") {+ // This is the main title, skip itcontinue}- // Check for bullet points or list items- if trimmed.hasPrefix("- ") || trimmed.hasPrefix("* ") || trimmed.hasPrefix("+ ") {+ // Section headers (### New, ### Improvements, etc.)+ if trimmed.hasPrefix("###") {// Save previous feature if exists- if let title = currentTitle, !currentDescription.isEmpty {- features.append(createFeature(title: title, description: currentDescription))+ if let title = currentTitle, !title.isEmpty {+ let desc = currentDescription.isEmpty ? "New feature or improvement" : currentDescription+ features.append(createFeature(title: title, description: desc))+ print("✅ Added feature: \(title)")+ currentTitle = nil+ currentDescription = ""}- // Extract new feature- let content = String(trimmed.dropFirst(2)).trimmingCharacters(in: .whitespaces)+ // This is a section header, not a feature+ currentSection = String(trimmed.dropFirst(3)).trimmingCharacters(in: .whitespaces)+ print("📂 Section: \(currentSection)")+ continue+ }++ // Check for bullet points or list items (supporting nested with spaces/tabs)+ let bulletPrefixes = ["- ", "* ", "+ ", " - ", " * ", " + ", "\t- ", "\t* ", "\t+ "]+ var isBullet = false+ var bulletContent = ""++ for prefix in bulletPrefixes {+ if trimmed.hasPrefix(prefix) {+ isBullet = true+ bulletContent = String(trimmed.dropFirst(prefix.count)).trimmingCharacters(in: .whitespaces)+ break+ }+ }++ if isBullet {+ // Save previous feature if exists+ if let title = currentTitle, !title.isEmpty {+ let desc = currentDescription.isEmpty ? "New feature or improvement" : currentDescription+ features.append(createFeature(title: title, description: desc))+ print("✅ Added feature: \(title)")+ }// Check if it has a colon (title: description format)- if let colonIndex = content.firstIndex(of: ":") {- currentTitle = String(content[..<colonIndex]).trimmingCharacters(in: .whitespaces)- currentDescription = String(content[content.index(after: colonIndex)...]).trimmingCharacters(in: .whitespaces)+ if let colonIndex = bulletContent.firstIndex(of: ":") {+ currentTitle = String(bulletContent[..<colonIndex]).trimmingCharacters(in: .whitespaces)+ currentDescription = String(bulletContent[bulletContent.index(after: colonIndex)...]).trimmingCharacters(in: .whitespaces)} else {- // Entire content is the title/description- currentTitle = content+ // Entire content is the title, use section as context for description+ currentTitle = bulletContent+ // If we have a section context and no description, use it+ if !currentSection.isEmpty {+ currentDescription = currentSection+ } else {currentDescription = ""}}- // Check for headings (secondary features)- else if trimmed.hasPrefix("###") {- if let title = currentTitle, !currentDescription.isEmpty {- features.append(createFeature(title: title, description: currentDescription))- }- currentTitle = String(trimmed.dropFirst(3)).trimmingCharacters(in: .whitespaces)- currentDescription = ""}- // Continuation of description- else if currentTitle != nil && !trimmed.hasPrefix("#") {- if !currentDescription.isEmpty {+ // Continuation of description (only if we have a current item and not starting a new section)+ else if let title = currentTitle, !title.isEmpty, !trimmed.hasPrefix("#") {+ // Add to description if it's a continuation+ if currentDescription == currentSection {+ // Replace section placeholder with actual description+ currentDescription = trimmed+ } else {+ if !currentDescription.isEmpty && currentDescription != currentSection {currentDescription += " "}currentDescription += trimmed}+ }}- // Add last feature- if let title = currentTitle, !currentDescription.isEmpty {- features.append(createFeature(title: title, description: currentDescription))- } else if let title = currentTitle {- features.append(createFeature(title: title, description: title))+ // Add last feature if exists+ if let title = currentTitle, !title.isEmpty {+ let desc = currentDescription.isEmpty || currentDescription == currentSection ? "New feature or improvement" : currentDescription+ features.append(createFeature(title: title, description: desc))+ print("✅ Added feature: \(title)")}+ print("📊 Total features parsed: \(features.count)")+return features}