import type { Message } from 'ai'; import React, { type RefCallback } from 'react'; import { ClientOnly } from 'remix-utils/client-only'; import { Menu } from '~/components/sidebar/Menu.client'; import { IconButton } from '~/components/ui/IconButton'; import { Workbench } from '~/components/workbench/Workbench.client'; import { classNames } from '~/utils/classNames'; import { Messages } from './Messages.client'; import { SendButton } from './SendButton.client'; import styles from './BaseChat.module.scss'; interface BaseChatProps { textareaRef?: React.RefObject | undefined; messageRef?: RefCallback | undefined; scrollRef?: RefCallback | undefined; showChat?: boolean; chatStarted?: boolean; isStreaming?: boolean; messages?: Message[]; enhancingPrompt?: boolean; promptEnhanced?: boolean; input?: string; handleStop?: () => void; sendMessage?: (event: React.UIEvent, messageInput?: string) => void; handleInputChange?: (event: React.ChangeEvent) => void; enhancePrompt?: () => void; } const EXAMPLE_PROMPTS = [ { text: 'Build a todo app in React using Tailwind' }, { text: 'Build a simple blog using Astro' }, { text: 'Create a cookie consent form using Material UI' }, { text: 'Make a space invaders game' }, { text: 'How do I center a div?' }, ]; const TEXTAREA_MIN_HEIGHT = 76; export const BaseChat = React.forwardRef( ( { textareaRef, messageRef, scrollRef, showChat = true, 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.

)}
{() => { return chatStarted ? ( ) : null; }}