mirror of
https://github.com/ItzCrazyKns/Perplexica.git
synced 2025-12-23 20:18:15 +00:00
feat(assistant-steps): only open last comp
This commit is contained in:
@@ -54,17 +54,21 @@ const getStepTitle = (
|
|||||||
const AssistantSteps = ({
|
const AssistantSteps = ({
|
||||||
block,
|
block,
|
||||||
status,
|
status,
|
||||||
|
isLast,
|
||||||
}: {
|
}: {
|
||||||
block: ResearchBlock;
|
block: ResearchBlock;
|
||||||
status: 'answering' | 'completed' | 'error';
|
status: 'answering' | 'completed' | 'error';
|
||||||
|
isLast: boolean;
|
||||||
}) => {
|
}) => {
|
||||||
const [isExpanded, setIsExpanded] = useState(true);
|
const [isExpanded, setIsExpanded] = useState(
|
||||||
|
isLast && status === 'answering' ? true : false,
|
||||||
|
);
|
||||||
const { researchEnded, loading } = useChat();
|
const { researchEnded, loading } = useChat();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (researchEnded) {
|
if (researchEnded && isLast) {
|
||||||
setIsExpanded(false);
|
setIsExpanded(false);
|
||||||
} else if (status === 'answering') {
|
} else if (status === 'answering' && isLast) {
|
||||||
setIsExpanded(true);
|
setIsExpanded(true);
|
||||||
}
|
}
|
||||||
}, [researchEnded, status]);
|
}, [researchEnded, status]);
|
||||||
|
|||||||
@@ -131,6 +131,7 @@ const MessageBox = ({
|
|||||||
<AssistantSteps
|
<AssistantSteps
|
||||||
block={researchBlock}
|
block={researchBlock}
|
||||||
status={section.message.status}
|
status={section.message.status}
|
||||||
|
isLast={isLast}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
|||||||
Reference in New Issue
Block a user