diff --git a/humanscript b/humanscript index c8115fe..34da225 100755 --- a/humanscript +++ b/humanscript @@ -52,13 +52,14 @@ $(cat "${humanscript_path}") ### Output script:" # Format JSON payload -stringified_system_prompt=$(echo "${system_prompt}"| jq -sRr @json) -stringified_user_prompt=$(echo "${user_prompt}"| jq -sRr @json) +function json_string() { + echo "${1}" | jq --raw-input --raw-output --slurp @json +} data=$(echo '{ "model": "'$HUMANSCRIPT_MODEL'", "messages": [ - {"role": "system", "content": '$stringified_system_prompt'}, - {"role": "user", "content": '$stringified_user_prompt'} + {"role": "system", "content": '$(json_string "${system_prompt}")'}, + {"role": "user", "content": '$(json_string "${user_prompt}")'} ], "temperature": 0.7, "max_tokens": 1000,