ChatGPT.nvim icon indicating copy to clipboard operation
ChatGPT.nvim copied to clipboard

feat: handle limited time key, Lua function for obtaining keys

Open rameshsanth opened this issue 11 months ago • 0 comments

This PR addresses 3 items.

  1. Allow users to use Lua functions to provide keys (in addition to current methods)
  2. Allow timeouts to be specified for keys. Automatically request new keys when it expires
  3. A bug fix in handling stream

Lua function is self explanatory. The README has been updated to reflect it and also with an example that I'm using personally. The change is simple also. It is a 2 line change in loadConfigFromCommand()

The timeout handling is bit complicated. Every time the ChatGPT API's is used, the key is validated before executing the command. To achieve this, some code had to be refactored.

The third one is shown by below two screen shots with and without the fix.

Without the fix. Screenshot 2024-03-18 at 7 45 03 PM

With the fix. Screenshot 2024-03-18 at 7 42 49 PM

rameshsanth avatar Mar 19 '24 02:03 rameshsanth