import { useState } from "react"; import { useTranslation } from "react-i18next"; import ReactMarkdown from "react-markdown"; import { Button } from "@/components/ui/button"; import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from "@/components/ui/collapsible"; export type ToolCall = { name: string; arguments?: Record; response?: string; }; type AssistantMessageProps = { content: string; toolCalls?: ToolCall[]; }; export function AssistantMessage({ content, toolCalls, }: AssistantMessageProps) { const { t } = useTranslation(["views/chat"]); const [open, setOpen] = useState(false); const hasToolCalls = toolCalls && toolCalls.length > 0; return (
{content} {hasToolCalls && (
    {toolCalls.map((tc, idx) => (
  • {tc.name} {tc.response != null && tc.response !== "" && (
                          {tc.response}
                        
    )}
  • ))}
)}
); }