mirror of
https://github.com/0xacx/chatGPT-shell-cli.git
synced 2024-11-24 11:25:31 +00:00
Apply output wrapping to other models and command generation
This commit is contained in:
parent
9598414eca
commit
f98a76e2d5
@ -292,7 +292,7 @@ while $running; do
|
||||
response_data=$(echo $response | jq -r '.choices[].message.content')
|
||||
|
||||
if [[ "$prompt" =~ ^command: ]]; then
|
||||
echo -e "${CHATGPT_CYAN_LABEL} ${response_data}\n"
|
||||
echo -e "${CHATGPT_CYAN_LABEL} ${response_data}" | fold -s -w $COLUMNS
|
||||
dangerous_commands=("rm" ">" "mv" "mkfs" ":(){:|:&};" "dd" "chmod" "wget" "curl")
|
||||
|
||||
for dangerous_command in "${dangerous_commands[@]}"; do
|
||||
@ -344,7 +344,7 @@ while $running; do
|
||||
request_to_completions "$request_prompt"
|
||||
handle_error "$response"
|
||||
response_data=$(echo "$response" | jq -r '.choices[].text' | sed '1,2d; s/^A://g')
|
||||
echo -e "${CHATGPT_CYAN_LABEL}${response_data}"
|
||||
echo -e "${CHATGPT_CYAN_LABEL}${response_data}" | fold -s -w $COLUMNS
|
||||
|
||||
if [ "$CONTEXT" = true ]; then
|
||||
escaped_response_data=$(echo "$response_data" | sed 's/"/\\"/g')
|
||||
|
Loading…
Reference in New Issue
Block a user