mirror of
https://github.com/0xacx/chatGPT-shell-cli.git
synced 2024-11-24 11:25:31 +00:00
Safer quoting
This commit is contained in:
parent
42d82b9d65
commit
60eb98d7b3
@ -54,8 +54,8 @@ EOF
|
||||
# $1 should be the response body
|
||||
handle_error() {
|
||||
if echo "$1" | jq -e '.error' >/dev/null; then
|
||||
echo -e "Your request to Open AI API failed: \033[0;31m$(echo $1 | jq -r '.error.type')\033[0m"
|
||||
echo $1 | jq -r '.error.message'
|
||||
echo -e "Your request to Open AI API failed: \033[0;31m$(echo "$1" | jq -r '.error.type')\033[0m"
|
||||
echo "$1" | jq -r '.error.message'
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
@ -296,7 +296,7 @@ while $running; do
|
||||
elif [[ "$prompt" =~ ^image: ]]; then
|
||||
request_to_image "$prompt"
|
||||
handle_error "$image_response"
|
||||
image_url=$(echo $image_response | jq -r '.data[0].url')
|
||||
image_url=$(echo "$image_response" | jq -r '.data[0].url')
|
||||
echo -e "$OVERWRITE_PROCESSING_LINE"
|
||||
echo -e "${CHATGPT_CYAN_LABEL}Your image was created. \n\nLink: ${image_url}\n"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user