mirror of
https://github.com/andrepimenta/claude-code-chat.git
synced 2025-12-10 14:59:52 +00:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user