| 43 | } |
| 44 | |
| 45 | function ToolCard({ |
| 46 | tool, |
| 47 | visible, |
| 48 | dim, |
| 49 | }: { |
| 50 | tool: (typeof toolCalls)[number]; |
| 51 | visible: boolean; |
| 52 | dim: boolean; |
| 53 | }) { |
| 54 | return ( |
| 55 | <div |
| 56 | className="overflow-hidden transition-all duration-500 ease-out" |
| 57 | style={{ |
| 58 | maxHeight: visible ? '120px' : '0px', |
| 59 | opacity: visible ? (dim ? 0.5 : 1) : 0, |
| 60 | transform: visible ? 'translateY(0)' : 'translateY(6px)', |
| 61 | }} |
| 62 | > |
| 63 | <div className="rounded-xl border border-[#d97757]/25 bg-[#d97757]/8 px-3 py-2.5"> |
| 64 | <div className="mb-2 flex items-center gap-1.5"> |
| 65 | <span className="inline-block size-1.5 rounded-full bg-[#d97757] animate-pulse" /> |
| 66 | <span className="font-mono font-semibold text-[#d97757] text-[9px]"> |
| 67 | {tool.name} |
| 68 | </span> |
| 69 | </div> |
| 70 | <div className="col gap-0.5 font-mono text-[8.5px] text-white/35"> |
| 71 | {tool.params.map((p) => ( |
| 72 | <div key={p.key}> |
| 73 | <span className="text-white/25">{p.key}: </span> |
| 74 | <span className="text-white/50">{p.value}</span> |
| 75 | </div> |
| 76 | ))} |
| 77 | </div> |
| 78 | <div className="mt-2 border-white/8 border-t pt-2 font-mono text-[8.5px]"> |
| 79 | <span className="text-white/30">↳ </span> |
| 80 | <span className="text-emerald-400/80">{tool.result}</span> |
| 81 | </div> |
| 82 | </div> |
| 83 | </div> |
| 84 | ); |
| 85 | } |
| 86 | |
| 87 | function StreamingText({ text, done }: { text: string; done: boolean }) { |
| 88 | // Split the full response into plain/highlighted segments for rendering |