import { cn } from '@/utils/cn'; import type { useChat } from '@ai-sdk/react'; import { useLocalStorage } from 'usehooks-ts'; import { Button } from '../ui/button'; import { ScrollArea } from '../ui/scroll-area'; type Props = Pick< ReturnType, 'handleSubmit' | 'handleInputChange' | 'input' | 'append' > & { projectId: string; isLimited: boolean; }; export function ChatForm({ handleSubmit: handleSubmitProp, input, handleInputChange, append, projectId, isLimited, }: Props) { const [quickActions, setQuickActions] = useLocalStorage( `chat-quick-actions:${projectId}`, [], ); const handleSubmit = (e: React.FormEvent) => { handleSubmitProp(e); setQuickActions([input, ...quickActions].slice(0, 5)); }; return (
{quickActions.map((q) => ( ))}
); }