import { BabyIcon, BookOpenTextIcon, BrainIcon, ChevronDownIcon, NotebookPenIcon, type LucideIcon, } from 'lucide-react'; import { cn } from '../../lib/classname'; import { PredefinedActionGroup } from './PredefinedActionGroup'; export type PredefinedActionType = { icon: LucideIcon; label: string; prompt?: string; children?: PredefinedActionType[]; }; export const actions: PredefinedActionType[] = [ { icon: BookOpenTextIcon, label: 'Explain', children: [ { icon: NotebookPenIcon, label: 'Explain Topic', prompt: 'Explain this topic in detail and include examples', }, { icon: BabyIcon, label: 'Explain like I am five', prompt: 'Explain this topic like I am a 5 years old', }, ], }, { icon: BrainIcon, label: 'Test my Knowledge', prompt: "Act as an interviewer and test my understanding of this topic. Ask me a single question at a time and evaluate my answer. Question number should be bold. After evaluating my answer, immediately proceed to the next question without asking if I'm ready or want another question. Continue asking questions until I explicitly tell you to stop.", }, ]; export const promptLabelMapping = actions.reduce( (acc, action) => { if (action.prompt) { acc[action.prompt] = action.label; } return acc; }, {} as Record, ); type PredefinedActionsProps = { onSelect: (action: PredefinedActionType) => void; }; export function PredefinedActions(props: PredefinedActionsProps) { const { onSelect } = props; return (
{actions.map((action) => { if (!action.children) { return ( { onSelect(action); }} /> ); } return ( ); })}
); } type PredefinedActionButtonProps = { label: string; icon?: LucideIcon; onClick: () => void; isGroup?: boolean; className?: string; }; export function PredefinedActionButton(props: PredefinedActionButtonProps) { const { label, icon: Icon, onClick, isGroup = false, className } = props; return ( ); }