jackMort / ChatGPT.nvim

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

fix: type error on stream after window close (#325) #326

Closed Aaronik closed 5 months ago

Aaronik commented 7 months ago

Don't perform any actions on windows that have been closed already.

Closes #325

jackMort commented 7 months ago

thanks! could you please resolve the conflicts?

Aaronik commented 7 months ago

Hey @jackMort, yep, I went ahead and resolved the conflicts. I'm having a little trouble making sure it's all working as there seems to be some errors unrelated to changes I made:

Error executing Lua callback: /Users/aaron/Desktop/ChatGPT.nvim/lua/chatgpt/help.lua:43: attempt to concatenate a table value
stack traceback:
        /Users/aaron/Desktop/ChatGPT.nvim/lua/chatgpt/help.lua:43: in function 'get_help_panel'
        ...ron/Desktop/ChatGPT.nvim/lua/chatgpt/flows/chat/base.lua:740: in function 'open'
        ...ron/Desktop/ChatGPT.nvim/lua/chatgpt/flows/chat/init.lua:14: in function 'open_chat'
        /Users/aaron/Desktop/ChatGPT.nvim/lua/chatgpt.lua:34: in function 'openChat'
        /Users/aaron/Desktop/ChatGPT.nvim/plugin/chatgpt.lua:2: in function </Users/aaron/Desktop/ChatGPT.nvim/plugin/chatgpt.lua:1>

and

Error executing Lua callback: ...ron/Desktop/ChatGPT.nvim/lua/chatgpt/flows/chat/base.lua:1046: attempt to index field 'layout' (a nil value)
stack traceback:
        ...ron/Desktop/ChatGPT.nvim/lua/chatgpt/flows/chat/base.lua:1046: in function 'toggle'
        ...ron/Desktop/ChatGPT.nvim/lua/chatgpt/flows/chat/init.lua:11: in function 'open_chat'
        /Users/aaron/Desktop/ChatGPT.nvim/lua/chatgpt.lua:34: in function 'openChat'
        /Users/aaron/Desktop/ChatGPT.nvim/plugin/chatgpt.lua:2: in function </Users/aaron/Desktop/ChatGPT.nvim/plugin/chatgpt.lua:1>

when trying to open the :ChatGPT window. But the edit in place window is working well 🤷

If these aren't familiar to you or you think that these changes affected those somehow, I'd advise holding off on merging this. But if you have a handle on those errors then this code is probably fine. I tested the heck out of it before originally submitting the PR.


UPDATE

Those errors are happening to me on latest main as well, so I don't think it's this PR that's doing it. @jackMort I believe this is safe to merge.

Aaronik commented 5 months ago

@jackMort Any intention of merging this?