chatbot-template/components/empty-screen.tsx

57 lines
1.8 KiB
TypeScript
Raw Normal View History

2023-06-16 22:43:24 +02:00
import { UseChatHelpers } from 'ai/react'
2023-06-14 16:05:03 +04:00
2023-06-07 16:17:59 +04:00
import { Button } from '@/components/ui/button'
import { ExternalLink } from '@/components/external-link'
2023-06-13 16:02:07 +04:00
import { IconArrowRight } from '@/components/ui/icons'
2023-06-07 16:17:59 +04:00
const exampleMessages = [
{
heading: 'Explain technical concepts',
message: `What is a "serverless function"?`
},
{
2023-06-07 08:48:46 -04:00
heading: 'Summarize an article',
2023-06-07 16:17:59 +04:00
message: 'Summarize the following article for a 2nd grader: \n'
},
{
heading: 'Draft an email',
message: `Draft an email to my boss about the following: \n`
}
]
export function EmptyScreen({ setInput }: Pick<UseChatHelpers, 'setInput'>) {
2023-06-07 16:17:59 +04:00
return (
<div className="mx-auto max-w-2xl px-4">
<div className="rounded-lg border bg-background p-8">
<h1 className="mb-2 text-lg font-semibold">
2023-06-16 18:44:10 -04:00
Welcome to Next.js AI Chatbot!
</h1>
<p className="mb-2 leading-normal text-muted-foreground">
2023-06-16 19:06:54 -04:00
This is an open source AI chatbot app template built with{' '}
<ExternalLink href="https://nextjs.org">Next.js</ExternalLink> and{' '}
<ExternalLink href="https://vercel.com/storage/kv">
Vercel KV
</ExternalLink>
.
</p>
<p className="leading-normal text-muted-foreground">
You can start a conversation here or try the following examples:
</p>
<div className="mt-4 flex flex-col items-start space-y-2">
{exampleMessages.map((message, index) => (
<Button
key={index}
variant="link"
className="h-auto p-0 text-base"
onClick={() => setInput(message.message)}
>
<IconArrowRight className="mr-2 text-muted-foreground" />
{message.heading}
</Button>
))}
</div>
2023-06-07 16:17:59 +04:00
</div>
</div>
)
}