import type { AgentIconSelection } from './agent-form' import { Field, FieldControl, FieldError, FieldLabel } from '@langgenius/dify-ui/field' import { Textarea } from '@langgenius/dify-ui/textarea' import { useTranslation } from 'react-i18next' import AppIcon from '@/app/components/base/app-icon' type AgentFormFieldsProps = { description: string icon: AgentIconSelection iconAriaLabel: string name: string onDescriptionChange: (description: string) => void onIconClick: () => void onNameChange: (name: string) => void onRoleChange: (role: string) => void role: string } export function AgentFormFields({ description, icon, iconAriaLabel, name, onDescriptionChange, onIconClick, onNameChange, onRoleChange, role, }: AgentFormFieldsProps) { const { t } = useTranslation('agentV2') const { t: tCommon } = useTranslation('common') return (
{ if (typeof value === 'string' && value.length > 0 && !value.trim()) return t(($) => $['roster.createForm.nameRequired']) return null }} > {t(($) => $['roster.createForm.nameLabel'])} $['roster.createForm.namePlaceholder'])} required value={name} />
{t(($) => $['roster.createForm.nameRequired'])}
{t(($) => $['roster.createForm.roleLabel'])} {tCommon(($) => $['label.optional'])} $['roster.createForm.rolePlaceholder'])} value={role} />
{t(($) => $['roster.createForm.descriptionLabel'])} {tCommon(($) => $['label.optional'])}