fix: Resolve duplicate content rendering in chat messages
Description
This PR fixes an issue where chat messages containing <Thought> and <Output> tags were being rendered multiple times in the UI. The changes improve the content parsing logic and ensure single rendering of message content.
Changelog Entry
Description
Fixed a bug in the chat message rendering system where special tag content was being duplicated in the UI. This improves the readability and correctness of chat messages containing thought processes and outputs.
Added
Added safety checks for content parsing
Added debug logging for content flow tracking
Changed
Updated parseSpecialTags function to handle edge cases
Improved content rendering logic in ContentRenderer.svelte
Fixed
Fixed content parsing when special tags are missing
##Screenshot of changes
Collapsed thought tag
Expanded thought tag
🔄 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/7438
**Author:** [@seshuthota](https://github.com/seshuthota)
**Created:** 11/27/2024
**Status:** ❌ Closed
**Base:** `dev` ← **Head:** `feature-o1-thought`
---
### 📝 Commits (2)
- [`0a26c41`](https://github.com/open-webui/open-webui/commit/0a26c41c7b58300f37348ba580a4f0d682ca5fbd) Merge pull request #7399 from open-webui/dev
- [`23c59dd`](https://github.com/open-webui/open-webui/commit/23c59ddc059cd647a90b04e841bac3480a2ac77b) Functionality to support the thought response
### 📊 Changes
**5 files changed** (+317 additions, -70 deletions)
<details>
<summary>View changed files</summary>
📝 `package-lock.json` (+97 -24)
📝 `package.json` (+3 -1)
📝 `src/lib/components/chat/Messages/ContentRenderer.svelte` (+162 -45)
➕ `src/lib/components/chat/Messages/ThoughtOutput.svelte` (+46 -0)
📝 `src/tailwind.css` (+9 -0)
</details>
### 📄 Description
# Pull Request Title
fix: Resolve duplicate content rendering in chat messages
# Description
This PR fixes an issue where chat messages containing `<Thought>` and `<Output>` tags were being rendered multiple times in the UI. The changes improve the content parsing logic and ensure single rendering of message content.
# Changelog Entry
### Description
Fixed a bug in the chat message rendering system where special tag content was being duplicated in the UI. This improves the readability and correctness of chat messages containing thought processes and outputs.
### Added
- Added safety checks for content parsing
- Added debug logging for content flow tracking
### Changed
- Updated `parseSpecialTags` function to handle edge cases
- Improved content rendering logic in ContentRenderer.svelte
### Fixed
- Fixed content parsing when special tags are missing
### Code Changes
src/lib/components/chat/Messages/ContentRenderer.svelte
### Testing
- Tested with various message formats:
- Plain text messages
- Messages with only `<Thought>` tags
- Messages with both `<Thought>` and `<Output>` tags
- Empty messages
- Messages with malformed tags
### Additional Information
- Related to chat message rendering improvements
##Screenshot of changes
Collapsed thought tag

Expanded thought tag

---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/7438
Author: @seshuthota
Created: 11/27/2024
Status: ❌ Closed
Base:
dev← Head:feature-o1-thought📝 Commits (2)
0a26c41Merge pull request #7399 from open-webui/dev23c59ddFunctionality to support the thought response📊 Changes
5 files changed (+317 additions, -70 deletions)
View changed files
📝
package-lock.json(+97 -24)📝
package.json(+3 -1)📝
src/lib/components/chat/Messages/ContentRenderer.svelte(+162 -45)➕
src/lib/components/chat/Messages/ThoughtOutput.svelte(+46 -0)📝
src/tailwind.css(+9 -0)📄 Description
Pull Request Title
fix: Resolve duplicate content rendering in chat messages
Description
This PR fixes an issue where chat messages containing
<Thought>and<Output>tags were being rendered multiple times in the UI. The changes improve the content parsing logic and ensure single rendering of message content.Changelog Entry
Description
Fixed a bug in the chat message rendering system where special tag content was being duplicated in the UI. This improves the readability and correctness of chat messages containing thought processes and outputs.
Added
Changed
parseSpecialTagsfunction to handle edge casesFixed
Code Changes
src/lib/components/chat/Messages/ContentRenderer.svelte
Testing
<Thought>tags<Thought>and<Output>tagsAdditional Information
##Screenshot of changes


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