-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stop generation button (closes #86) #88
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM, but I think we should also not save the message in the backend in this case? Or should we?
Yeah so that's why I mentioned the AbortController, I suppose that way we could avoid saving/save only the portion the user saw. I think it's OK for now tho because the main point of this feature is to allow users to quickly send a new request without having to wait until the end. I suppose ideally also we would save the aborted message + not count it for further generations. But I think we would need to mark it as |
ok then, ok for me to merge and create new issue (after mobile UI is fixed) |
719fc00
to
25fabae
Compare
no strong opinion, but imo let's only launch after launch (can be later today...) |
yea let's make it 100%, stopping on frontend = stopping on backend |
Thinking more about this and the backend part, the only way to "catch" the abort afaik is to send an extra API call from the client. However even with that, since the server is stateless I don't see how you could cancel the on-going request. Any idea @coyotte508? |
Ok I looked more into it and at first glance this is right: https://www.reddit.com/r/SvelteKit/comments/yjdx13/detect_aborted_request_on_the_server/ But then I looked at websocket implementations:
And so using a similar approach - having our own custom server file that reuses' the adapter's handler function - it should be possible for us to monitor Though this is advanced stuff, not sure we want to dip our toes yet into the internals
We could... add an "abortedRequests" function in a mongodb collection, listen to it across all instances with a changestream (or just a periodic We could base the abort on the convo id |
@@ -57,6 +64,27 @@ | |||
|
|||
if (!data || conversationId !== $page.params.id) break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should remove this, it reappeared in the last commit but not valid anymore
This reverts commit 74119a8.
Co-authored-by: coyotte508 <coyotte508@gmail.com>
Need to see if we want to have it for the release.
It's using @gary149 design instead of the one in the issue!
closes #86