// "use client"; // import { ToolInvocationUIPart } from "app-types/chat"; // import { cn, toAny } from "lib/utils"; // import { memo, useEffect, useMemo, useRef, useState } from "react"; // import { // CheckIcon, // ChevronDownIcon, // CircleIcon, // Loader2Icon, // } from "lucide-react"; // import { motion } from "framer-motion"; // import { TextShimmer } from "ui/text-shimmer"; // import { ThoughtData } from "lib/ai/tools/thinking/sequential-thinking"; // import { WordByWordFadeIn } from "../markdown"; // interface SequentialThinkingToolInvocationProps { // part: ToolInvocationUIPart["toolInvocation"]; // } // function PureSequentialThinkingToolInvocation({ // part, // }: SequentialThinkingToolInvocationProps) { // const createdAt = useRef(Date.now()); // const initState = useRef(part.state); // const [expanded, setExpanded] = useState(true); // const [isDiff, setIsDiff] = useState(false); // const thinkingData = useMemo(() => { // return (toAny(part).result || part.args) as // | { steps: Partial[] } // | undefined; // }, [part.args, part.state]); // const steps = useMemo(() => { // return thinkingData?.steps || []; // }, [thinkingData]); // const second = useMemo(() => { // if (!isDiff) return; // return Math.floor((Date.now() - createdAt.current) / 1000); // }, [part.state]); // const header = useMemo(() => { // const message = `Reasoned for ${second ? `${second} seconds` : "a few seconds"}`; // if (part.state == "result") return message; // return {message}; // }, [part.state, second]); // useEffect(() => { // if (initState.current == "result") return; // return () => { // setIsDiff(true); // }; // }, [part.state]); // return ( //
//
//
setExpanded(!expanded)} // className="text-sm cursor-pointer text-muted-foreground select-none flex gap-2 items-center hover:text-foreground transition-colors" // > // {header} // //
//
//
// {steps.map((step, index) => { // const isLastStep = index === steps.length - 1; // const isRunning = isLastStep && part.state !== "result"; // const isStepFinal = part.state === "result" && isLastStep; // const isOnlyOneStep = steps.length === 1 && index == 0; // return ( //
//
//
// {isStepFinal ? ( // // ) : isRunning ? ( // // ) : ( // // )} //
// // {isStepFinal ? `Final Step` : `Step ${index + 1}`} // //
//

// {step.thought} //

// {!isLastStep && ( // // )} //
// ); // })} //
//
//
//
// ); // } // export const SequentialThinkingToolInvocation = memo( // PureSequentialThinkingToolInvocation, // );