diff --git a/front/components/assistant/TryAssistant.tsx b/front/components/assistant/TryAssistant.tsx index 8c594d1eb954..0c74d5a7e741 100644 --- a/front/components/assistant/TryAssistant.tsx +++ b/front/components/assistant/TryAssistant.tsx @@ -102,8 +102,10 @@ export function TryAssistantModal({ export function TryAssistant({ owner, assistant, + conversationFading, }: { owner: WorkspaceType; + conversationFading?: boolean; assistant: LightAgentConfigurationType | null; }) { const { user } = useUser(); @@ -145,6 +147,7 @@ export function TryAssistant({ onStickyMentionsChange={setStickyMentions} isInModal hideReactions + isFading={conversationFading} /> )} @@ -175,11 +178,14 @@ export function usePreviewAssistant({ builderState: AssistantBuilderState; }): { shouldAnimate: boolean; + isFading: boolean; // Add isFading to the return type draftAssistant: LightAgentConfigurationType | null; } { + const animationLength = 1000; const [draftAssistant, setDraftAssistant] = useState(); const [animateDrawer, setAnimateDrawer] = useState(false); + const [isFading, setIsFading] = useState(false); const drawerAnimationTimeoutRef = useRef(null); const debounceHandle = useRef(undefined); @@ -189,9 +195,11 @@ export function usePreviewAssistant({ drawerAnimationTimeoutRef.current = null; } setAnimateDrawer(true); + setIsFading(true); // Start fading conversation drawerAnimationTimeoutRef.current = setTimeout(() => { setAnimateDrawer(false); - }, 1000); + setIsFading(false); // Stop fading + }, animationLength); }; const submit = useCallback(async () => { @@ -224,7 +232,10 @@ export function usePreviewAssistant({ animate(); - setDraftAssistant(a); + // Use setTimeout to delay the execution of setDraftAssistant by 500 milliseconds + setTimeout(() => { + setDraftAssistant(a); + }, animationLength / 2); }, [ owner, builderState.actionMode, @@ -245,6 +256,7 @@ export function usePreviewAssistant({ return { shouldAnimate: animateDrawer, + isFading, draftAssistant: draftAssistant ?? null, }; } diff --git a/front/components/assistant/conversation/Conversation.tsx b/front/components/assistant/conversation/Conversation.tsx index 4956d2aca8e5..339d91a33e03 100644 --- a/front/components/assistant/conversation/Conversation.tsx +++ b/front/components/assistant/conversation/Conversation.tsx @@ -19,6 +19,7 @@ import { useConversationReactions, useConversations, } from "@app/lib/swr"; +import { classNames } from "@app/lib/utils"; /** * @@ -32,6 +33,7 @@ export default function Conversation({ onStickyMentionsChange, isInModal, hideReactions, + isFading = false, }: { owner: WorkspaceType; user: UserType; @@ -39,6 +41,7 @@ export default function Conversation({ onStickyMentionsChange?: (mentions: AgentMention[]) => void; isInModal?: boolean; hideReactions?: boolean; + isFading?: boolean; }) { const { conversation, @@ -181,7 +184,7 @@ export default function Conversation({ } return ( -
+
{conversation.content.map((versionedMessages) => { const m = versionedMessages[versionedMessages.length - 1]; const convoReactions = reactions.find((r) => r.messageId === m.sId); diff --git a/front/components/assistant_builder/AssistantBuilder.tsx b/front/components/assistant_builder/AssistantBuilder.tsx index b17ac8fe8842..9bba959abdfb 100644 --- a/front/components/assistant_builder/AssistantBuilder.tsx +++ b/front/components/assistant_builder/AssistantBuilder.tsx @@ -410,8 +410,11 @@ export default function AssistantBuilder({ ? `Edit @${builderState.handle}` : "New Assistant"; - const { shouldAnimate: shouldAnimatePreviewDrawer, draftAssistant } = - usePreviewAssistant({ owner, builderState }); + const { + shouldAnimate: shouldAnimatePreviewDrawer, + draftAssistant, + isFading, + } = usePreviewAssistant({ owner, builderState }); return ( <> @@ -529,7 +532,11 @@ export default function AssistantBuilder({ : "" )} > - +
} isRightPanelOpen={previewDrawerOpenedAt !== null} diff --git a/front/tailwind.config.js b/front/tailwind.config.js index c6d0ebff9a19..2f7df70cdd03 100644 --- a/front/tailwind.config.js +++ b/front/tailwind.config.js @@ -108,16 +108,22 @@ module.exports = { opacity: 0, }, }, + fadeout: { + "0%": { + opacity: "1", + }, + "100%": { + opacity: "0", + }, + }, reload: { "0%, 100%": { transform: "scale(1)", opacity: "1", - filter: "blur(0px)", }, "50%": { - transform: "scale(0.98)", - opacity: "0.8", - filter: "blur(8px)", + transform: "scale(0.99)", + opacity: "0.4", }, }, }, @@ -127,6 +133,7 @@ module.exports = { "cursor-blink": "cursor-blink 0.9s infinite;", shake: "shake 0.82s cubic-bezier(.36,.07,.19,.97) both", reload: "reload 1000ms ease-out", + fadeout: "fadeout 500ms ease-out", }, colors: { brand: { diff --git a/sparkle/package-lock.json b/sparkle/package-lock.json index 980b0f3ed875..9970fc88585a 100644 --- a/sparkle/package-lock.json +++ b/sparkle/package-lock.json @@ -1,12 +1,12 @@ { "name": "@dust-tt/sparkle", - "version": "0.2.114", + "version": "0.2.115", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@dust-tt/sparkle", - "version": "0.2.114", + "version": "0.2.115", "license": "ISC", "dependencies": { "@headlessui/react": "^1.7.17", diff --git a/sparkle/package.json b/sparkle/package.json index 5c1cf2f3bb4f..cc88ea562722 100644 --- a/sparkle/package.json +++ b/sparkle/package.json @@ -1,6 +1,6 @@ { "name": "@dust-tt/sparkle", - "version": "0.2.114", + "version": "0.2.115", "scripts": { "build": "rm -rf dist && rollup -c", "build:with-tw-base": "rollup -c --environment INCLUDE_TW_BASE:true", diff --git a/sparkle/src/components/BuilderLayout.tsx b/sparkle/src/components/BuilderLayout.tsx index 9cfb80aa6d23..7411bbcd3bf2 100644 --- a/sparkle/src/components/BuilderLayout.tsx +++ b/sparkle/src/components/BuilderLayout.tsx @@ -25,7 +25,7 @@ export function BuilderLayout({
-
+
{leftPanel} @@ -51,7 +51,7 @@ export function BuilderLayout({ isRightPanelOpen ? "s-w-[440px]" : "s-w-0" )} > -
{rightPanel}
+
{rightPanel}