import type { Message } from 'ai'; import React, { type LegacyRef, type RefCallback } from 'react'; import { ClientOnly } from 'remix-utils/client-only'; import { classNames } from '../../utils/classNames'; import { IconButton } from '../ui/IconButton'; import { Workbench } from '../workbench/Workbench.client'; import { Messages } from './Messages.client'; import { SendButton } from './SendButton.client'; interface BaseChatProps { textareaRef?: LegacyRef | undefined; messageRef?: RefCallback | undefined; scrollRef?: RefCallback | undefined; chatStarted?: boolean; isStreaming?: boolean; messages?: Message[]; enhancingPrompt?: boolean; promptEnhanced?: boolean; input?: string; handleStop?: () => void; sendMessage?: () => void; handleInputChange?: (event: React.ChangeEvent) => void; enhancePrompt?: () => void; } const EXAMPLES = [{ text: 'Example' }, { text: 'Example' }, { text: 'Example' }, { text: 'Example' }]; const TEXTAREA_MIN_HEIGHT = 72; export const BaseChat = React.forwardRef( ( { textareaRef, messageRef, scrollRef, chatStarted = false, isStreaming = false, enhancingPrompt = false, promptEnhanced = false, messages, input = '', sendMessage, handleInputChange, enhancePrompt, handleStop, }, ref, ) => { const TEXTAREA_MAX_HEIGHT = chatStarted ? 400 : 200; return (
{!chatStarted && (

Where ideas begin.

Bring ideas to life in seconds or get help on existing projects.

{EXAMPLES.map((suggestion, index) => ( ))}
)}
{() => { return chatStarted ? ( ) : null; }}