Added skills, shortcuts, and bugifixes++
This commit is contained in:
@@ -23,7 +23,7 @@ struct InputBar: View {
|
||||
/// Commands that execute immediately without additional arguments
|
||||
private static let immediateCommands: Set<String> = [
|
||||
"/help", "/history", "/model", "/clear", "/retry", "/stats", "/config",
|
||||
"/settings", "/credits", "/list", "/load",
|
||||
"/settings", "/credits", "/list", "/load", "/shortcuts", "/skills",
|
||||
"/memory on", "/memory off", "/online on", "/online off",
|
||||
"/mcp on", "/mcp off", "/mcp status", "/mcp list",
|
||||
"/mcp write on", "/mcp write off",
|
||||
@@ -197,6 +197,13 @@ struct InputBar: View {
|
||||
// Execute immediately
|
||||
text = command
|
||||
onSend()
|
||||
} else if let shortcut = SettingsService.shared.userShortcuts.first(where: { $0.command == command }) {
|
||||
if shortcut.needsInput {
|
||||
text = command + " "
|
||||
} else {
|
||||
text = command
|
||||
onSend()
|
||||
}
|
||||
} else {
|
||||
// Put in input for user to complete
|
||||
text = command + " "
|
||||
@@ -214,7 +221,8 @@ struct InputBar: View {
|
||||
guard panel.runModal() == .OK else { return }
|
||||
|
||||
let paths = panel.urls.map { $0.path }
|
||||
let attachmentText = paths.map { "@\($0)" }.joined(separator: " ")
|
||||
// Use @<path> format (angle brackets) to safely handle paths with spaces
|
||||
let attachmentText = paths.map { "@<\($0)>" }.joined(separator: " ")
|
||||
|
||||
if text.isEmpty {
|
||||
text = attachmentText + " "
|
||||
@@ -245,12 +253,14 @@ struct CommandSuggestionsView: View {
|
||||
let selectedIndex: Int
|
||||
let onSelect: (String) -> Void
|
||||
|
||||
static let allCommands: [(command: String, description: String)] = [
|
||||
static let builtInCommands: [(command: String, description: String)] = [
|
||||
("/help", "Show help and available commands"),
|
||||
("/history", "View command history"),
|
||||
("/model", "Select AI model"),
|
||||
("/clear", "Clear chat history"),
|
||||
("/retry", "Retry last message"),
|
||||
("/shortcuts", "Manage your prompt shortcuts"),
|
||||
("/skills", "Manage your agent skills"),
|
||||
("/memory on", "Enable conversation memory"),
|
||||
("/memory off", "Disable conversation memory"),
|
||||
("/online on", "Enable web search"),
|
||||
@@ -274,9 +284,16 @@ struct CommandSuggestionsView: View {
|
||||
("/mcp write off", "Disable MCP write permissions"),
|
||||
]
|
||||
|
||||
static func allCommands() -> [(command: String, description: String)] {
|
||||
let shortcuts = SettingsService.shared.userShortcuts.map { s in
|
||||
(s.command, "⚡ \(s.description)")
|
||||
}
|
||||
return builtInCommands + shortcuts
|
||||
}
|
||||
|
||||
static func filteredCommands(for searchText: String) -> [(command: String, description: String)] {
|
||||
let search = searchText.lowercased()
|
||||
return allCommands.filter { $0.command.contains(search) || search == "/" }
|
||||
return allCommands().filter { $0.command.contains(search) || search == "/" }
|
||||
}
|
||||
|
||||
private var suggestions: [(command: String, description: String)] {
|
||||
|
||||
Reference in New Issue
Block a user