Make requests async
reachtarunhere opened this issue ยท comments
Hi! Thanks for the project. I love using it.
One little issue I have is that currently whenever I make a response in the Chat my whole emacs hangs. I would ideally want to do other things nav around. I suspect this is because the requests being made are not async?
Thank You!
Yeah I totally agree, but I was unfamiliar with the requests library when I wrote this initially. I'll try and write an async version of it tomorrow!
I've made a messy start on this on the asyncify branch. Unfortunately I still don't really know what I'm doing, so it'll take me a bit longer to get it perfect. It's happening, though :)
In the meantime I've seen that https://github.com/karthink/gptel is async out of the box and looks quite comparable to this package.
OK, I would say some of the harder edges have now been made async (eg, sending a message in a chat buffer, auto-renaming buffer/file). Not everything is async - none of the insert or replace region functions made it (I can't figure out a reasonable way to do this that won't totally mess with edits made to the buffer in between request and response), and the initial start-chat is also still sync.
Now it would be nice to have a loading indicator, timeout, a request queue, and inflight request cancellation and/or debouncing, because you can get impatient, resend the chat, and then get several responses in your buffer out of order. Contributions welcome ๐ ๐ ๐ ๐