chatbot-template/app/(chat)/page.tsx

23 lines
598 B
TypeScript
Raw Normal View History

2023-06-15 11:31:03 +04:00
import { nanoid } from '@/lib/utils'
import { Chat } from '@/components/chat'
2024-03-14 20:00:52 +03:00
import { AI } from '@/lib/chat/actions'
import { auth } from '@/auth'
import { Session } from '@/lib/types'
import { getMissingKeys } from '@/app/actions'
2023-05-19 12:33:56 -04:00
2024-03-14 20:00:52 +03:00
export const metadata = {
title: 'Next.js AI Chatbot'
}
export default async function IndexPage() {
2023-06-15 11:31:03 +04:00
const id = nanoid()
2024-03-14 20:00:52 +03:00
const session = (await auth()) as Session
const missingKeys = await getMissingKeys()
2023-06-15 11:31:03 +04:00
2024-03-14 20:00:52 +03:00
return (
<AI initialAIState={{ chatId: id, messages: [] }}>
<Chat id={id} session={session} missingKeys={missingKeys} />
</AI>
)
2023-05-19 12:33:56 -04:00
}