🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
fix(agent): Add gradient animation to loading state (#15064)
Ben Bachemdd053b208c9a
diff --git a/web/src/ee/features/in-app-agent/components/InAppAgentWindow.module.css b/web/src/ee/features/in-app-agent/components/InAppAgentWindow.module.cssnew file mode 100644index 0000000000..e0ce40a2a4--- /dev/null+++ b/web/src/ee/features/in-app-agent/components/InAppAgentWindow.module.css@@ -0,0 +1,29 @@+@property --in-app-agent-loading-angle {+ syntax: "<angle>";+ initial-value: 0deg;+ inherits: false;+}++.loadingGradient {+ background: conic-gradient(+ from var(--in-app-agent-loading-angle),+ transparent 90deg,+ var(--color-2) 145deg,+ var(--color-3) 215deg,+ transparent 270deg+ );+ filter: drop-shadow(0 0 2rem var(--color-3));+ animation: rotate-loading-gradient 2s linear infinite alternate;+}++@keyframes rotate-loading-gradient {+ to {+ --in-app-agent-loading-angle: 360deg;+ }+}++@media (prefers-reduced-motion: reduce) {+ .loadingGradient {+ animation: none;+ }+}diff --git a/web/src/ee/features/in-app-agent/components/InAppAgentWindow.stories.tsx b/web/src/ee/features/in-app-agent/components/InAppAgentWindow.stories.tsxindex d5e681afa5..dcd263372c 100644--- a/web/src/ee/features/in-app-agent/components/InAppAgentWindow.stories.tsx+++ b/web/src/ee/features/in-app-agent/components/InAppAgentWindow.stories.tsx@@ -741,6 +741,8 @@ export const Conversation = meta.story({export const Streaming = meta.story({args: {+ isAssistantTurnInProgress: true,+ isInputDisabled: true,selectedConversationId: "conversation-1",messages: streamingSeedMessages,},@@ -749,6 +751,8 @@ export const Streaming = meta.story({export const LoadingResponse = meta.story({args: {+ isAssistantTurnInProgress: true,+ isInputDisabled: true,messages: [{id: "user-1",@@ -771,6 +775,7 @@ export const LoadingResponse = meta.story({export const LoadingAfterToolCall = meta.story({args: {+ isAssistantTurnInProgress: true,isInputDisabled: true,messages: [{@@ -936,6 +941,7 @@ export const FeedbackControlsShowAfterTurnEnd = meta.story({export const Connecting = meta.story({args: {+ isAssistantTurnInProgress: true,isInputDisabled: true,messages: [{diff --git a/web/src/ee/features/in-app-agent/components/InAppAgentWindow.tsx b/web/src/ee/features/in-app-agent/components/InAppAgentWindow.tsxindex 7264a632d5..2da5e12ea6 100644--- a/web/src/ee/features/in-app-agent/components/InAppAgentWindow.tsx+++ b/web/src/ee/features/in-app-agent/components/InAppAgentWindow.tsx@@ -44,6 +44,7 @@ import {type InAppAgentError,isInAppAgentRateLimited,} from "@/src/ee/features/in-app-agent/components/utils/utils";+import styles from "./InAppAgentWindow.module.css";const AUTO_SCROLL_THRESHOLD_PX = 50;const SCROLL_DIRECTION_TOLERANCE_PX = 1;@@ -663,6 +664,32 @@ export function InAppAgentWindow(props: InAppAgentWindowProps) {<InAppAgentRateLimitError error={error} isExpanded={isExpanded} /></div>)}+ {isAssistantTurnInProgress && pendingToolCalls.length === 0 ? (+ <div+ className={cn(+ "pointer-events-none relative h-px w-full shrink-0 select-none",+ isExpanded && "mx-auto max-w-3xl",+ )}+ >+ <div className="absolute top-0 h-4 w-full -translate-y-full overflow-hidden">+ <div className="absolute top-0 h-12 w-full bg-radial from-(--color-3) to-transparent to-60% bg-center opacity-25" />+ </div>+ <div className="absolute bottom-0 left-0 h-px w-full overflow-hidden">+ <div+ aria-hidden="true"+ className={cn("h-[4rem]", styles.loadingGradient)}+ />+ {isExpanded && (+ <>+ {/* Gradient overlays for expanded state so that the edges fade out */}+ {/* Make sure this matches the color of the background */}+ <div className="from-header absolute top-0 right-0 h-full w-1/2 bg-linear-to-l to-transparent" />+ <div className="from-header absolute top-0 left-0 h-full w-1/2 bg-linear-to-r to-transparent" />+ </>+ )}+ </div>+ </div>+ ) : null}<divclassName={cn("p-1.5",@@ -720,6 +747,7 @@ export function InAppAgentWindow(props: InAppAgentWindowProps) {size="icon"className="h-8 w-8 rounded-md border"aria-label="Send message"+ variant="outline"disabled={isInputDisabled || !input.trim()}><SendHorizontal className="h-4 w-4" />