import React from 'react'; import { Plus, Minus } from 'lucide-react'; import TextareaAutosize from 'react-textarea-autosize'; import type { TExample } from 'librechat-data-provider'; import type { TSetExample } from '~/common'; import { Button, Label } from '~/components/ui'; import { cn, defaultTextProps } from '~/utils/'; import { useLocalize } from '~/hooks'; type TExamplesProps = { readonly?: boolean; className?: string; examples: TExample[]; setExample: TSetExample; addExample: () => void; removeExample: () => void; }; function Examples({ readonly, examples, setExample, addExample, removeExample }: TExamplesProps) { const localize = useLocalize(); return ( <>
{examples.map((example, idx) => ( {/* Input */}
setExample(idx, 'input', e.target.value ?? null)} placeholder="Set example input. Example is ignored if empty." className={cn( defaultTextProps, 'flex max-h-[300px] min-h-[75px] w-full resize-none px-3 py-2 ', )} />
{/* Output */}
setExample(idx, 'output', e.target.value ?? null)} placeholder={'Set example output. Example is ignored if empty.'} className={cn( defaultTextProps, 'flex max-h-[300px] min-h-[75px] w-full resize-none px-3 py-2 ', )} />
))}
); } export default Examples;