From 417dbcab9be864f9ff42f133bb34c32e81fc476b Mon Sep 17 00:00:00 2001 From: Anirban Kar Date: Fri, 6 Dec 2024 17:14:56 +0530 Subject: [PATCH] added spinner --- app/components/chat/Artifact.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/components/chat/Artifact.tsx b/app/components/chat/Artifact.tsx index f26b1ee9..3ca2508c 100644 --- a/app/components/chat/Artifact.tsx +++ b/app/components/chat/Artifact.tsx @@ -28,6 +28,7 @@ interface ArtifactProps { export const Artifact = memo(({ messageId }: ArtifactProps) => { const userToggledActions = useRef(false); const [showActions, setShowActions] = useState(false); + const [allActionFinished, setAllActionFinished] = useState(false); const artifacts = useStore(workbenchStore.artifacts); const artifact = artifacts[messageId]; @@ -47,6 +48,11 @@ export const Artifact = memo(({ messageId }: ArtifactProps) => { if (actions.length && !showActions && !userToggledActions.current) { setShowActions(true); } + + if (actions.length !== 0) { + const finished = !actions.find((action) => action.status !== 'complete'); + setAllActionFinished(finished); + } }, [actions]); return ( @@ -62,7 +68,11 @@ export const Artifact = memo(({ messageId }: ArtifactProps) => { {artifact.type == 'bundled' && ( <>
-
+ {allActionFinished ? ( +
+ ) : ( +
+ )}