Unhandled Promise Rejection: TypeError: undefined is not an object (evaluating 'r.choices[0].delta') #731

Closed
opened 2025-11-11 14:30:02 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @mandasaka on GitHub (Apr 26, 2024).

Bug Report

Description

Hello,
I noticed that the newly added src/lib/apis/streaming
/index.ts script in version v0.1.121 fails to handle responses where the 'choices' field lacks a 'delta', with these responses coming from Azure OpenAI.

The first response from completions:

data: {"choices":[],"created":0,"id":"","model":"","object":"","prompt_filter_results":[{"prompt_index":0,"content_filter_results":{"hate":{"filtered":false,"severity":"safe"},"self_harm":{"filtered":false,"severity":"safe"},"sexual":{"filtered":false,"severity":"safe"},"violence":{"filtered":false,"severity":"safe"}}}]}

Thank you and looking forward to your response.

Originally created by @mandasaka on GitHub (Apr 26, 2024). # Bug Report ## Description Hello, I noticed that the newly added [src](https://github.com/open-webui/open-webui/tree/main/src)/[lib](https://github.com/open-webui/open-webui/tree/main/src/lib)/[apis](https://github.com/open-webui/open-webui/tree/main/src/lib/apis)/[streaming](https://github.com/open-webui/open-webui/tree/main/src/lib/apis/streaming) /index.ts script in version v0.1.121 fails to handle responses where the 'choices' field lacks a 'delta', with these responses coming from Azure OpenAI. The first response from completions: data: {"choices":[],"created":0,"id":"","model":"","object":"","prompt_filter_results":[{"prompt_index":0,"content_filter_results":{"hate":{"filtered":false,"severity":"safe"},"self_harm":{"filtered":false,"severity":"safe"},"sexual":{"filtered":false,"severity":"safe"},"violence":{"filtered":false,"severity":"safe"}}}]} Thank you and looking forward to your response.
Author
Owner

@tjbck commented on GitHub (Apr 26, 2024):

@cheahjs

@tjbck commented on GitHub (Apr 26, 2024): @cheahjs
Author
Owner

@tjbck commented on GitHub (Apr 26, 2024):

Should be fixed on our dev branch now, let me know if the issue persists!

@tjbck commented on GitHub (Apr 26, 2024): Should be fixed on our dev branch now, let me know if the issue persists!
Author
Owner

@mandasaka commented on GitHub (Apr 28, 2024):

It’s ok now, thx

@mandasaka commented on GitHub (Apr 28, 2024): It’s ok now, thx
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#731