Open leftmove opened 5 days ago
I understand your point. I will review the implementation to assess how it works and whether there are any consequences, considering that the onTyping
real-time completions rely on previous requests completion cache. I will let you know.
monacopilot
version: 0.15.0monaco-editor
version: 0.52.0Right now, there is no way to abort LLM requests while they are streaming. I would like to create a system that allows you to to do that.
This would have a couple benefits from this.
onTyping
the default trigger for completions, as there would be a lot less resource usage difference between that andonIdle
.If implemented properly, this is what I imagine
route.ts
for minimal Next.js example to look like.Or possibly, you could pass in your own
AbortController
. There is already some code for this in the source - it's just not possible to pass in a signal yet.What makes this fairly trivial to implement versus a major refactor, is that you must stream responses in order to cancel them. Currently, all LLM responses are returned from an API call statically. In order to stop LLM generation and not incur costs, you have to stream responses.
Therefore, you would have to implement a way to stream and conjoin every completion, instead of the current method of calling a request and storing the output. Here's some code to outline what I mean.
I want to undertake changing the code so this feature is possible, but I wanted to ask if I should beforehand since it would require a major refactor.
Thanks!