# Documentation:
# @raycast.author Your Name
# @raycast.authorURL https://github.com/you
QUERY="$1"
[ -z "$QUERY" ] && exit 0
FULL_QUERY="Answer in as little words as possible, concisely, for an intelligent person: $QUERY"
# URL encode (pure bash)
encode_query() {
local query="$1"
local encoded=""
local c
for (( i=0; i<${#query}; i++ )); do
c="${query:$i:1}"
case $c in
[a-zA-Z0-9.~_-]) encoded+="$c" ;;
*) encoded+=$(printf '%%%02X' "'$c") ;;
esac
done
echo "$encoded"
}
ported to macos using raycast
```
#!/bin/bash
# Required parameters: # @raycast.schemaVersion 1 # @raycast.title Ask LLM # @raycast.mode fullOutput
# Optional parameters: # @raycast.icon # @raycast.argument1 { "type": "text", "placeholder": "Your question" }
# Documentation: # @raycast.author Your Name # @raycast.authorURL https://github.com/you
QUERY="$1" [ -z "$QUERY" ] && exit 0
FULL_QUERY="Answer in as little words as possible, concisely, for an intelligent person: $QUERY"
# URL encode (pure bash) encode_query() { local query="$1" local encoded="" local c for (( i=0; i<${#query}; i++ )); do c="${query:$i:1}" case $c in [a-zA-Z0-9.~_-]) encoded+="$c" ;; *) encoded+=$(printf '%%%02X' "'$c") ;; esac done echo "$encoded" }
ENCODED_QUERY=$(encode_query "$FULL_QUERY")
# Get response RESPONSE=$(curl -s "https://ch.at/?q=$ENCODED_QUERY")
# Output to Raycast echo "$RESPONSE"
# --- Optional: also pop up a big dialog --- osascript -e 'display dialog "'"$RESPONSE"'" buttons {"OK"} default button 1 with title "LLM Answer"'
```