diff --git a/components/chat-message-display.tsx b/components/chat-message-display.tsx index 69d5f86..717296d 100644 --- a/components/chat-message-display.tsx +++ b/components/chat-message-display.tsx @@ -417,6 +417,7 @@ export function ChatMessageDisplay({ // Track previous message count to detect bulk loads vs streaming const prevMessageCountRef = useRef(0) + const scrollThrottleRef = useRef | null>(null) useEffect(() => { if (messagesEndRef.current && messages.length > 0) { @@ -430,8 +431,13 @@ export function ChatMessageDisplay({ return } - // Single message added - smooth scroll - messagesEndRef.current.scrollIntoView({ behavior: "smooth" }) + // Throttle scroll during streaming to avoid layout thrashing + if (!scrollThrottleRef.current) { + messagesEndRef.current.scrollIntoView({ behavior: "smooth" }) + scrollThrottleRef.current = setTimeout(() => { + scrollThrottleRef.current = null + }, 150) + } } }, [messages]) diff --git a/components/chat/ToolCallCard.tsx b/components/chat/ToolCallCard.tsx index 392c60a..ca0a4c1 100644 --- a/components/chat/ToolCallCard.tsx +++ b/components/chat/ToolCallCard.tsx @@ -195,7 +195,22 @@ export function ToolCallCard({ {input && isExpanded && (
{typeof input === "object" && input.xml ? ( - + state === "input-streaming" || + state === "input-available" ? ( +
+                                {input.xml}
+                            
+ ) : ( + + ) ) : typeof input === "object" && input.operations && Array.isArray(input.operations) ? (