jackMort / ChatGPT.nvim

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

stuck on processing - adding possible reset or clear command #397

Open belafonte opened 4 months ago

belafonte commented 4 months ago

I recently ran into issues like

When either of those happens, then the "processing, please wait ... " overlay stays int the buffer as well as the gray background. Closing the buffer and reopening does not solve this issue C-x does not either.

Anyhow in those cases something like a :ChatGPTRun clear_requests or just reset command would be useful, to basically reset the plugin and remove all overlays...

Or maybe i'am missing another fix how to do this?

rameshsanth commented 3 months ago

+1 It is very annoying when this happens. I've tried below 2 approaches to unload the package hoping ChatGPT would restart. no luck :(

  1. package.loaded["chatgpt"] = nil
  2. require 'plenary.reload'.reload_module('chatgpt')
ilan-schemoul commented 3 months ago

Yes I would add that the command I passed to get the api key (1password's op command) requires user input and in that case the message "processing, please wait..." is stuck Also it happens extremely frequently for whatever reason that simple requests fail. In that case too the message is stuck. Right now I just commented out the function BaseAction:render_spinner(state) function (and in lazy I point to the forked version with "{ dir = "~/code/forks/ChatGPT.nvim" }"). Hopefully someone with better understanding fix this bug otherwise maybe I'll do it. My guess is that the code to clean the loading message is not called in case of API failure.

ilan-schemoul commented 3 months ago

Related to @belafonte's problem with "invalid capture index" I have provided a PR which solves the issue for me and might solve it for him/her too (https://github.com/jackMort/ChatGPT.nvim/pull/409)