diff --git a/src/renderer/src/components/ThinkingEffect.tsx b/src/renderer/src/components/ThinkingEffect.tsx index 6244eb2175..96015be837 100644 --- a/src/renderer/src/components/ThinkingEffect.tsx +++ b/src/renderer/src/components/ThinkingEffect.tsx @@ -25,24 +25,31 @@ const ThinkingEffect: React.FC = ({ isThinking, thinkingTimeText, content } }, [content, isThinking, messages]) + const showThinking = useMemo(() => { + return isThinking && !expanded + }, [expanded, isThinking]) + const LINE_HEIGHT = 14 const containerHeight = useMemo(() => { - if (expanded || messages.length < 2) return 38 + if (!showThinking || messages.length < 2) return 38 return Math.min(68, Math.max(messages.length + 1, 2) * LINE_HEIGHT + 10) - }, [expanded, messages.length]) + }, [showThinking, messages.length]) return ( - + - {thinkingTimeText} + {thinkingTimeText} - {!expanded && ( + {showThinking && ( = ({ isThinking, thinkingTimeText, content )} - + ) } -const ThinkingContainer = styled(motion.div)` +const ThinkingContainer = styled.div` width: 100%; - border-radius: 12px; + border-radius: 10px; overflow: hidden; position: relative; display: flex; @@ -86,7 +93,7 @@ const ThinkingContainer = styled(motion.div)` pointer-events: none; user-select: none; &.expanded { - border-radius: 12px 12px 0 0; + border-radius: 10px 10px 0 0; } ` @@ -99,7 +106,7 @@ const Title = styled.div` padding: 6px 0; z-index: 99; transition: padding-top 150ms; - &.expanded { + &.showThinking { padding-top: 12px; } `