1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75import { Button } from '@/components/ui/button';
import { ExternalLink } from '@/components/external-link';
import { IconArrowRight } from '@/components/ui/icons';
const exampleMessages = [
{
heading: 'What are the trending stocks?',
message: 'What are the trending stocks?',
},
{
heading: "What's the stock price of AAPL?",
message: "What's the stock price of AAPL?",
},
{
heading: "I'd like to buy 10 shares of MSFT",
message: "I'd like to buy 10 shares of MSFT",
},
];
export function EmptyScreen({
submitMessage,
}: {
submitMessage: (message: string) => void;
}) {
return (
<div className="mx-auto max-w-2xl px-4">
<div className="rounded-lg border bg-background p-8 mb-4">
<h1 className="mb-2 text-lg font-semibold">
Welcome to AI SDK 3.0 Generative UI demo!
</h1>
<p className="mb-2 leading-normal text-muted-foreground">
This is a demo of an interactive financial assistant. It can show you
stocks, tell you their prices, and even help you buy shares.
</p>
<p className="mb-2 leading-normal text-muted-foreground">
The demo is built with{' '}
<ExternalLink href="https://nextjs.org">Next.js</ExternalLink> and the{' '}
<ExternalLink href="https://sdk.vercel.ai/docs">
Vercel AI SDK
</ExternalLink>
.
</p>
<p className="mb-2 leading-normal text-muted-foreground">
It uses{' '}
<ExternalLink href="https://vercel.com/blog/ai-sdk-3-generative-ui">
React Server Components
</ExternalLink>{' '}
to combine text with UI generated as output of the LLM. The UI state
is synced through the SDK so the model is aware of your interactions
as they happen.
</p>
<p className="leading-normal text-muted-foreground">Try an example:</p>
<div className="mt-4 flex flex-col items-start space-y-2 mb-4">
{exampleMessages.map((message, index) => (
<Button
key={index}
variant="link"
className="h-auto p-0 text-base"
onClick={async () => {
submitMessage(message.message);
}}
>
<IconArrowRight className="mr-2 text-muted-foreground" />
{message.heading}
</Button>
))}
</div>
</div>
<p className="leading-normal text-muted-foreground text-[0.8rem] text-center">
Note: This is not real financial advice.
</p>
</div>
);
}