diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/components/displays/AIChainOfThought.tsx b/apps/desktop/layer/renderer/src/modules/ai-chat/components/displays/AIChainOfThought.tsx index 2b80bd327..372e9a9d4 100644 --- a/apps/desktop/layer/renderer/src/modules/ai-chat/components/displays/AIChainOfThought.tsx +++ b/apps/desktop/layer/renderer/src/modules/ai-chat/components/displays/AIChainOfThought.tsx @@ -1,5 +1,6 @@ import type { CollapseCssRef } from "@follow/components/ui/collapse/CollapseCss.js" import { CollapseCss, CollapseCssGroup } from "@follow/components/ui/collapse/CollapseCss.js" +import { ShinyText } from "@follow/components/ui/shiny-text/ShinyText.js" import { cn } from "@follow/utils" import type { ReasoningUIPart } from "ai" import * as React from "react" @@ -33,8 +34,6 @@ export const AIChainOfThought: React.FC = React.memo( return (
-
- = React.memo(
{!currentChainReasoningIsFinished ? ( - - Thinking: {currentReasoningTitle} + + Thinking:{" "} + ) : ( "Finished Thinking" diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/components/message/AIMessageParts.tsx b/apps/desktop/layer/renderer/src/modules/ai-chat/components/message/AIMessageParts.tsx index d4238893b..8a9592ee7 100644 --- a/apps/desktop/layer/renderer/src/modules/ai-chat/components/message/AIMessageParts.tsx +++ b/apps/desktop/layer/renderer/src/modules/ai-chat/components/message/AIMessageParts.tsx @@ -62,7 +62,7 @@ export const AIMessageParts: React.FC = React.memo( parts.push(part) } else if (part.type.startsWith("tool-display")) { parts.push(part as ToolUIPart) - } else if (part.type === "reasoning") { + } else if (part.type === "reasoning" && part.text) { mergedReasoningParts.push(part as ReasoningUIPart) } } @@ -73,9 +73,11 @@ export const AIMessageParts: React.FC = React.memo( return parts }, [message.parts]) + const lowPriorityParts = React.useDeferredValue(displayParts) + return ( <> - {displayParts.map((partOrParts, index) => { + {lowPriorityParts.map((partOrParts, index) => { const partKey = `${message.id}-${index}` if (Array.isArray(partOrParts)) { diff --git a/packages/internal/components/src/ui/shiny-text/ShinyText.tsx b/packages/internal/components/src/ui/shiny-text/ShinyText.tsx new file mode 100644 index 000000000..2764bbe00 --- /dev/null +++ b/packages/internal/components/src/ui/shiny-text/ShinyText.tsx @@ -0,0 +1,29 @@ +import { clsx } from "@follow/utils" +import * as React from "react" + +import styles from "./index.module.css" + +interface ShinyTextProps { + text: string + disabled?: boolean + speed?: number + className?: string +} + +export const ShinyText: React.FC = ({ + text, + disabled = false, + speed = 2, + className = "", +}) => { + const animationDuration = `${speed}s` + + return ( +
+ {text} +
+ ) +} diff --git a/packages/internal/components/src/ui/shiny-text/index.module.css b/packages/internal/components/src/ui/shiny-text/index.module.css new file mode 100644 index 000000000..cbacda1b0 --- /dev/null +++ b/packages/internal/components/src/ui/shiny-text/index.module.css @@ -0,0 +1,28 @@ +.shiny-text { + @apply text-text-secondary; + + background-image: linear-gradient( + 150deg, + rgba(255, 255, 255, 0) 40%, + rgba(255, 255, 255, 0.8) 50%, + rgba(255, 255, 255, 0) 60% + ); + background-size: 200% 100%; + -webkit-background-clip: text; + background-clip: text; + display: inline-block; + animation: shine 5s linear infinite; +} + +@keyframes shine { + 0% { + background-position: 100%; + } + 100% { + background-position: -100%; + } +} + +.shiny-text.disabled { + animation: none; +}