import { useState } from "react"; import { IconChevronRight, IconChevronDown } from "@tabler/icons-react"; import type { AiChatToolCall } from "../types/ai-chat.types"; import classes from "../styles/chat-message.module.css"; export const TOOL_LABELS: Record = { list_spaces: "Listed spaces", search_pages: "Searched pages", get_page: "Read page", create_page: "Created page", update_page: "Updated page", }; type Props = { toolCall: AiChatToolCall; }; export default function ChatToolResult({ toolCall }: Props) { const [expanded, setExpanded] = useState(false); const label = TOOL_LABELS[toolCall.name] || toolCall.name; return (
setExpanded((prev) => !prev)} > ยท {expanded ? ( ) : ( )} {label}
{expanded && (
            {JSON.stringify(
              { args: toolCall.args, result: toolCall.result },
              null,
              2,
            )}
          
)}
); }