import { useState } from "react"; import { useTranslation } from "react-i18next"; import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from "@/components/ui/collapsible"; import { Button } from "@/components/ui/button"; import { cn } from "@/lib/utils"; import { ChevronDown, ChevronRight } from "lucide-react"; type ToolCallBubbleProps = { name: string; arguments?: Record; response?: string; side: "left" | "right"; }; export function ToolCallBubble({ name, arguments: args, response, side, }: ToolCallBubbleProps) { const { t } = useTranslation(["views/chat"]); const [open, setOpen] = useState(false); const isLeft = side === "left"; const normalizedName = name .replace(/_/g, " ") .split(" ") .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()) .join(" "); return (
{isLeft && args && Object.keys(args).length > 0 && (
{t("arguments")}
                  {JSON.stringify(args, null, 2)}
                
)} {!isLeft && response && response !== "" && (
{t("response")}
                  {response}
                
)}
); }