CrazyPython / gpt3-cli

A lightweight command-line interface to OpenAI's GPT-3. Temperature, presence, and frequency up to 2. Streaming support
GNU Affero General Public License v3.0
55 stars 8 forks source link

Ensure GNU sed works like BSD sed #11

Open joeytwiddle opened 1 year ago

joeytwiddle commented 1 year ago

Before this change, the script would fail on Linux, with a sed error

joeytwiddle commented 1 year ago

According to the Linux man page, -u causes sed to flush its buffers more often.

In my experience, this is the option to use to get realtime streaming output from sed. (It's the closest thing to line-buffering.)

joeytwiddle commented 1 year ago

This manpage says the BSD version of sed also accepts the -u argument. man page

In which case the simplest solution would just be to use -u instead of -l without any checking.

However, I'm not convinced that all Macs have that version of sed.