feat: reorganize files and implement ui and sidebar

This commit is contained in:
shadcn 2023-06-11 00:23:23 +04:00
parent 2e80864b84
commit 01dc4520d6
36 changed files with 1347 additions and 462 deletions

33
components/chat.tsx Normal file
View file

@ -0,0 +1,33 @@
'use client'
import { useChat, type Message } from 'ai-connector'
import { ChatList } from '@/components/chat-list'
import { ChatPanel } from '@/components/chat-panel'
export interface ChatProps {
// create?: (input: string) => Chat | undefined;
initialMessages?: Message[]
id?: string
}
export function Chat({ id, initialMessages }: ChatProps) {
const { messages, append, reload, isLoading } = useChat({
initialMessages,
id
})
return (
<div className="h-full overflow-hidden">
<div className="h-full w-full overflow-auto pb-[200px]">
<ChatList messages={messages} />
<ChatPanel
id={id}
append={append}
isLoading={isLoading}
reload={reload}
messages={messages}
/>
</div>
</div>
)
}