Robitx / gp.nvim

Gp.nvim (GPT prompt) Neovim AI plugin: ChatGPT sessions & Instructable text/code operations & Speech to text [OpenAI]
MIT License
537 stars 49 forks source link

bug: a gpt chat for a specific chat file slows down after a while #139

Open danielreis1 opened 1 month ago

danielreis1 commented 1 month ago

it's hard to understand why but after some time everything slows down inside a chatfile, be it in a split a new tab or the popup. It has to be the chat in use to slow down, with chat in use I mean: the chat pointed to by last.md it really is after some time, even if I am doing nothing and never requested a response, it still happens on a new chat. I am in windows under wsl and alacrity.

to fix: I either have to restart neovim or create a new chat, or change to another existing chat, but that one in specific becomes unuseable because everything becomes super slow, not just requesting responses from chatgpt, even leaving insert mode, using easymotions to change cursor positions becomes super slow, deleting a line becomes super slow, moving the cursor is fine (except with easymotions like mentioned), even the UI is generally slow, because I see some flickering, that is usually a good sign something is slowing everything down. I have tried shutting down the lsp and treesitter inside markdown, but the same thing keeps happening, I can't find whatever autocmd is causing it, but I doubt it's my config, since everywhere else is fine.

I believe it to be some autocmd that is running and makes everything slow down after some time. I believe it to be some of the plugin's autocmds that run forever and get bottled up, I constantly change between the chatgpt file buffer and the code buffer. I currently have it in a tab and switch to that tab with an hotkey, but either a tab or something else the problem persists, as mentioned above.

I think my environment being inside wsl2 makes it a bit slower, in general it's more than fine, but this may be a bug that nobody notices because even though I dont notice my environment being slower it's possible that it's much slower than most other people's env. making this bug's slowdown being much more noticeable in my environment than pretty much everyone else's environment

Edit: after a bit of testing, by creating a new chat file and window, at first the speed was ok, after a few executions of :doautocmd BufEnter I saw a significant slowdown a quick look at the code, autosaving on textchanged and insert leave, both of these inside BufEnter autocmd was something that poped up, however, I don't feel neovim savvy enough to fix this