diff --git a/oAI/Views/Main/ChatView.swift b/oAI/Views/Main/ChatView.swift index 754a4db..91b5c67 100644 --- a/oAI/Views/Main/ChatView.swift +++ b/oAI/Views/Main/ChatView.swift @@ -60,8 +60,6 @@ struct ChatView: View { // Input bar InputBar( text: $viewModel.inputText, - commandHistory: $viewModel.commandHistory, - historyIndex: $viewModel.historyIndex, isGenerating: viewModel.isGenerating, mcpStatus: viewModel.mcpStatus, onlineMode: viewModel.onlineMode, diff --git a/oAI/Views/Main/InputBar.swift b/oAI/Views/Main/InputBar.swift index 5d63757..386196b 100644 --- a/oAI/Views/Main/InputBar.swift +++ b/oAI/Views/Main/InputBar.swift @@ -9,8 +9,6 @@ import SwiftUI struct InputBar: View { @Binding var text: String - @Binding var commandHistory: [String] - @Binding var historyIndex: Int let isGenerating: Bool let mcpStatus: String? let onlineMode: Bool @@ -81,44 +79,26 @@ struct InputBar: View { .onChange(of: text) { showCommandDropdown = text.hasPrefix("/") selectedSuggestionIndex = 0 - // Reset history index when user types - historyIndex = commandHistory.count } #if os(macOS) .onKeyPress(.upArrow) { - // If command dropdown is showing, navigate dropdown - if showCommandDropdown { - if selectedSuggestionIndex > 0 { - selectedSuggestionIndex -= 1 - } + // Navigate command dropdown + if showCommandDropdown && selectedSuggestionIndex > 0 { + selectedSuggestionIndex -= 1 return .handled } - // Otherwise, navigate command history - if historyIndex > 0 { - historyIndex -= 1 - text = commandHistory[historyIndex] - } - return .handled + return .ignored } .onKeyPress(.downArrow) { - // If command dropdown is showing, navigate dropdown + // Navigate command dropdown if showCommandDropdown { let count = CommandSuggestionsView.filteredCommands(for: text).count if selectedSuggestionIndex < count - 1 { selectedSuggestionIndex += 1 + return .handled } - return .handled } - // Otherwise, navigate command history - if historyIndex < commandHistory.count - 1 { - historyIndex += 1 - text = commandHistory[historyIndex] - } else if historyIndex == commandHistory.count - 1 { - // At the end of history, clear text and move to "new" position - historyIndex = commandHistory.count - text = "" - } - return .handled + return .ignored } .onKeyPress(.escape) { // If command dropdown is showing, close it @@ -352,8 +332,6 @@ struct CommandSuggestionsView: View { Spacer() InputBar( text: .constant(""), - commandHistory: .constant([]), - historyIndex: .constant(0), isGenerating: false, mcpStatus: "📁 Files", onlineMode: true,