diff --git a/finish.sh b/finish.sh index 87a9650..4304a3e 100644 --- a/finish.sh +++ b/finish.sh @@ -319,7 +319,8 @@ openai_completion() { done < <(echo "$response_body") # Store accumulated content as response_body for later processing - response_body="{\"choices\":[{\"message\":{\"content\":\"$stream_content\"}}]}" + # Use jq to properly escape the content string + response_body=$(jq -n --arg content "$stream_content" '{choices: [{message: {content: $content}}]}') rm -f "$temp_file" else # Non-streaming mode (original behavior)