[GH-ISSUE #24635] issue: <details type="reasoning"> tag not rendered, displayed as raw text #91106

Open
opened 2026-05-15 16:22:49 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @siriusa51 on GitHub (May 13, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/24635

Check Existing Issues

  • I have searched for any existing and/or related issues.
  • I have searched for any existing and/or related discussions.
  • I have also searched in the CLOSED issues AND CLOSED discussions and found no related items.
  • I am using the latest version of Open WebUI.

Installation Method

Git Clone

Open WebUI Version

v0.9.5

Operating System

macOS

Browser (if applicable)

Chrome

Expected Behavior

When a model returns content with <think> tags (reasoning/thinking content), Open WebUI should render them as collapsible/expandable <details type="reasoning"> UI components in the chat view.

Actual Behavior

The <details type="reasoning" done="true" duration="0"> tag is displayed as raw text in the chat message. The <summary> and content inside the <details> block are also shown as plain text instead of being rendered as a collapsible reasoning block.

Example raw output visible to user:

beginning text here
<details type="reasoning" done="true" duration="0">
<summary>Thought for 2 seconds</summary>
> reasoning content here
</details>
<details type="reasoning" done="true" duration="0">
<summary>Thought for 0 seconds</summary>
> more reasoning content
</details>

Steps to Reproduce

  1. Use a model that outputs <think>...</think> tags in its response (e.g., DeepSeek, Qwen, or any model configured to output reasoning content via reasoning_content field)
  2. Connect the model via OpenAI-compatible API
  3. Send a prompt that triggers reasoning (e.g., a complex math or logic question)
  4. Observe that the <details type="reasoning"> HTML tags are displayed as raw text instead of being rendered as collapsible components

Logs & Screenshots

N/A — visible directly in the chat UI.

Additional Information

The root cause is the same as issue #24634 (which covers type="tool_calls"). The problem is in serialize_output() in backend/open_webui/utils/middleware.py:

Text content and <details> blocks are joined together with no blank line separator ("".join(parts)). In Markdown parsing, block-level elements need a blank line (\n\n) before them. Without it, marked's paragraph tokenizer absorbs the <details> tag, the custom details marked extension is never triggered, and the HTML falls through to raw text rendering.

I have posted a detailed root cause analysis and fix in https://github.com/open-webui/open-webui/issues/24634#issuecomment-4436505583

Originally created by @siriusa51 on GitHub (May 13, 2026). Original GitHub issue: https://github.com/open-webui/open-webui/issues/24635 ## Check Existing Issues - [x] I have searched for any existing and/or related issues. - [x] I have searched for any existing and/or related discussions. - [x] I have also searched in the CLOSED issues AND CLOSED discussions and found no related items. - [x] I am using the latest version of Open WebUI. ### Installation Method Git Clone ### Open WebUI Version v0.9.5 ### Operating System macOS ### Browser (if applicable) Chrome ### Expected Behavior When a model returns content with `<think>` tags (reasoning/thinking content), Open WebUI should render them as collapsible/expandable `<details type="reasoning">` UI components in the chat view. ### Actual Behavior The `<details type="reasoning" done="true" duration="0">` tag is displayed as **raw text** in the chat message. The `<summary>` and content inside the `<details>` block are also shown as plain text instead of being rendered as a collapsible reasoning block. Example raw output visible to user: ``` beginning text here <details type="reasoning" done="true" duration="0"> <summary>Thought for 2 seconds</summary> > reasoning content here </details> <details type="reasoning" done="true" duration="0"> <summary>Thought for 0 seconds</summary> > more reasoning content </details> ``` ### Steps to Reproduce 1. Use a model that outputs `<think>...</think>` tags in its response (e.g., DeepSeek, Qwen, or any model configured to output reasoning content via `reasoning_content` field) 2. Connect the model via OpenAI-compatible API 3. Send a prompt that triggers reasoning (e.g., a complex math or logic question) 4. Observe that the `<details type="reasoning">` HTML tags are displayed as raw text instead of being rendered as collapsible components ### Logs & Screenshots N/A — visible directly in the chat UI. ### Additional Information The root cause is the same as issue #24634 (which covers `type="tool_calls"`). The problem is in `serialize_output()` in `backend/open_webui/utils/middleware.py`: Text content and `<details>` blocks are joined together with no blank line separator (`"".join(parts)`). In Markdown parsing, block-level elements need a blank line (`\n\n`) before them. Without it, marked's paragraph tokenizer absorbs the `<details>` tag, the custom `details` marked extension is never triggered, and the HTML falls through to raw text rendering. I have posted a detailed root cause analysis and fix in https://github.com/open-webui/open-webui/issues/24634#issuecomment-4436505583
Author
Owner

@owui-terminator[bot] commented on GitHub (May 13, 2026):

🔍 Related Issues Found

I found some existing issues that might be related. Please check if any of these are duplicates or contain helpful solutions:

  1. 🟢 #24634 issue:

    tag not rendered, displayed as raw text
    This is the same rendering/parsing problem, just for <details type="tool_calls"> instead of <details type="reasoning">. The new issue even cites it as the sibling/root-cause bug in serialize_output(), so the fix path is shared.
    by sharyuke

  2. 🟣 #24537 issue: Reasoning tags are displayed as raw output for Gemini 3 Flash via LiteLLM
    This closed issue reports raw reasoning tags being shown instead of the collapsible reasoning UI. It matches the same user-visible symptom and same reasoning-tag flow, making it the closest direct predecessor to the current bug.
    by arnoulddw


💡 If your issue is a duplicate, please close it and add any additional details to the existing issue instead.

This comment was generated automatically. React with 👍 if helpful, 👎 if not.

<!-- gh-comment-id:4436508641 --> @owui-terminator[bot] commented on GitHub (May 13, 2026): <!-- terminator-bot:related-issues-reply --> 🔍 **Related Issues Found** I found some existing issues that might be related. Please check if any of these are duplicates or contain helpful solutions: 1. 🟢 [#24634](https://github.com/open-webui/open-webui/issues/24634) **issue: <details type="tool_calls"> tag not rendered, displayed as raw text** *This is the same rendering/parsing problem, just for `<details type="tool_calls">` instead of `<details type="reasoning">`. The new issue even cites it as the sibling/root-cause bug in `serialize_output()`, so the fix path is shared.* *by sharyuke* 2. 🟣 [#24537](https://github.com/open-webui/open-webui/issues/24537) **issue: Reasoning tags are displayed as raw output for Gemini 3 Flash via LiteLLM** *This closed issue reports raw reasoning tags being shown instead of the collapsible reasoning UI. It matches the same user-visible symptom and same reasoning-tag flow, making it the closest direct predecessor to the current bug.* *by arnoulddw* --- 💡 If your issue is a duplicate, please close it and add any additional details to the existing issue instead. *This comment was generated automatically.* React with 👍 if helpful, 👎 if not.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#91106