Strip tool_use_error tags from error messages

Remove XML-like <tool_use_error> tags from error content before
displaying to users, showing only the clean error message text.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
andrepimenta
2025-12-01 15:39:00 +00:00
parent df8188380d
commit bf527bb922

View File

@@ -342,9 +342,14 @@ const getScript = (isTelemetryEnabled: boolean) => `<script>
// Add content
const contentDiv = document.createElement('div');
contentDiv.className = 'message-content';
// Check if it's a tool result and truncate appropriately
let content = data.content;
// Clean up error messages by removing XML-like tags
if (data.isError && content) {
content = content.replace(/<tool_use_error>/g, '').replace(/<\\/tool_use_error>/g, '').trim();
}
if (content.length > 200 && !data.isError) {
const truncateAt = 197;
const truncated = content.substring(0, truncateAt);