()
| 759 | |
| 760 | // Not a generative UI result — render a data view |
| 761 | const DataView = () => { |
| 762 | const text = result.content?.find((c) => c.type === "text")?.text; |
| 763 | const isError = (result as { isError?: boolean }).isError; |
| 764 | const data = structured as Record<string, unknown> | undefined; |
| 765 | |
| 766 | return ( |
| 767 | <Components.Card> |
| 768 | <Components.CardContent className="pt-4"> |
| 769 | {isError ? ( |
| 770 | <Components.Alert variant="destructive"> |
| 771 | <Components.AlertCircle className="h-4 w-4" /> |
| 772 | <Components.AlertTitle>Error</Components.AlertTitle> |
| 773 | <Components.AlertDescription className="font-mono text-xs whitespace-pre-wrap"> |
| 774 | {text ?? "Unknown error"} |
| 775 | </Components.AlertDescription> |
| 776 | </Components.Alert> |
| 777 | ) : ( |
| 778 | <pre className="text-xs font-mono whitespace-pre-wrap overflow-auto max-h-[80vh]"> |
| 779 | {data ? JSON.stringify(data, null, 2) : (text ?? "(no result)")} |
| 780 | </pre> |
| 781 | )} |
| 782 | </Components.CardContent> |
| 783 | </Components.Card> |
| 784 | ); |
| 785 | }; |
| 786 | setComponent(() => DataView); |
| 787 | rendererRef.current = null; |
| 788 | openLinkAuthorizationRef.current = null; |
nothing calls this directly
no outgoing calls
no test coverage detected