From 43139a5ef0b7ebd225e7983352c4d3012dbb966d Mon Sep 17 00:00:00 2001 From: "dayuan.jiang" Date: Sun, 14 Dec 2025 10:47:18 +0900 Subject: [PATCH] fix: show friendly message and yellow badge for truncated output - Add yellow 'Truncated' badge in UI instead of red 'Error' when XML is incomplete - Show friendly error message for toolUse.input is invalid errors - Built on top of append_diagram continuation feature --- components/chat-message-display.tsx | 45 ++++++++++++++++++++++------- components/chat-panel.tsx | 6 ++++ 2 files changed, 41 insertions(+), 10 deletions(-) diff --git a/components/chat-message-display.tsx b/components/chat-message-display.tsx index 1429c31..81c80e7 100644 --- a/components/chat-message-display.tsx +++ b/components/chat-message-display.tsx @@ -451,11 +451,24 @@ export function ChatMessageDisplay({ Complete )} - {state === "output-error" && ( - - Error - - )} + {state === "output-error" && + (() => { + // Check if this is a truncation (incomplete XML) vs real error + const isTruncated = + (toolName === "display_diagram" || + toolName === "append_diagram") && + (!input?.xml || + !input.xml.includes("")) + return isTruncated ? ( + + Truncated + + ) : ( + + Error + + ) + })()} {input && Object.keys(input).length > 0 && (