diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/components/displays/AIReasoningPart.tsx b/apps/desktop/layer/renderer/src/modules/ai-chat/components/displays/AIReasoningPart.tsx index 4e96b1bc4..0e2a49d53 100644 --- a/apps/desktop/layer/renderer/src/modules/ai-chat/components/displays/AIReasoningPart.tsx +++ b/apps/desktop/layer/renderer/src/modules/ai-chat/components/displays/AIReasoningPart.tsx @@ -1,5 +1,9 @@ +import { ScrollArea } from "@follow/components/ui/scroll-area/ScrollArea.js" import { cn } from "@follow/utils" import * as React from "react" +import { useRef } from "react" + +import { useAutoScroll } from "../../hooks/useAutoScroll" interface AIReasoningPartProps { text: string @@ -7,19 +11,26 @@ interface AIReasoningPartProps { className?: string } -export const AIReasoningPart: React.FC = React.memo(({ text, className }) => { - if (!text) return null +export const AIReasoningPart: React.FC = React.memo( + ({ text, className, isStreaming }) => { + const scrollAreaRef = useRef(null) + useAutoScroll(scrollAreaRef.current, !!isStreaming) - return ( -
-
-
-
-          {text}
-        
+ if (!text) return null + + return ( +
+
+
+ +
+              {text}
+            
+
+
-
- ) -}) + ) + }, +) AIReasoningPart.displayName = "AIReasoningPart"