From c3b74a3fd0eb86b82851dcda6ff19f2a44e3dba0 Mon Sep 17 00:00:00 2001 From: ItzCrazyKns <95534749+ItzCrazyKns@users.noreply.github.com> Date: Tue, 23 Dec 2025 17:17:56 +0530 Subject: [PATCH] feat(assistant-steps): only open last comp --- src/components/AssistantSteps.tsx | 10 +++++++--- src/components/MessageBox.tsx | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/AssistantSteps.tsx b/src/components/AssistantSteps.tsx index 46461e9..c715a92 100644 --- a/src/components/AssistantSteps.tsx +++ b/src/components/AssistantSteps.tsx @@ -54,17 +54,21 @@ const getStepTitle = ( const AssistantSteps = ({ block, status, + isLast, }: { block: ResearchBlock; status: 'answering' | 'completed' | 'error'; + isLast: boolean; }) => { - const [isExpanded, setIsExpanded] = useState(true); + const [isExpanded, setIsExpanded] = useState( + isLast && status === 'answering' ? true : false, + ); const { researchEnded, loading } = useChat(); useEffect(() => { - if (researchEnded) { + if (researchEnded && isLast) { setIsExpanded(false); - } else if (status === 'answering') { + } else if (status === 'answering' && isLast) { setIsExpanded(true); } }, [researchEnded, status]); diff --git a/src/components/MessageBox.tsx b/src/components/MessageBox.tsx index 93c26a6..3ea7909 100644 --- a/src/components/MessageBox.tsx +++ b/src/components/MessageBox.tsx @@ -131,6 +131,7 @@ const MessageBox = ({ ))}