'use client'; import { Button } from '@/components/ui/button'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from '@/components/ui/select'; import { Textarea } from '@/components/ui/textarea'; import { cn } from '@/lib/utils'; import type { ChatStatus } from 'ai'; import { Loader2Icon, SendIcon, SquareIcon, XIcon } from 'lucide-react'; import type { ComponentProps, HTMLAttributes, KeyboardEventHandler, } from 'react'; import { Children } from 'react'; export type PromptInputProps = HTMLAttributes; export const PromptInput = ({ className, ...props }: PromptInputProps) => (
); export type PromptInputTextareaProps = ComponentProps; export const PromptInputTextarea = ({ onChange, className, placeholder = 'What would you like to know?', ...props }: PromptInputTextareaProps) => { const handleKeyDown: KeyboardEventHandler = (e) => { if (e.key === 'Enter') { // Don't submit if IME composition is in progress if (e.nativeEvent.isComposing) { return; } if (e.shiftKey) { // Allow newline return; } // Submit on Enter (without Shift) e.preventDefault(); const form = e.currentTarget.form; if (form) { form.requestSubmit(); } } }; return (