feat(assistant-steps): only open last comp

This commit is contained in:
ItzCrazyKns
2025-12-23 17:17:56 +05:30
parent 5f04034650
commit c3b74a3fd0
2 changed files with 8 additions and 3 deletions

View File

@@ -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]);

View File

@@ -131,6 +131,7 @@ const MessageBox = ({
<AssistantSteps
block={researchBlock}
status={section.message.status}
isLast={isLast}
/>
</div>
))}