OpenInterpreter / 01

The open-source language model computer
http://openinterpreter.com/01
GNU Affero General Public License v3.0
4.76k stars 470 forks source link

Shutdown gracefully if OpenAI key missing for default TTS #202

Closed dheavy closed 3 months ago

dheavy commented 3 months ago

Problem

When running poetry run 01 with no option and without prior setting of the OPENAI_API_KEY, the application will throw an error (coming from the openai.OpenAI package).

Solution

Defensive programming—verifying the presence of the key before invoking openai.OpenAI—to catch the issue and provide concise instruction on what to do instead of a scary stack trace.

Tested On

Discussion

No big deal, but this is a low-hanging fruit on removing onboarding friction. On Window (at least 10), given Ctrl+C doesn't seem to kill the process once the server started, it made the UX even more awkward.

Before

Screenshot 2024-03-31 at 21 38 54

After

Screenshot 2024-03-31 at 21 39 07

tyfiero commented 3 months ago

This is fantastic, you really have an eye for good user experience. Thanks!