mirror of
https://github.com/andrepimenta/claude-code-chat.git
synced 2025-12-13 05:39:46 +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:
@@ -345,6 +345,11 @@ const getScript = (isTelemetryEnabled: boolean) => `<script>
|
|||||||
|
|
||||||
// Check if it's a tool result and truncate appropriately
|
// Check if it's a tool result and truncate appropriately
|
||||||
let content = data.content;
|
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) {
|
if (content.length > 200 && !data.isError) {
|
||||||
const truncateAt = 197;
|
const truncateAt = 197;
|
||||||
const truncated = content.substring(0, truncateAt);
|
const truncated = content.substring(0, truncateAt);
|
||||||
|
|||||||
Reference in New Issue
Block a user