mirror of
https://github.com/open-webui/open-webui.git
synced 2026-03-22 14:13:08 -05:00
[PR #6261] [MERGED] fix: default to False if stream is unavailable #8645
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/6261
Author: @monotykamary
Created: 10/18/2024
Status: ✅ Merged
Merged: 10/19/2024
Merged by: @tjbck
Base:
main← Head:main📝 Commits (1)
11588affix: default to False if stream is unavailable📊 Changes
1 file changed (+1 additions, -1 deletions)
View changed files
📝
backend/open_webui/apps/webui/main.py(+1 -1)📄 Description
fix: KeyError in generate_chat_completions function
Motivation
I've noticed a server error when trying to integrate this with Dify, and realized that, although the API has coded a mechanism to default the
streamparameter to False if not specified, it is still being checked eagerly without making sure the key exists, causing a KeyError and thus an internal server error.Pull Request Checklist
mainbranch.generate_chat_completionsfunction caused by attempting to access a non-existent 'stream' key in theform_datadictionary.Changelog Entry
Description
generate_chat_completionsfunction, improving the robustness of the chat completion generation process.Fixed
form_datadictionary within thegenerate_chat_completionsfunction.Changed
generate_chat_completionsfunction to safely check for the existence of the 'stream' key inform_data.Additional Information
Docker Image for Testing:
https://github.com/monotykamary/open-webui/pkgs/container/open-webui
Logs:
Screenshots or Videos
Before:

After:

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.