| children?: React.JSX.Element | string | null | children?: React.JSX.Element | string | null | ||||
| operations?: React.JSX.Element | operations?: React.JSX.Element | ||||
| inline?: boolean | inline?: boolean | ||||
| required?: boolean | |||||
| } | } | ||||
| const Field: FC<Props> = ({ | const Field: FC<Props> = ({ | ||||
| operations, | operations, | ||||
| inline, | inline, | ||||
| supportFold, | supportFold, | ||||
| required, | |||||
| }) => { | }) => { | ||||
| const [fold, { | const [fold, { | ||||
| toggle: toggleFold, | toggle: toggleFold, | ||||
| onClick={() => supportFold && toggleFold()} | onClick={() => supportFold && toggleFold()} | ||||
| className={cn('flex items-center justify-between', supportFold && 'cursor-pointer')}> | className={cn('flex items-center justify-between', supportFold && 'cursor-pointer')}> | ||||
| <div className='flex h-6 items-center'> | <div className='flex h-6 items-center'> | ||||
| <div className={cn(isSubTitle ? 'system-xs-medium-uppercase text-text-tertiary' : 'system-sm-semibold-uppercase text-text-secondary')}>{title}</div> | |||||
| <div className={cn(isSubTitle ? 'system-xs-medium-uppercase text-text-tertiary' : 'system-sm-semibold-uppercase text-text-secondary')}> | |||||
| {title} {required && <span className='text-text-destructive'>*</span>} | |||||
| </div> | |||||
| {tooltip && ( | {tooltip && ( | ||||
| <Tooltip | <Tooltip | ||||
| popupContent={tooltip} | popupContent={tooltip} |
| const resetEditor = useStore(s => s.setControlPromptEditorRerenderKey) | const resetEditor = useStore(s => s.setControlPromptEditorRerenderKey) | ||||
| return <div className='my-2'> | return <div className='my-2'> | ||||
| <Field title={t('workflow.nodes.agent.strategy.label')} className='px-4 py-2' tooltip={t('workflow.nodes.agent.strategy.tooltip')} > | |||||
| <Field | |||||
| required | |||||
| title={t('workflow.nodes.agent.strategy.label')} | |||||
| className='px-4 py-2' | |||||
| tooltip={t('workflow.nodes.agent.strategy.tooltip')} > | |||||
| <AgentStrategy | <AgentStrategy | ||||
| strategy={inputs.agent_strategy_name ? { | strategy={inputs.agent_strategy_name ? { | ||||
| agent_strategy_provider_name: inputs.agent_strategy_provider_name!, | agent_strategy_provider_name: inputs.agent_strategy_provider_name!, |
| operations={ | operations={ | ||||
| <AddButton onClick={handleAddOutputVariable} /> | <AddButton onClick={handleAddOutputVariable} /> | ||||
| } | } | ||||
| required | |||||
| > | > | ||||
| <OutputVarList | <OutputVarList | ||||
| readonly={readOnly} | readonly={readOnly} | ||||
| outputs={inputs.outputs} | outputs={inputs.outputs} |
| <div className='space-y-4 px-4 pb-4'> | <div className='space-y-4 px-4 pb-4'> | ||||
| <Field | <Field | ||||
| title={t(`${i18nPrefix}.inputVar`)} | title={t(`${i18nPrefix}.inputVar`)} | ||||
| required | |||||
| > | > | ||||
| <> | <> | ||||
| <VarReferencePicker | <VarReferencePicker |
| <div className='space-y-4 px-4 pb-4'> | <div className='space-y-4 px-4 pb-4'> | ||||
| <Field | <Field | ||||
| title={t(`${i18nPrefix}.api`)} | title={t(`${i18nPrefix}.api`)} | ||||
| required | |||||
| operations={ | operations={ | ||||
| <div className='flex'> | <div className='flex'> | ||||
| <div | <div | ||||
| </Field> | </Field> | ||||
| <Field | <Field | ||||
| title={t(`${i18nPrefix}.body`)} | title={t(`${i18nPrefix}.body`)} | ||||
| required | |||||
| > | > | ||||
| <EditBody | <EditBody | ||||
| nodeId={id} | nodeId={id} |
| <div className='space-y-4 px-4 pb-4'> | <div className='space-y-4 px-4 pb-4'> | ||||
| <Field | <Field | ||||
| title={t(`${i18nPrefix}.input`)} | title={t(`${i18nPrefix}.input`)} | ||||
| required | |||||
| operations={( | operations={( | ||||
| <div className='system-2xs-medium-uppercase flex h-[18px] items-center rounded-[5px] border border-divider-deep px-1 capitalize text-text-tertiary'>Array</div> | <div className='system-2xs-medium-uppercase flex h-[18px] items-center rounded-[5px] border border-divider-deep px-1 capitalize text-text-tertiary'>Array</div> | ||||
| )} | )} | ||||
| <div className='mt-2 space-y-4 px-4 pb-4'> | <div className='mt-2 space-y-4 px-4 pb-4'> | ||||
| <Field | <Field | ||||
| title={t(`${i18nPrefix}.output`)} | title={t(`${i18nPrefix}.output`)} | ||||
| required | |||||
| operations={( | operations={( | ||||
| <div className='system-2xs-medium-uppercase flex h-[18px] items-center rounded-[5px] border border-divider-deep px-1 capitalize text-text-tertiary'>Array</div> | <div className='system-2xs-medium-uppercase flex h-[18px] items-center rounded-[5px] border border-divider-deep px-1 capitalize text-text-tertiary'>Array</div> | ||||
| )} | )} |
| {/* {JSON.stringify(inputs, null, 2)} */} | {/* {JSON.stringify(inputs, null, 2)} */} | ||||
| <Field | <Field | ||||
| title={t(`${i18nPrefix}.queryVariable`)} | title={t(`${i18nPrefix}.queryVariable`)} | ||||
| required | |||||
| > | > | ||||
| <VarReferencePicker | <VarReferencePicker | ||||
| nodeId={id} | nodeId={id} | ||||
| <Field | <Field | ||||
| title={t(`${i18nPrefix}.knowledge`)} | title={t(`${i18nPrefix}.knowledge`)} | ||||
| required | |||||
| operations={ | operations={ | ||||
| <div className='flex items-center space-x-1'> | <div className='flex items-center space-x-1'> | ||||
| <RetrievalConfig | <RetrievalConfig |
| <div className='space-y-4 px-4'> | <div className='space-y-4 px-4'> | ||||
| <Field | <Field | ||||
| title={t(`${i18nPrefix}.inputVar`)} | title={t(`${i18nPrefix}.inputVar`)} | ||||
| required | |||||
| > | > | ||||
| <VarReferencePicker | <VarReferencePicker | ||||
| readonly={readOnly} | readonly={readOnly} |
| <div className='space-y-4 px-4 pb-4'> | <div className='space-y-4 px-4 pb-4'> | ||||
| <Field | <Field | ||||
| title={t(`${i18nPrefix}.model`)} | title={t(`${i18nPrefix}.model`)} | ||||
| required | |||||
| > | > | ||||
| <ModelParameterModal | <ModelParameterModal | ||||
| popupClassName='!w-[387px]' | popupClassName='!w-[387px]' |
| <div className='space-y-4 px-4'> | <div className='space-y-4 px-4'> | ||||
| <Field | <Field | ||||
| title={t(`${i18nCommonPrefix}.model`)} | title={t(`${i18nCommonPrefix}.model`)} | ||||
| required | |||||
| > | > | ||||
| <ModelParameterModal | <ModelParameterModal | ||||
| popupClassName='!w-[387px]' | popupClassName='!w-[387px]' | ||||
| </Field> | </Field> | ||||
| <Field | <Field | ||||
| title={t(`${i18nPrefix}.inputVar`)} | title={t(`${i18nPrefix}.inputVar`)} | ||||
| required | |||||
| > | > | ||||
| <> | <> | ||||
| <VarReferencePicker | <VarReferencePicker | ||||
| /> | /> | ||||
| <Field | <Field | ||||
| title={t(`${i18nPrefix}.extractParameters`)} | title={t(`${i18nPrefix}.extractParameters`)} | ||||
| required | |||||
| operations={ | operations={ | ||||
| !readOnly | !readOnly | ||||
| ? ( | ? ( |
| <div className='space-y-4 px-4'> | <div className='space-y-4 px-4'> | ||||
| <Field | <Field | ||||
| title={t(`${i18nPrefix}.model`)} | title={t(`${i18nPrefix}.model`)} | ||||
| required | |||||
| > | > | ||||
| <ModelParameterModal | <ModelParameterModal | ||||
| popupClassName='!w-[387px]' | popupClassName='!w-[387px]' | ||||
| </Field> | </Field> | ||||
| <Field | <Field | ||||
| title={t(`${i18nPrefix}.inputVars`)} | title={t(`${i18nPrefix}.inputVars`)} | ||||
| required | |||||
| > | > | ||||
| <VarReferencePicker | <VarReferencePicker | ||||
| readonly={readOnly} | readonly={readOnly} | ||||
| /> | /> | ||||
| <Field | <Field | ||||
| title={t(`${i18nPrefix}.class`)} | title={t(`${i18nPrefix}.class`)} | ||||
| required | |||||
| > | > | ||||
| <ClassList | <ClassList | ||||
| nodeId={id} | nodeId={id} |