[PR #22237] [MERGED] fix: TTS reading thinking content when reasoning has code blocks #65419

Closed
opened 2026-05-06 11:14:31 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/22237
Author: @Classic298
Created: 3/4/2026
Status: Merged
Merged: 3/6/2026
Merged by: @tjbck

Base: devHead: fix/tts-reading-thinking-content


📝 Commits (1)

  • b5db049 fix: TTS reading thinking content when reasoning has code blocks

📊 Changes

1 file changed (+17 additions, -7 deletions)

View changed files

📝 src/lib/utils/index.ts (+17 -7)

📄 Description

removeAllDetails() used replaceOutsideCode() which splits content on triple-backtick code blocks before applying the details-removal regex.

When thinking/reasoning content inside a <details> block contained code blocks (backticks survive html.escape), the <details> opening and </details> closing tags ended up in different split segments, making the regex unable to match either. This caused thinking content to leak through to TTS playback.

Fix: add a direct <details> strip (without code-block splitting) as the first step of getMessageContentParts(), which is the TTS-specific entry point. This catches the edge case while keeping removeAllDetails safe for copy-to-clipboard (where legitimate <details> inside code blocks should be preserved).

Fixes #22197

Contributor License Agreement

By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.

Note

Deleting the CLA section will lead to immediate closure of your PR and it will not be merged in.


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

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/22237 **Author:** [@Classic298](https://github.com/Classic298) **Created:** 3/4/2026 **Status:** ✅ Merged **Merged:** 3/6/2026 **Merged by:** [@tjbck](https://github.com/tjbck) **Base:** `dev` ← **Head:** `fix/tts-reading-thinking-content` --- ### 📝 Commits (1) - [`b5db049`](https://github.com/open-webui/open-webui/commit/b5db049f5bf60a77724b81011119b763bcd19aac) fix: TTS reading thinking content when reasoning has code blocks ### 📊 Changes **1 file changed** (+17 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `src/lib/utils/index.ts` (+17 -7) </details> ### 📄 Description removeAllDetails() used replaceOutsideCode() which splits content on triple-backtick code blocks before applying the details-removal regex. When thinking/reasoning content inside a `<details>` block contained code blocks (backticks survive html.escape), the `<details>` opening and `</details>` closing tags ended up in different split segments, making the regex unable to match either. This caused thinking content to leak through to TTS playback. Fix: add a direct `<details>` strip (without code-block splitting) as the first step of getMessageContentParts(), which is the TTS-specific entry point. This catches the edge case while keeping removeAllDetails safe for copy-to-clipboard (where legitimate `<details>` inside code blocks should be preserved). Fixes #22197 ### Contributor License Agreement <!-- 🚨 DO NOT DELETE THE TEXT BELOW 🚨 Keep the "Contributor License Agreement" confirmation text intact. Deleting it will trigger the CLA-Bot to INVALIDATE your PR. --> By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](https://github.com/open-webui/open-webui/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms. > [!NOTE] > Deleting the CLA section will lead to immediate closure of your PR and it will not be merged in. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-06 11:14:31 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#65419