import { FormContainer } from '@/components/form-container'; import { PromptEditor } from '@/components/prompt-editor'; import { BlockButton, Button } from '@/components/ui/button'; import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage, } from '@/components/ui/form'; import { X } from 'lucide-react'; import { useFieldArray } from 'react-hook-form'; import { useTranslation } from 'react-i18next'; import { INextOperatorForm } from '../../interface'; const MessageForm = ({ form }: INextOperatorForm) => { const { t } = useTranslation(); const { fields, append, remove } = useFieldArray({ name: 'content', control: form.control, }); return (
{ e.preventDefault(); }} > {t('flow.msg')}
{fields.map((field, index) => (
( )} /> {fields.length > 1 && ( )}
))} append({ value: '' })} // "" will cause the inability to add, refer to: https://github.com/orgs/react-hook-form/discussions/8485#discussioncomment-2961861 > {t('flow.addMessage')}
); }; export default MessageForm;