ai-chatgpt example server does not handle cancellation without throwing an error
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5.2k
- Forks
- 1.8k
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 6
Description
I've create a repo for just the code that is in the example described here and in the location here.
I've copied those files into this repo and made just a few changes to chat.tsx to enable cancelling the stream being generated from ChatGPT.
It works as expected (when press the "Stop Streaming" new button, the generation of the answer stops as expected. However, the server throws an error that is not caught which is undesirable. IMHO, the server should not be creating uncaught errors and throwing them which is why I'm reporting this as an issue.
Below is the error the server creates on streaming being stopped, as well as the error code thrown.
- error uncaughtException: Error: aborted
at connResetException (node:internal/errors:717:14)
at abortIncoming (node:_http_server:754:17)
at socketOnClose (node:_http_server:748:3)
at Socket.emit (node:events:525:35)
at TCP.<anonymous> (node:net:322:12) {
digest: undefined
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the cancellation using the changes in components/Chat.tsx and the linked ai-chatgpt solution, then trace the server entry point handling the stream. Done means stopping the stream still works without producing an uncaught "aborted" error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nextjs, typescript
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100