Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gpt3
Copy link

@joeytwiddle joeytwiddle Mar 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will fix it for Linux, but break it for macOS!

Sadly, BSD sed and GNU sed take different arguments.

I think the intent here was for line-buffered output, which is -l on BSD sed (macOS), but -u on GNU sed (Linux).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope my solution will fix it: #11

Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ curl -sSL -N \
--data-urlencode max_tokens="$MAX_TOKENS" \
--data-urlencode frequency_penalty="$FREQ_PENALTY" \
--data-urlencode presence_penalty="$PRES_PENALTY" \
-H "Authorization: Bearer $KEY" | sed -l 's/^data: //' | grep --line-buffer -v '^\[DONE\]$' | jq -j --unbuffered '.choices[0].text'
-H "Authorization: Bearer $KEY" | sed -l 0 's/^data: //' | grep --line-buffer -v '^\[DONE\]$' | jq -j --unbuffered '.choices[0].text'
# Add trailing newline
echo