mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-23 10:02:10 -05:00
[PR #24638] fix: add blank line separator between serialized output parts to fix raw <details> rendering #82624
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/24638
Author: @siriusa51
Created: 5/13/2026
Status: 🔄 Open
Base:
dev← Head:fix/serialize-output-blank-line📝 Commits (1)
1f0cbacfix: add blank line separator between serialized output parts📊 Changes
1 file changed (+1 additions, -1 deletions)
View changed files
📝
backend/open_webui/utils/middleware.py(+1 -1)📄 Description
Pull Request Checklist
Before submitting, make sure you've checked the following:
devbranch.Changelog Entry
Description
Fixes
<details type="reasoning">,<details type="tool_calls">, and<details type="code_interpreter">blocks being displayed as raw HTML text in chat instead of being rendered as collapsible UI components.Root Cause
In
serialize_output()inbackend/open_webui/utils/middleware.py, output parts (text, reasoning, tool calls, code interpreter) are joined with a single newline ('\n'.join(parts)). In Markdown, block-level elements must be preceded by a blank line (\n\n) to be recognized as a new block. Without it, marked's paragraph tokenizer absorbs the<details>tag into the preceding paragraph, preventing the customdetailsmarked extension from ever being triggered. The HTML falls through toHTMLToken.sveltewhich renders it as raw text via{token.text}(textContent interpolation) instead of{@html}.Fixed
'\n'.join(parts).strip()to'\n\n'.join(parts).strip()inserialize_output()to ensure a blank line exists between every block-level element in the serialized output.Additional Information
See detailed root cause analysis at https://github.com/open-webui/open-webui/issues/24634#issuecomment-4436505583
Related issues: #24634, #24635
Contributor License Agreement
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.