import { useState } from 'react'; import { ChevronDown } from 'lucide-react'; import type { ToolCallView } from '@/lib/types'; import { CodeBlock } from '@/components/chat/code-block'; import { ArtifactChips } from './artifact-chips'; import { cn } from '@/lib/cn'; export function PythonExecCard({ call, conversationId }: { call: ToolCallView; conversationId: string }) { const p = call.payload as { code?: string; description?: string; stdout?: string; stderr?: string; exit_code?: number; artifacts?: ToolCallView['artifacts'] }; const [showCode, setShowCode] = useState(false); const images = (p.artifacts || call.artifacts || []).filter((a) => a.type === 'image'); const others = (p.artifacts || call.artifacts || []).filter((a) => a.type !== 'image'); return (
{p.description &&

{p.description}

} {showCode && p.code && } {(p.stdout || p.stderr) && (
{p.stdout &&
{p.stdout}
} {p.stderr &&
{p.stderr}
}
)} {images.map((a) => (
{a.filename
))}
); }