jackMort / ChatGPT.nvim

ChatGPT Neovim Plugin: Effortless Natural Language Generation with OpenAI's ChatGPT API
Apache License 2.0
3.67k stars 311 forks source link

fix(api): warn instead of crash in unconfigured environments #202

Closed jollyjerr closed 1 year ago

jollyjerr commented 1 year ago

Hi! There is some incorrect if statement logic in the new api_key_cmd setup that results in this nasty-looking error on startup in environments without an API key (this can happen in a variety of situations like editing your kitty settings in this example screenshot)

Screenshot 2023-05-26 at 8 45 37 AM

This pr fixes the if statement logic, and switches to a more pleasant warning if this kind of thing ever happens:

Screenshot 2023-05-26 at 8 45 13 AM
jackMort commented 1 year ago

Great job, thanks!