Skip to content

Commit f98a76e

Browse files
committed
Apply output wrapping to other models and command generation
1 parent 9598414 commit f98a76e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

chatgpt.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ while $running; do
292292
response_data=$(echo $response | jq -r '.choices[].message.content')
293293

294294
if [[ "$prompt" =~ ^command: ]]; then
295-
echo -e "${CHATGPT_CYAN_LABEL} ${response_data}\n"
295+
echo -e "${CHATGPT_CYAN_LABEL} ${response_data}" | fold -s -w $COLUMNS
296296
dangerous_commands=("rm" ">" "mv" "mkfs" ":(){:|:&};" "dd" "chmod" "wget" "curl")
297297

298298
for dangerous_command in "${dangerous_commands[@]}"; do
@@ -344,7 +344,7 @@ while $running; do
344344
request_to_completions "$request_prompt"
345345
handle_error "$response"
346346
response_data=$(echo "$response" | jq -r '.choices[].text' | sed '1,2d; s/^A://g')
347-
echo -e "${CHATGPT_CYAN_LABEL}${response_data}"
347+
echo -e "${CHATGPT_CYAN_LABEL}${response_data}" | fold -s -w $COLUMNS
348348

349349
if [ "$CONTEXT" = true ]; then
350350
escaped_response_data=$(echo "$response_data" | sed 's/"/\\"/g')

0 commit comments

Comments
 (0)