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
Added more fetures to cmd mode - recent chat, new cht, del chat etc both on notch and UI + bug fixes wrt notch
altic-dev4f644a6e4545
diff --git a/Sources/Fluid/ContentView.swift b/Sources/Fluid/ContentView.swiftindex d3ce530a..1fe9c156 100644--- a/Sources/Fluid/ContentView.swift+++ b/Sources/Fluid/ContentView.swift@@ -180,6 +180,24 @@ struct ContentView: View {}}+ // Set up command mode callbacks for notch+ NotchOverlayManager.shared.onCommandFollowUp = { [weak commandModeService] text in+ await commandModeService?.processFollowUpCommand(text)+ }++ // Chat management callbacks+ NotchOverlayManager.shared.onNewChat = { [weak commandModeService] in+ commandModeService?.createNewChat()+ }++ NotchOverlayManager.shared.onSwitchChat = { [weak commandModeService] chatID in+ commandModeService?.switchToChat(id: chatID)+ }++ NotchOverlayManager.shared.onClearChat = { [weak commandModeService] in+ commandModeService?.deleteCurrentChat()+ }+// Start polling for accessibility permission if not grantedstartAccessibilityPolling()diff --git a/Sources/Fluid/Persistence/ChatHistoryStore.swift b/Sources/Fluid/Persistence/ChatHistoryStore.swiftnew file mode 100644index 00000000..52b505b0--- /dev/null+++ b/Sources/Fluid/Persistence/ChatHistoryStore.swift@@ -0,0 +1,268 @@+//+// ChatHistoryStore.swift+// Fluid+//+// Persistence manager for Command Mode chat history+//++import Foundation+import Combine++// MARK: - Chat Message Model (Codable version of CommandModeService.Message)++struct ChatMessage: Codable, Identifiable, Equatable {+ let id: UUID+ let role: Role+ let content: String+ let toolCall: ToolCall?+ let stepType: StepType+ let timestamp: Date++ enum Role: String, Codable, Equatable {+ case user+ case assistant+ case tool+ }++ enum StepType: String, Codable, Equatable {+ case normal+ case thinking+ case checking+ case executing+ case verifying+ case success+ case failure+ }++ struct ToolCall: Codable, Equatable {+ let id: String+ let command: String+ let workingDirectory: String?+ let purpose: String?+ }++ init(id: UUID = UUID(), role: Role, content: String, toolCall: ToolCall? = nil, stepType: StepType = .normal, timestamp: Date = Date()) {+ self.id = id+ self.role = role+ self.content = content+ self.toolCall = toolCall+ self.stepType = stepType+ self.timestamp = timestamp+ }+}++// MARK: - Chat Session Model++struct ChatSession: Codable, Identifiable, Equatable {+ let id: String+ var title: String+ let createdAt: Date+ var updatedAt: Date+ var messages: [ChatMessage]++ init(id: String = UUID().uuidString, title: String = "New Chat", createdAt: Date = Date(), updatedAt: Date = Date(), messages: [ChatMessage] = []) {+ self.id = id+ self.title = title+ self.createdAt = createdAt+ self.updatedAt = updatedAt+ self.messages = messages+ }++ /// Generate title from first user message (max 50 chars)+ mutating func updateTitleFromFirstMessage() {+ guard let firstUserMessage = messages.first(where: { $0.role == .user }) else { return }+ let content = firstUserMessage.content.trimmingCharacters(in: .whitespacesAndNewlines)+ if content.count > 50 {+ title = String(content.prefix(47)) + "..."+ } else {+ title = content.isEmpty ? "New Chat" : content+ }+ }++ /// Relative time string for display+ var relativeTimeString: String {+ let formatter = RelativeDateTimeFormatter()+ formatter.unitsStyle = .abbreviated+ return formatter.localizedString(for: updatedAt, relativeTo: Date())+ }+}++// MARK: - Chat History Store++@MainActor+final class ChatHistoryStore: ObservableObject {+ static let shared = ChatHistoryStore()++ private let defaults = UserDefaults.standard+ private let maxChats = 30++ private enum Keys {+ static let chatSessions = "CommandModeChatSessions"+ static let currentChatID = "CommandModeCurrentChatID"+ }++ @Published private(set) var sessions: [ChatSession] = []+ @Published var currentChatID: String?++ private init() {+ loadSessions()++ // Ensure there's always a current chat+ if currentChatID == nil || sessions.first(where: { $0.id == currentChatID }) == nil {+ if let first = sessions.first {+ currentChatID = first.id+ } else {+ // Create initial chat+ let newChat = ChatSession()+ sessions = [newChat]+ currentChatID = newChat.id+ saveSessions()+ }+ }+ }++ // MARK: - Public Methods++ /// Get the current active chat session+ var currentSession: ChatSession? {+ guard let id = currentChatID else { return nil }+ return sessions.first(where: { $0.id == id })+ }++ /// Get recent chats for dropdown (excluding current, sorted by updatedAt)+ func getRecentChats(excludingCurrent: Bool = true) -> [ChatSession] {+ var result = sessions.sorted { $0.updatedAt > $1.updatedAt }+ if excludingCurrent, let currentID = currentChatID {+ result = result.filter { $0.id != currentID }+ }+ return result+ }++ /// Create a new chat and set it as current+ @discardableResult+ func createNewChat() -> ChatSession {+ let newChat = ChatSession()+ sessions.insert(newChat, at: 0)+ currentChatID = newChat.id++ // Trim old chats if over limit+ trimOldChats()+ saveSessions()++ return newChat+ }++ /// Save/update a chat session+ func saveChat(_ session: ChatSession) {+ if let index = sessions.firstIndex(where: { $0.id == session.id }) {+ var updated = session+ updated.updatedAt = Date()+ sessions[index] = updated+ } else {+ var updated = session+ updated.updatedAt = Date()+ sessions.insert(updated, at: 0)+ }++ trimOldChats()+ saveSessions()+ }++ /// Update current chat with messages+ func updateCurrentChat(messages: [ChatMessage]) {+ guard let id = currentChatID,+ let index = sessions.firstIndex(where: { $0.id == id }) else { return }++ var session = sessions[index]+ session.messages = messages+ session.updatedAt = Date()+ session.updateTitleFromFirstMessage()+ sessions[index] = session++ saveSessions()+ }++ /// Load a chat by ID and set as current+ func loadChat(id: String) -> ChatSession? {+ guard let session = sessions.first(where: { $0.id == id }) else { return nil }+ currentChatID = id+ saveCurrentChatID()+ return session+ }++ /// Switch to a different chat+ func switchToChat(id: String) -> ChatSession? {+ return loadChat(id: id)+ }++ /// Delete a chat by ID+ func deleteChat(id: String) {+ sessions.removeAll { $0.id == id }++ // If deleted current chat, switch to most recent or create new+ if currentChatID == id {+ if let first = sessions.sorted(by: { $0.updatedAt > $1.updatedAt }).first {+ currentChatID = first.id+ } else {+ // No chats left, create new+ let newChat = createNewChat()+ currentChatID = newChat.id+ }+ }++ saveSessions()+ }++ /// Delete current chat and switch to next+ func deleteCurrentChat() {+ guard let id = currentChatID else { return }+ deleteChat(id: id)+ }++ /// Clear current chat (delete messages but keep session)+ func clearCurrentChat() {+ guard let id = currentChatID,+ let index = sessions.firstIndex(where: { $0.id == id }) else { return }++ sessions[index].messages = []+ sessions[index].title = "New Chat"+ sessions[index].updatedAt = Date()++ saveSessions()+ }++ // MARK: - Private Methods++ private func loadSessions() {+ guard let data = defaults.data(forKey: Keys.chatSessions),+ let decoded = try? JSONDecoder().decode([ChatSession].self, from: data) else {+ sessions = []+ return+ }+ sessions = decoded++ // Load current chat ID+ currentChatID = defaults.string(forKey: Keys.currentChatID)+ }++ private func saveSessions() {+ if let encoded = try? JSONEncoder().encode(sessions) {+ defaults.set(encoded, forKey: Keys.chatSessions)+ }+ saveCurrentChatID()+ objectWillChange.send()+ }++ private func saveCurrentChatID() {+ defaults.set(currentChatID, forKey: Keys.currentChatID)+ }++ private func trimOldChats() {+ if sessions.count > maxChats {+ // Sort by updatedAt and keep most recent+ let sorted = sessions.sorted { $0.updatedAt > $1.updatedAt }+ sessions = Array(sorted.prefix(maxChats))+ }+ }+}+diff --git a/Sources/Fluid/Services/CommandModeService.swift b/Sources/Fluid/Services/CommandModeService.swiftindex feb5623e..a8157f23 100644--- a/Sources/Fluid/Services/CommandModeService.swift+++ b/Sources/Fluid/Services/CommandModeService.swift@@ -8,8 +8,10 @@ final class CommandModeService: ObservableObject {@Published var pendingCommand: PendingCommand? = nil@Published var currentStep: AgentStep? = nil@Published var streamingText: String = "" // Real-time streaming text for UI+ @Published private(set) var currentChatID: String?private let terminalService = TerminalService()+ private let chatStore = ChatHistoryStore.sharedprivate var currentTurnCount = 0private let maxTurns = 20@@ -20,6 +22,26 @@ final class CommandModeService: ObservableObject {private var lastUIUpdate: CFAbsoluteTime = 0private var streamingBuffer: [String] = [] // Buffer tokens instead of string concat+ // MARK: - Initialization++ init() {+ // Load current chat from store+ loadCurrentChatFromStore()+ }++ private func loadCurrentChatFromStore() {+ if let session = chatStore.currentSession {+ currentChatID = session.id+ conversationHistory = session.messages.map { chatMessageToMessage($0) }+ syncToNotchState()+ } else {+ // Create new chat if none exists+ let newSession = chatStore.createNewChat()+ currentChatID = newSession.id+ conversationHistory = []+ }+ }+// MARK: - Agent Step Trackingenum AgentStep: Equatable {@@ -86,10 +108,187 @@ final class CommandModeService: ObservableObject {pendingCommand = nilcurrentTurnCount = 0+ // Clear in store as well+ chatStore.clearCurrentChat()+// Also clear notch stateNotchContentState.shared.clearCommandOutput()}+ // MARK: - Chat Management++ /// Get recent chats for dropdown+ func getRecentChats() -> [ChatSession] {+ return chatStore.getRecentChats(excludingCurrent: false)+ }++ /// Create a new chat and switch to it+ func createNewChat() {+ // Can't switch while processing+ guard !isProcessing else { return }++ // Save current chat first+ saveCurrentChat()++ // Create new+ let newSession = chatStore.createNewChat()+ currentChatID = newSession.id+ conversationHistory = []+ pendingCommand = nil+ currentTurnCount = 0+ currentStep = nil++ // Clear notch state+ NotchContentState.shared.clearCommandOutput()+ NotchContentState.shared.refreshRecentChats()+ }++ /// Switch to a different chat by ID+ /// Returns false if switching is blocked (e.g., during processing)+ @discardableResult+ func switchToChat(id: String) -> Bool {+ // Can't switch while processing+ guard !isProcessing else { return false }++ // Don't switch to current+ guard id != currentChatID else { return true }++ // Save current chat first+ saveCurrentChat()++ // Load the target chat+ guard let session = chatStore.switchToChat(id: id) else { return false }++ currentChatID = session.id+ conversationHistory = session.messages.map { chatMessageToMessage($0) }+ pendingCommand = nil+ currentTurnCount = 0+ currentStep = nil++ // Sync to notch state+ syncToNotchState()+ NotchContentState.shared.refreshRecentChats()++ return true+ }++ /// Delete current chat and switch to next+ func deleteCurrentChat() {+ // Can't delete while processing+ guard !isProcessing else { return }++ chatStore.deleteCurrentChat()++ // Load the new current chat+ loadCurrentChatFromStore()+ NotchContentState.shared.refreshRecentChats()+ }++ /// Save current conversation to store+ func saveCurrentChat() {+ guard let chatID = currentChatID else { return }++ let messages = conversationHistory.map { messageToChatMessage($0) }+ chatStore.updateCurrentChat(messages: messages)+ }++ // MARK: - Conversion Helpers++ private func messageToChatMessage(_ msg: Message) -> ChatMessage {+ let role: ChatMessage.Role+ switch msg.role {+ case .user: role = .user+ case .assistant: role = .assistant+ case .tool: role = .tool+ }++ let stepType: ChatMessage.StepType+ switch msg.stepType {+ case .normal: stepType = .normal+ case .thinking: stepType = .thinking+ case .checking: stepType = .checking+ case .executing: stepType = .executing+ case .verifying: stepType = .verifying+ case .success: stepType = .success+ case .failure: stepType = .failure+ }++ var toolCall: ChatMessage.ToolCall? = nil+ if let tc = msg.toolCall {+ toolCall = ChatMessage.ToolCall(+ id: tc.id,+ command: tc.command,+ workingDirectory: tc.workingDirectory,+ purpose: tc.purpose+ )+ }++ return ChatMessage(+ id: msg.id,+ role: role,+ content: msg.content,+ toolCall: toolCall,+ stepType: stepType,+ timestamp: msg.timestamp+ )+ }++ private func chatMessageToMessage(_ chatMsg: ChatMessage) -> Message {+ let role: Message.Role+ switch chatMsg.role {+ case .user: role = .user+ case .assistant: role = .assistant+ case .tool: role = .tool+ }++ let stepType: Message.StepType+ switch chatMsg.stepType {+ case .normal: stepType = .normal+ case .thinking: stepType = .thinking+ case .checking: stepType = .checking+ case .executing: stepType = .executing+ case .verifying: stepType = .verifying+ case .success: stepType = .success+ case .failure: stepType = .failure+ }++ var toolCall: Message.ToolCall? = nil+ if let tc = chatMsg.toolCall {+ toolCall = Message.ToolCall(+ id: tc.id,+ command: tc.command,+ workingDirectory: tc.workingDirectory,+ purpose: tc.purpose+ )+ }++ return Message(+ role: role,+ content: chatMsg.content,+ toolCall: toolCall,+ stepType: stepType+ )+ }++ /// Sync conversation history to NotchContentState+ private func syncToNotchState() {+ NotchContentState.shared.clearCommandOutput()++ for msg in conversationHistory {+ let role: NotchContentState.CommandOutputMessage.Role+ switch msg.role {+ case .user: role = .user+ case .assistant: role = .assistant+ case .tool: role = .status // Tool outputs shown as status in notch+ }++ // Skip tool outputs in notch (they're verbose)+ if msg.role == .tool { continue }++ NotchContentState.shared.addCommandMessage(role: role, content: msg.content)+ }+ }+/// Process user voice/text commandfunc processUserCommand(_ text: String) async {guard !text.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty else { return }@@ -98,6 +297,9 @@ final class CommandModeService: ObservableObject {currentTurnCount = 0conversationHistory.append(Message(role: .user, content: text))+ // Auto-save after adding user message+ saveCurrentChat()+// Push to notchif enableNotchOutput {NotchContentState.shared.addCommandMessage(role: .user, content: text)@@ -115,6 +317,9 @@ final class CommandModeService: ObservableObject {conversationHistory.append(Message(role: .user, content: text))NotchContentState.shared.addCommandMessage(role: .user, content: text)+ // Auto-save after adding user message+ saveCurrentChat()+isProcessing = trueNotchContentState.shared.setCommandProcessing(true)@@ -155,6 +360,9 @@ final class CommandModeService: ObservableObject {isProcessing = falsecurrentStep = .completed(false)+ // Auto-save on completion+ saveCurrentChat()+// Push to notchif enableNotchOutput {NotchContentState.shared.addCommandMessage(role: .assistant, content: errorMsg)@@ -236,6 +444,9 @@ final class CommandModeService: ObservableObject {isProcessing = falsecurrentStep = .completed(isFinal)+ // Auto-save on completion+ saveCurrentChat()+// Push final response to notch and show expanded viewif enableNotchOutput {NotchContentState.shared.updateCommandStreamingText("") // Clear streaming@@ -255,6 +466,9 @@ final class CommandModeService: ObservableObject {isProcessing = falsecurrentStep = .completed(false)+ // Auto-save on error+ saveCurrentChat()+// Push error to notchif enableNotchOutput {NotchContentState.shared.addCommandMessage(role: .assistant, content: errorMsg)diff --git a/Sources/Fluid/Services/NotchOverlayManager.swift b/Sources/Fluid/Services/NotchOverlayManager.swiftindex b552d4de..f2378b55 100644--- a/Sources/Fluid/Services/NotchOverlayManager.swift+++ b/Sources/Fluid/Services/NotchOverlayManager.swift@@ -50,6 +50,11 @@ final class NotchOverlayManager {var onCommandFollowUp: ((String) async -> Void)?var onNotchClicked: (() -> Void)? // Called when regular notch is clicked in command mode+ // Callbacks for chat management+ var onNewChat: (() -> Void)?+ var onSwitchChat: ((String) -> Void)?+ var onClearChat: (() -> Void)?+// Generation counter to track show/hide cycles and prevent race conditions// Uses UInt64 to avoid overflow concerns in long-running sessionsprivate var generation: UInt64 = 0@@ -302,6 +307,25 @@ final class NotchOverlayManager {},onSubmit: { [weak self] text inawait self?.onCommandFollowUp?(text)+ },+ onNewChat: { [weak self] in+ Task { @MainActor in+ self?.onNewChat?()+ // Refresh recent chats in notch state+ NotchContentState.shared.refreshRecentChats()+ }+ },+ onSwitchChat: { [weak self] chatID in+ Task { @MainActor in+ self?.onSwitchChat?(chatID)+ // Refresh recent chats in notch state+ NotchContentState.shared.refreshRecentChats()+ }+ },+ onClearChat: { [weak self] in+ Task { @MainActor in+ self?.onClearChat?()+ }})} compactLeading: {diff --git a/Sources/Fluid/UI/WelcomeView.swift b/Sources/Fluid/UI/WelcomeView.swiftindex f962994f..60612a65 100644--- a/Sources/Fluid/UI/WelcomeView.swift+++ b/Sources/Fluid/UI/WelcomeView.swift@@ -169,6 +169,7 @@ struct WelcomeView: View {.foregroundStyle(.green)Text("How to Use").font(.system(size: 15, weight: .semibold))+ Spacer()}VStack(alignment: .leading, spacing: 12) {@@ -188,6 +189,7 @@ struct WelcomeView: View {.font(.system(size: 13)).foregroundStyle(.secondary)}+ Spacer()}HStack(alignment: .top, spacing: 10) {@@ -206,6 +208,7 @@ struct WelcomeView: View {.font(.system(size: 13)).foregroundStyle(.secondary)}+ Spacer()}HStack(alignment: .top, spacing: 10) {@@ -224,10 +227,12 @@ struct WelcomeView: View {.font(.system(size: 13)).foregroundStyle(.secondary)}+ Spacer()}}.padding(.vertical, 8)}+ .frame(maxWidth: .infinity, alignment: .leading).padding(14)}.frame(maxWidth: .infinity)diff --git a/Sources/Fluid/Views/CommandModeView.swift b/Sources/Fluid/Views/CommandModeView.swiftindex 5782ed5b..bd4af67d 100644--- a/Sources/Fluid/Views/CommandModeView.swift+++ b/Sources/Fluid/Views/CommandModeView.swift@@ -43,9 +43,13 @@ struct CommandModeView: View {}.onAppear {updateAvailableModels()- // Note: Overlay mode is now set centrally by ContentView.handleModeTransition()+ // Disable notch output when using in-app UI (conversation is shared but notch shouldn't show)+ service.enableNotchOutput = false+ }+ .onDisappear {+ // Re-enable notch output when leaving in-app UI+ service.enableNotchOutput = true}- // Note: onDisappear overlay mode handling removed - now handled centrally by ContentView.onChange(of: asr.finalText) { newText inif !newText.isEmpty {inputText = newText@@ -80,68 +84,82 @@ struct CommandModeView: View {Spacer()- // Confirm Before Execute Toggle- Toggle(isOn: $settings.commandModeConfirmBeforeExecute) {- Label("Confirm", systemImage: "checkmark.shield")- .font(.caption)- }- .toggleStyle(.checkbox)- .help("Ask for confirmation before running commands")-- Divider()- .frame(height: 20)- .padding(.horizontal, 8)-- // Provider Selector (independent for Command Mode)- Picker("", selection: $settings.commandModeSelectedProviderID) {- Text("OpenAI").tag("openai")- Text("Groq").tag("groq")-- // Apple Intelligence - disabled for Command Mode (no tool support)- Text("Apple Intelligence (No tools)")- .foregroundColor(.secondary)- .tag("apple-intelligence-disabled")+ // Chat management buttons+ HStack(spacing: 4) {+ // New Chat Button+ Button(action: { service.createNewChat() }) {+ Image(systemName: "plus")+ }+ .buttonStyle(.bordered)+ .help("New chat")+ .disabled(service.isProcessing)- ForEach(settings.savedProviders) { provider in- Text(provider.name).tag(provider.id)+ // Recent Chats Menu+ Menu {+ let recentChats = service.getRecentChats()+ if recentChats.isEmpty {+ Text("No recent chats")+ .foregroundStyle(.secondary)+ } else {+ ForEach(recentChats) { chat in+ Button(action: {+ if chat.id != service.currentChatID {+ service.switchToChat(id: chat.id)+ }+ }) {+ HStack {+ if chat.id == service.currentChatID {+ Image(systemName: "checkmark")+ .font(.caption)+ }+ Text(chat.title)+ .lineLimit(1)+ Spacer()+ Text(chat.relativeTimeString)+ .font(.caption)+ .foregroundStyle(.secondary)+ }+ }+ .disabled(service.isProcessing)+ }+ }+ } label: {+ Image(systemName: "clock.arrow.circlepath")}- }- .frame(width: 140)- .onChange(of: settings.commandModeSelectedProviderID) { newValue in- // Prevent selecting disabled Apple Intelligence- if newValue == "apple-intelligence-disabled" || newValue == "apple-intelligence" {- settings.commandModeSelectedProviderID = "openai"+ .menuStyle(.borderlessButton)+ .frame(width: 32, height: 24)+ .help("Recent chats")++ // Delete Chat Button - deletes the current chat entirely+ Button(action: { showingClearConfirmation = true }) {+ Image(systemName: "trash")}+ .buttonStyle(.bordered)+ .help("Delete chat")+ .disabled(service.isProcessing)}- // Model Selector- Picker("", selection: Binding(- get: { settings.commandModeSelectedModel ?? availableModels.first ?? "gpt-4o" },- set: { settings.commandModeSelectedModel = $0 }- )) {- ForEach(availableModels, id: \.self) { model in- Text(model).tag(model)- }- }- .frame(width: 160)+ Divider()+ .frame(height: 20)+ .padding(.horizontal, 8)- // Clear Chat- Button(action: { showingClearConfirmation = true }) {- Image(systemName: "trash")+ // Confirm Before Execute Toggle+ Toggle(isOn: $settings.commandModeConfirmBeforeExecute) {+ Label("Confirm", systemImage: "checkmark.shield")+ .font(.caption)}- .buttonStyle(.bordered)- .help("Clear conversation")- .disabled(service.conversationHistory.isEmpty)+ .toggleStyle(.checkbox)+ .help("Ask for confirmation before running commands")}.padding().background(Color(nsColor: .windowBackgroundColor)).confirmationDialog(- "Clear conversation?",+ "Delete this chat?",isPresented: $showingClearConfirmation,titleVisibility: .visible) {- Button("Clear", role: .destructive) {- service.clearHistory()+ Button("Delete", role: .destructive) {+ service.deleteCurrentChat()}Button("Cancel", role: .cancel) {}}@@ -419,7 +437,41 @@ struct CommandModeView: View {// MARK: - Input Areaprivate var inputArea: some View {- HStack {+ HStack(spacing: 8) {+ // Provider Selector (compact)+ Picker("", selection: $settings.commandModeSelectedProviderID) {+ Text("OpenAI").tag("openai")+ Text("Groq").tag("groq")++ // Apple Intelligence - disabled for Command Mode (no tool support)+ Text("Apple Intelligence (No tools)")+ .foregroundColor(.secondary)+ .tag("apple-intelligence-disabled")++ ForEach(settings.savedProviders) { provider in+ Text(provider.name).tag(provider.id)+ }+ }+ .frame(width: 110)+ .onChange(of: settings.commandModeSelectedProviderID) { newValue in+ // Prevent selecting disabled Apple Intelligence+ if newValue == "apple-intelligence-disabled" || newValue == "apple-intelligence" {+ settings.commandModeSelectedProviderID = "openai"+ }+ }++ // Model Selector (compact)+ Picker("", selection: Binding(+ get: { settings.commandModeSelectedModel ?? availableModels.first ?? "gpt-4o" },+ set: { settings.commandModeSelectedModel = $0 }+ )) {+ ForEach(availableModels, id: \.self) { model in+ Text(model).tag(model)+ }+ }+ .frame(width: 130)++ // Input field (flexible)TextField("Type a command or ask a question...", text: $inputText).textFieldStyle(.roundedBorder).onSubmit {diff --git a/Sources/Fluid/Views/NotchContentViews.swift b/Sources/Fluid/Views/NotchContentViews.swiftindex 5b5280a0..0d995b05 100644--- a/Sources/Fluid/Views/NotchContentViews.swift+++ b/Sources/Fluid/Views/NotchContentViews.swift@@ -30,6 +30,10 @@ class NotchContentState: ObservableObject {@Published var commandConversationHistory: [CommandOutputMessage] = []@Published var isCommandProcessing: Bool = false+ // MARK: - Chat History State+ @Published var recentChats: [ChatSession] = []+ @Published var currentChatTitle: String = "New Chat"+// Command output message modelstruct CommandOutputMessage: Identifiable, Equatable {let id = UUID()@@ -148,6 +152,16 @@ class NotchContentState: ObservableObject {func collapseCommandOutput() {isExpandedForCommandOutput = false}++ // MARK: - Chat History Methods++ /// Refresh recent chats from store+ func refreshRecentChats() {+ recentChats = ChatHistoryStore.shared.getRecentChats(excludingCurrent: false)+ if let current = ChatHistoryStore.shared.currentSession {+ currentChatTitle = current.title+ }+ }}// MARK: - Shared Mode Color Helper@@ -460,11 +474,18 @@ struct NotchCommandOutputExpandedView: View {let audioPublisher: AnyPublisher<CGFloat, Never>let onDismiss: () -> Voidlet onSubmit: (String) async -> Void+ let onNewChat: () -> Void+ let onSwitchChat: (String) -> Void+ let onClearChat: () -> Void@ObservedObject private var contentState = NotchContentState.shared@State private var inputText: String = ""@FocusState private var isInputFocused: Bool@State private var scrollProxy: ScrollViewProxy?+ @State private var isHoveringNewChat = false+ @State private var isHoveringRecent = false+ @State private var isHoveringClear = false+ @State private var isHoveringDismiss = falseprivate let commandRed = Color(red: 1.0, green: 0.35, blue: 0.35)@@ -522,8 +543,8 @@ struct NotchCommandOutputExpandedView: View {// MARK: - Headerprivate var headerView: some View {- ZStack {- // Centered content: Waveform + Mode label+ HStack(spacing: 8) {+ // Left: Waveform + Mode labelHStack(spacing: 6) {// Waveform - only show when recording, otherwise show static indicatorif contentState.isRecordingInExpandedMode {@@ -555,27 +576,119 @@ struct NotchCommandOutputExpandedView: View {}}- // Right-aligned dismiss button - styled red with hover effect- HStack {- Spacer()+ Spacer()++ // Right: Chat management buttons + Dismiss+ HStack(spacing: 6) {+ // New Chat Button (+)+ Button(action: onNewChat) {+ ZStack {+ Circle()+ .fill(isHoveringNewChat ? commandRed.opacity(0.25) : commandRed.opacity(0.12))+ .frame(width: 22, height: 22)+ Image(systemName: "plus")+ .font(.system(size: 10, weight: .semibold))+ .foregroundStyle(contentState.isCommandProcessing ? .white.opacity(0.3) : commandRed.opacity(0.85))+ }+ }+ .buttonStyle(.plain)+ .contentShape(Circle())+ .onHover { isHoveringNewChat = $0 }+ .disabled(contentState.isCommandProcessing)+ .help("New chat")++ // Recent Chats Menu+ Menu {+ let recentChats = contentState.recentChats+ let currentID = ChatHistoryStore.shared.currentChatID+ if recentChats.isEmpty {+ Text("No recent chats")+ .foregroundStyle(.secondary)+ } else {+ ForEach(recentChats) { chat in+ Button(action: {+ if chat.id != currentID {+ onSwitchChat(chat.id)+ }+ }) {+ HStack {+ if chat.id == currentID {+ Image(systemName: "checkmark")+ .font(.caption)+ }+ Text(chat.title)+ .lineLimit(1)+ Spacer()+ Text(chat.relativeTimeString)+ .font(.caption)+ .foregroundStyle(.secondary)+ }+ }+ .disabled(contentState.isCommandProcessing)+ }+ }+ } label: {+ ZStack {+ Circle()+ .fill(isHoveringRecent ? commandRed.opacity(0.25) : commandRed.opacity(0.12))+ .frame(width: 22, height: 22)+ Image(systemName: "clock.arrow.circlepath")+ .font(.system(size: 9, weight: .semibold))+ .foregroundStyle(commandRed.opacity(0.85))+ }+ }+ .menuIndicator(.hidden)+ .menuStyle(.button)+ .buttonStyle(.plain)+ .frame(width: 22, height: 22)+ .onHover { isHoveringRecent = $0 }+ .help("Recent chats")++ // Delete Chat Button - deletes the current chat entirely+ Button(action: onClearChat) {+ ZStack {+ Circle()+ .fill(isHoveringClear ? commandRed.opacity(0.25) : commandRed.opacity(0.12))+ .frame(width: 22, height: 22)+ Image(systemName: "trash")+ .font(.system(size: 9, weight: .semibold))+ .foregroundStyle(contentState.isCommandProcessing ? .white.opacity(0.3) : commandRed.opacity(0.85))+ }+ }+ .buttonStyle(.plain)+ .contentShape(Circle())+ .onHover { isHoveringClear = $0 }+ .disabled(contentState.isCommandProcessing)+ .help("Delete chat")++ // Vertical divider+ Rectangle()+ .fill(.white.opacity(0.15))+ .frame(width: 1, height: 14)+ .padding(.horizontal, 2)++ // Dismiss Button (X)Button(action: onDismiss) {ZStack {Circle()- .fill(commandRed.opacity(0.15))- .frame(width: 24, height: 24)+ .fill(isHoveringDismiss ? commandRed.opacity(0.25) : commandRed.opacity(0.12))+ .frame(width: 22, height: 22)Image(systemName: "xmark")- .font(.system(size: 10, weight: .bold))- .foregroundStyle(commandRed.opacity(0.8))+ .font(.system(size: 9, weight: .bold))+ .foregroundStyle(commandRed.opacity(0.85))}}.buttonStyle(.plain).contentShape(Circle())- .frame(width: 32, height: 32) // Larger hit area+ .onHover { isHoveringDismiss = $0 }.help("Close (Escape)")}}.padding(.horizontal, 12).padding(.vertical, 8)+ .onAppear {+ contentState.refreshRecentChats()+ }}// MARK: - Transcription Preview (shown while recording)diff --git a/Sources/Fluid/Views/RewriteModeView.swift b/Sources/Fluid/Views/RewriteModeView.swiftindex 2c231ade..68f04b00 100644--- a/Sources/Fluid/Views/RewriteModeView.swift+++ b/Sources/Fluid/Views/RewriteModeView.swift@@ -17,7 +17,7 @@ struct RewriteModeView: View {var body: some View {VStack(spacing: 0) {- // Header+ // Header - cleaner, just title and closeHStack {Image(systemName: "pencil.and.outline").font(.title2)@@ -28,50 +28,6 @@ struct RewriteModeView: View {Spacer()- // Provider Selector (independent for Write Mode)- Picker("", selection: $settings.rewriteModeSelectedProviderID) {- Text("OpenAI").tag("openai")- Text("Groq").tag("groq")-- // Apple Intelligence- if AppleIntelligenceService.isAvailable {- Text("Apple Intelligence").tag("apple-intelligence")- } else {- Text("Apple Intelligence (Unavailable)")- .foregroundColor(.secondary)- .tag("apple-intelligence-disabled")- }-- ForEach(settings.savedProviders) { provider in- Text(provider.name).tag(provider.id)- }- }- .frame(width: 140)- .onChange(of: settings.rewriteModeSelectedProviderID) { newValue in- // Prevent selecting disabled Apple Intelligence- if newValue == "apple-intelligence-disabled" {- settings.rewriteModeSelectedProviderID = "openai"- }- updateAvailableModels()- }-- // Model Selector (hidden for Apple Intelligence)- if settings.rewriteModeSelectedProviderID != "apple-intelligence" {- Picker("", selection: Binding(- get: { settings.rewriteModeSelectedModel ?? availableModels.first ?? "gpt-4o" },- set: { settings.rewriteModeSelectedModel = $0 }- )) {- ForEach(availableModels, id: \.self) { model in- Text(model).tag(model)- }- }- .frame(width: 140)- }-- Divider()- .frame(height: 20)- .padding(.horizontal, 4)-Button(action: { onClose?() }) {Image(systemName: "xmark.circle.fill").foregroundStyle(.secondary)@@ -186,8 +142,49 @@ struct RewriteModeView: View {Divider()- // Input Area- HStack {+ // Input Area with model selectors inline+ HStack(spacing: 8) {+ // Provider Selector (compact)+ Picker("", selection: $settings.rewriteModeSelectedProviderID) {+ Text("OpenAI").tag("openai")+ Text("Groq").tag("groq")++ // Apple Intelligence+ if AppleIntelligenceService.isAvailable {+ Text("Apple Intelligence").tag("apple-intelligence")+ } else {+ Text("Apple Intelligence (Unavailable)")+ .foregroundColor(.secondary)+ .tag("apple-intelligence-disabled")+ }++ ForEach(settings.savedProviders) { provider in+ Text(provider.name).tag(provider.id)+ }+ }+ .frame(width: 110)+ .onChange(of: settings.rewriteModeSelectedProviderID) { newValue in+ // Prevent selecting disabled Apple Intelligence+ if newValue == "apple-intelligence-disabled" {+ settings.rewriteModeSelectedProviderID = "openai"+ }+ updateAvailableModels()+ }++ // Model Selector (hidden for Apple Intelligence)+ if settings.rewriteModeSelectedProviderID != "apple-intelligence" {+ Picker("", selection: Binding(+ get: { settings.rewriteModeSelectedModel ?? availableModels.first ?? "gpt-4o" },+ set: { settings.rewriteModeSelectedModel = $0 }+ )) {+ ForEach(availableModels, id: \.self) { model in+ Text(model).tag(model)+ }+ }+ .frame(width: 130)+ }++ // Input field (flexible)TextField(service.originalText.isEmpty? "Ask me to write anything...": "How should I rewrite this?",