import { useState } from 'react'; import { BookOpen, Calculator, ChevronDown, FileSearch, FileSpreadsheet, Globe, ListChecks, Loader2, TerminalSquare, AlertTriangle, Check } from 'lucide-react'; import type { ToolCallView } from '@/lib/types'; import { fmtDuration } from '@/lib/format'; import { cn } from '@/lib/cn'; import { ToolCard } from '@/components/tools/tool-card'; const META: Record = { search_course_content: { label: 'Recherche dans le matériel du cours', icon: BookOpen }, execute_python: { label: 'Exécution du calcul Python', icon: TerminalSquare }, create_excel: { label: 'Création du fichier Excel', icon: FileSpreadsheet }, web_search: { label: 'Recherche sur le web', icon: Globe }, analyze_file: { label: 'Analyse du fichier déposé', icon: FileSearch }, generate_quiz: { label: 'Préparation du quiz', icon: ListChecks }, financial_calc: { label: 'Calcul financier', icon: Calculator }, }; export function ToolCallTimeline({ calls, conversationId }: { calls: ToolCallView[]; conversationId: string }) { const [open, setOpen] = useState>({}); if (!calls.length) return null; return (
    {calls.map((c) => { const meta = META[c.name] || { label: c.name, icon: Calculator }; const Icon = meta.icon; const running = c.status === 'running'; const expanded = open[c.id] ?? (c.name !== 'financial_calc' && c.name !== 'search_course_content'); return (
  1. {expanded && !running && (
    )}
  2. ); })}
); }