From 70a61ee1eb097a2b65d63d12b6a325fe8582f734 Mon Sep 17 00:00:00 2001 From: ItzCrazyKns <95534749+ItzCrazyKns@users.noreply.github.com> Date: Wed, 23 Jul 2025 12:21:07 +0530 Subject: [PATCH] feat(think-box): handle thinkingEnded --- src/components/ThinkBox.tsx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/components/ThinkBox.tsx b/src/components/ThinkBox.tsx index 9c6a576..f830945 100644 --- a/src/components/ThinkBox.tsx +++ b/src/components/ThinkBox.tsx @@ -1,15 +1,23 @@ 'use client'; -import { useState } from 'react'; -import { cn } from '@/lib/utils'; +import { useEffect, useState } from 'react'; import { ChevronDown, ChevronUp, BrainCircuit } from 'lucide-react'; interface ThinkBoxProps { content: string; + thinkingEnded: boolean; } -const ThinkBox = ({ content }: ThinkBoxProps) => { - const [isExpanded, setIsExpanded] = useState(false); +const ThinkBox = ({ content, thinkingEnded }: ThinkBoxProps) => { + const [isExpanded, setIsExpanded] = useState(true); + + useEffect(() => { + if (thinkingEnded) { + setIsExpanded(false); + } else { + setIsExpanded(true); + } + }, [thinkingEnded]); return (