diff --git a/oAI/Views/Screens/SettingsView.swift b/oAI/Views/Screens/SettingsView.swift index 9ce5b10..29381c7 100644 --- a/oAI/Views/Screens/SettingsView.swift +++ b/oAI/Views/Screens/SettingsView.swift @@ -1242,12 +1242,13 @@ It's better to admit "I need more information" or "I cannot do that" than to fak // function call. Quoting the prompt is still the fully robust habit for other shell metacharacters // (`;`, `|`, backticks, `$()`), but this covers the specific class of crash users are most likely // to hit by accident (an unquoted question ending in "?"). + // Deliberately one line, no backslash continuations: a `\` line-continuation is silently + // broken by a trailing space or a dropped backslash from copy/pasting out of a chat UI or + // browser — each following line then gets parsed as its own bogus command ("command not + // found: -H", etc.). A long single line has no continuation character to mangle. private static let cliShellFunctionSnippet = """ _ai_impl() { - curl -s --unix-socket "$HOME/Library/Application Support/oAI/cli.sock" \\ - -H "Content-Type: application/json" \\ - -d "$(jq -n --arg p "$*" '{prompt: $p}')" \\ - http://localhost/ | jq -r 'if .error then "Error: " + .error else .response end' + curl -s --unix-socket "$HOME/Library/Application Support/oAI/cli.sock" -H "Content-Type: application/json" -d "$(jq -n --arg p "$*" '{prompt: $p}')" http://localhost/ | jq -r 'if .error then "Error: " + .error else .response end' } alias ai='noglob _ai_impl' """