Original PR: https://github.com/open-webui/open-webui/pull/17516 Author: @NibbinNone Created: 9/17/2025 Status: ❌ Closed
Base: dev ← Head: dev
dev
663410c
1 file changed (+1 additions, -1 deletions)
📝 backend/open_webui/utils/middleware.py (+1 -1)
backend/open_webui/utils/middleware.py
Update usage data handling to use 'or {}' instead of default parameter to properly handle None values from API responses.
some api server return data like
data: {"id": "chatcmpl-5jR1Fhd9KUk4P6N3zWo2y4coMscGu", "object": "chat.completion.chunk", "created": 1758113545, "model": "claude-neptune-v3", "choices": [{"index": 0, "delta": {"role": "assistant", "content": "3会更精确。"}, "logprobs": null, "finish_reason": null}], "usage": null, "system_fingerprint": "fp_d576307f90"}
The code usage = data.get("usage", {}) gets None, which causes the open-webui to not display the message correctly.
usage = data.get("usage", {})
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
No dependencies set.
The note is not visible to the blocked user.
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/17516
Author: @NibbinNone
Created: 9/17/2025
Status: ❌ Closed
Base:
dev← Head:dev📝 Commits (1)
663410cfix: handle None usage data in chat response processing📊 Changes
1 file changed (+1 additions, -1 deletions)
View changed files
📝
backend/open_webui/utils/middleware.py(+1 -1)📄 Description
Update usage data handling to use 'or {}' instead of default parameter to properly handle None values from API responses.
some api server return data like
The code
usage = data.get("usage", {})gets None, which causes the open-webui to not display the message correctly.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.