mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-05 02:41:34 +00:00
fix: tool HTML embeds vanish when the HTML contains entities like " (#31390)
Tools that return inline HTML showed no embed at all when the HTML contained an entity such as `"` or `"`, and HTML containing `&` or `<` showed up with those turned into real characters. The chat view unescaped HTML entities in a tool's embeds, arguments and file links, which is only right for chats saved by older versions, so on current chats it changed the tool's own HTML before displaying it. Embeds, tool arguments and file links now show exactly what the tool returned, and older chats render as before. Fixes #28085
This commit is contained in:
parent
fab58bd35f
commit
c7caa1421d
1 changed files with 6 additions and 3 deletions
|
|
@ -1,3 +1,5 @@
|
|||
import { encode } from 'html-entities';
|
||||
|
||||
export type OutputContentPart = {
|
||||
type?: string;
|
||||
text?: unknown;
|
||||
|
|
@ -228,9 +230,10 @@ function buildToolCallToken(item: OutputItem, toolOutputByCallId: Record<string,
|
|||
name,
|
||||
done: isDone ? 'true' : 'false',
|
||||
status,
|
||||
arguments: stringifyAttribute(item.arguments ?? ''),
|
||||
files: stringifyAttribute(resultItem?.files),
|
||||
embeds: stringifyAttribute(resultItem?.embeds)
|
||||
// ToolCallDisplay HTML-decodes these, like legacy <details> attributes.
|
||||
arguments: encode(stringifyAttribute(item.arguments ?? '')),
|
||||
files: encode(stringifyAttribute(resultItem?.files)),
|
||||
embeds: encode(stringifyAttribute(resultItem?.embeds))
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue