({ line }: { line: TranscriptLine })
| 589 | } |
| 590 | |
| 591 | function TranscriptLine({ line }: { line: TranscriptLine }) { |
| 592 | const color = { |
| 593 | assistant: "white", |
| 594 | error: "red", |
| 595 | meta: "cyan", |
| 596 | status: "yellow", |
| 597 | tool: "magenta", |
| 598 | user: "green", |
| 599 | }[line.kind] |
| 600 | |
| 601 | return ( |
| 602 | <box> |
| 603 | <text fg={color} attributes={TextAttributes.BOLD}> |
| 604 | {line.label.padEnd(7)} |
| 605 | </text> |
| 606 | <text> |
| 607 | {line.parts.map((part, index) => ( |
| 608 | <span |
| 609 | key={index} |
| 610 | attributes={partToAttributes(part)} |
| 611 | fg={part.color} |
| 612 | > |
| 613 | {part.text} |
| 614 | </span> |
| 615 | ))} |
| 616 | </text> |
| 617 | </box> |
| 618 | ) |
| 619 | } |
| 620 | |
| 621 | function partToAttributes(part: TranscriptPart) { |
| 622 | let attributes = TextAttributes.NONE |
nothing calls this directly
no test coverage detected