Skip to content

Commit

Permalink
Continue loop on invalid prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
TerryvanWalen committed Mar 16, 2024
1 parent ae81d19 commit f297b99
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion zsh-gpt.plugin.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ _chat_gpt() {
fi
local prompt="$(_create_prompt $user_input)"
# If not valid string according to jq. Then show message and continue to next loop
echo "$prompt" | jq > /dev/null && conversation_history+="$prompt"
echo "$prompt" | jq > /dev/null || continue
conversation_history+="$prompt"

local messages=${(j|, |)conversation_history}
reply="$(_curl_gpt "$system" "$messages")"
Expand Down

0 comments on commit f297b99

Please sign in to comment.