[PR #20755] [MERGED] fix: decode HTML entities in tool call results for multi-turn conversations #48815

Closed
opened 2026-04-30 00:56:13 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/20755
Author: @Classic298
Created: 1/17/2026
Status: Merged
Merged: 2/12/2026
Merged by: @tjbck

Base: devHead: fix-unescaped


📝 Commits (1)

  • fc90912 fix: decode HTML entities in tool call results for multi-turn conversations

📊 Changes

1 file changed (+8 additions, -8 deletions)

View changed files

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

📄 Description

Problem

In multi-turn conversations involving tool calls, messages retrieved from the database contain HTML-escaped JSON (e.g., ", &, '). The processDetails function in the frontend inserted this HTML-escaped content directly into messages, causing the LLM to receive malformed, hard-to-parse content.
This degraded model performance in tool-heavy chats, as subsequent turns would contain escaped entities.

Solution

Use the existing unescapeHtml utility function to decode HTML entities in tool call results before inserting them into the message content.

Changes

  • src/lib/utils/index.ts: Modified the processDetails function to call unescapeHtml on attributes.result before replacement

Testing

  1. Started a new chat and sent a message triggering a tool call (e.g., web search)
  2. Sent a follow-up message
  3. Inspected the request payload in browser DevTools
  4. Verified the assistant's previous message now contains clean JSON without HTML entities

Fixes #20600

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/20755 **Author:** [@Classic298](https://github.com/Classic298) **Created:** 1/17/2026 **Status:** ✅ Merged **Merged:** 2/12/2026 **Merged by:** [@tjbck](https://github.com/tjbck) **Base:** `dev` ← **Head:** `fix-unescaped` --- ### 📝 Commits (1) - [`fc90912`](https://github.com/open-webui/open-webui/commit/fc9091230530229e876030bb8fee62eed7edc197) fix: decode HTML entities in tool call results for multi-turn conversations ### 📊 Changes **1 file changed** (+8 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `src/lib/utils/index.ts` (+8 -8) </details> ### 📄 Description ### Problem In multi-turn conversations involving tool calls, messages retrieved from the database contain HTML-escaped JSON (e.g., `&quot;`, `&amp;`, `&#x27;`). The processDetails function in the frontend inserted this HTML-escaped content directly into messages, causing the LLM to receive malformed, hard-to-parse content. This degraded model performance in tool-heavy chats, as subsequent turns would contain escaped entities. ### Solution Use the existing unescapeHtml utility function to decode HTML entities in tool call results before inserting them into the message content. ### Changes - src/lib/utils/index.ts: Modified the processDetails function to call unescapeHtml on attributes.result before replacement ### Testing 1. Started a new chat and sent a message triggering a tool call (e.g., web search) 2. Sent a follow-up message 3. Inspected the request payload in browser DevTools 4. Verified the assistant's previous message now contains clean JSON without HTML entities Fixes #20600 ### Contributor License Agreement 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-04-30 00:56:13 -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#48815