mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-16 23:21:44 -05:00
[PR #15094] [MERGED] fix: sanatizeResponseContent for stop token display #94752
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/15094
Author: @silentoplayz
Created: 6/18/2025
Status: ✅ Merged
Merged: 6/18/2025
Merged by: @tjbck
Base:
dev← Head:small-fix📝 Commits (1)
898b65afix: sanatizeResponseContent for stop token display📊 Changes
1 file changed (+8 additions, -8 deletions)
View changed files
📝
src/lib/utils/index.ts(+8 -8)📄 Description
Pull Request Checklist
Before submitting, make sure you've checked the following:
devbranch.Changelog Entry
Description
<|system|>,<|user|>) in model descriptions were not displayed correctly. Previously, these tokens were being inadvertently removed or corrupted by an overzealous sanitization rule, making model descriptions appear incomplete or malformed.Changed
sanitizeResponseContentutility function (src/lib/utils/index.ts) to reorder string replacement operations. Specifically, the general HTML entity escaping for<and>characters is now performed after specific regex-based cleanups, ensuring that essential tokens are properly escaped for rendering rather than being removed or altered.Fixed
<|system|>,<|user|>,<|end|>,<|assistant|>) within model descriptions inChatPlaceholder.svelteandPlaceholder.svelte, ensuring they are now rendered literally as intended.Additional Information
sanitizeResponseContentfunction where areplaceAll(/<\|[a-z]+\|>/g, ' ')operation was occurring before the general HTML escaping for<and>characters. By moving this specificreplaceAlloperation to occur after the HTML escaping, the tokens are now correctly converted to their HTML entity equivalents (<|token|>) and displayed as plain text by the browser, rather than being replaced with a space.src/lib/utils/index.ts,src/lib/components/chat/ChatPlaceholder.svelte,src/lib/components/chat/Placeholder.svelteScreenshots or Videos
Before fix:
After fix:
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.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.