import * as React from 'react'; import { type UseChatHelpers } from 'ai/react'; import { Button } from '@/components/ui/Buttons'; import { PromptForm } from '@/components/chat/PromptForm'; import { ButtonScrollToBottom } from '@/components/chat/ButtonScrollToBottom'; import { IconRefresh, IconShare, IconStop } from '@/components/ui/Icon'; import { MessageWithSelectedDataset } from '../../lib/types'; export interface ChatPanelProps extends Pick< UseChatHelpers, 'append' | 'isLoading' | 'reload' | 'stop' | 'input' | 'setInput' > { id?: string; title?: string; messages: MessageWithSelectedDataset[]; } export function ChatPanel({ id, title, isLoading, stop, append, reload, input, setInput, messages, }: ChatPanelProps) { const [shareDialogOpen, setShareDialogOpen] = React.useState(false); return (
{isLoading ? ( ) : ( messages?.length >= 2 && (
) )}
{ await append({ id, content: value, role: 'user', }); }} input={input} setInput={setInput} isLoading={isLoading} />
); }