diff options
Diffstat (limited to 'bin/gpt')
| -rwxr-xr-x | bin/gpt/gpt | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/bin/gpt/gpt b/bin/gpt/gpt index 04b3f3c..f331050 100755 --- a/bin/gpt/gpt +++ b/bin/gpt/gpt | |||
| @@ -165,7 +165,7 @@ _process_completion() { | |||
| 165 | jq -jr '.choices?[0]?.delta?.content? // empty' | 165 | jq -jr '.choices?[0]?.delta?.content? // empty' |
| 166 | else | 166 | else |
| 167 | jq . | tee -a "$cache" | \ | 167 | jq . | tee -a "$cache" | \ |
| 168 | jq -r .choices[0].message.content | 168 | jq -jr .choices[0].message.content |
| 169 | fi | 169 | fi |
| 170 | } | 170 | } |
| 171 | 171 | ||
| @@ -254,8 +254,8 @@ EOF | |||
| 254 | session+=("$user_message") | 254 | session+=("$user_message") |
| 255 | 255 | ||
| 256 | # If context is specified, use INDEX to get specified range from session | 256 | # If context is specified, use INDEX to get specified range from session |
| 257 | if [ -n $context ]; then | 257 | if [ -n "$context" ]; then |
| 258 | INDEX="-$([ ${#session[@]} -le $context ] && echo ${#session[@]} || echo $(( $context + 1 )))" | 258 | INDEX="-$([ "${#session[@]}" -le "$context" ] && echo ${#session[@]} || echo $(( $context + 1 )))" |
| 259 | fi | 259 | fi |
| 260 | 260 | ||
| 261 | # Create request body | 261 | # Create request body |
| @@ -279,7 +279,7 @@ EOF | |||
| 279 | # Use Yellow color to print completion from GPT | 279 | # Use Yellow color to print completion from GPT |
| 280 | echo -en '\n\e[33m' | 280 | echo -en '\n\e[33m' |
| 281 | _API_call | _process_completion | 281 | _API_call | _process_completion |
| 282 | echo -e '\e[0m' | 282 | echo -e '\e[0m\n' |
| 283 | 283 | ||
| 284 | # Append newest message into session | 284 | # Append newest message into session |
| 285 | assistant_message="$(cat <<EOF | 285 | assistant_message="$(cat <<EOF |