Skip to content
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

[Bug] fetchEventSource need logic to handle non-streaming responses #1553

Closed
yanCode opened this issue May 17, 2023 · 0 comments
Closed

[Bug] fetchEventSource need logic to handle non-streaming responses #1553

yanCode opened this issue May 17, 2023 · 0 comments

Comments

@yanCode
Copy link
Contributor

yanCode commented May 17, 2023

to reproduce this issue, you can disconnect your newwork on your computer, then send anything as a question, you can see there is an endless loading icon in 1, while it's expected to directly inform the network has a problem in 2.
image

recently import { fetchEventSource} from "@microsoft/fetch-event-source";
has been included to handle the stream response returned from open api endpoint.
as I checked the official doc, https://github.com/Azure/fetch-event-source you can see it requires extra logic to handle if a response is not of type EventStreamContentType .

as in route.ts we do we have logic

console.error("[OpenAI] ", e);
    return NextResponse.json(prettyObject(e));

returning a non-streaming response.

I am preparing a PR now.

@yanCode yanCode changed the title [Bug] fetchEventSource need logic to handle non-streaming events [Bug] fetchEventSource need logic to handle non-streaming responses May 17, 2023
@Yidadaa Yidadaa closed this as completed May 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants