"use client"; import { type Message } from "@prisma/client"; import { useChat, type Message as AIMessage } from "ai-connector"; import { ChatList } from "./chat-list"; import { Prompt } from "./prompt"; export interface ChatProps { // create?: (input: string) => Chat | undefined; initialMessages?: Message[]; id?: string; } export function Chat({ id, // create, initialMessages, }: ChatProps) { const { isLoading, messages, reload, append } = useChat({ id, initialMessages: initialMessages as AIMessage[], }); return (
append({ role: "user", content: v, }) } onRefresh={messages.length ? reload : undefined} isLoading={isLoading} />
); } Chat.displayName = "Chat";