'use client' import { useRouter } from 'next/navigation' import { Prompt } from './prompt' import { useChat, type Message } from 'ai-connector' import { ChatList } from './chat-list' import { ExternalLink } from '@/app/external-link' export interface ChatProps { // create?: (input: string) => Chat | undefined; initialMessages?: Message[] id?: string } export function Chat({ id, // create, initialMessages }: ChatProps) { const router = useRouter() const { isLoading, messages, reload, append } = useChat({ initialMessages: initialMessages as any[], id // onCreate: (id: string) => { // router.push(`/chat/${id}`); // }, }) return (
{ append({ content: value, role: 'user' }) }} onRefresh={messages.length ? reload : undefined} isLoading={isLoading} />

This is an open source AI chatbot app built with{' '} Next.js and{' '} Vercel KV .

) }