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

stuck on processing - adding possible reset or clear command

Open belafonte opened this issue 11 months ago • 3 comments

I recently ran into issues like

  • "invalid capture index"
  • or i accidentally used the whole buffer for a request
  • or my internet reception was bad and the request couldn't go through 100%

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?

belafonte avatar Feb 29 '24 08:02 belafonte

+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')

rameshsanth avatar Mar 19 '24 05:03 rameshsanth

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 avatar Mar 19 '24 18:03 ilan-schemoul

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)

ilan-schemoul avatar Mar 19 '24 20:03 ilan-schemoul