From 78d15c2a2f92d45c6706d8eae8744d9bedac1eaf Mon Sep 17 00:00:00 2001 From: heheer Date: Thu, 26 Sep 2024 16:33:38 +0800 Subject: [PATCH] fix: form input value type & default form & ui (#2802) * fix: form input value type & default form & ui * variables form ui --- .../components/core/chat/components/AIResponseBox.tsx | 5 +++-- .../Flow/nodes/NodeFormInput/InputFormEditModal.tsx | 11 ++++++++++- .../Flow/nodes/NodeFormInput/index.tsx | 3 +-- .../Flow/nodes/NodePluginIO/InputTypeConfig.tsx | 2 +- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/projects/app/src/components/core/chat/components/AIResponseBox.tsx b/projects/app/src/components/core/chat/components/AIResponseBox.tsx index 9f1dec9f6..776eefa4c 100644 --- a/projects/app/src/components/core/chat/components/AIResponseBox.tsx +++ b/projects/app/src/components/core/chat/components/AIResponseBox.tsx @@ -215,9 +215,9 @@ const RenderUserFormInteractive = React.memo(function RenderFormInput({ {interactive.params.inputForm?.map((input) => ( - + {input.label} - + {input.description && } {input.type === FlowNodeInputTypeEnum.input && ( item.value === inputType)?.defaultValueType; + const onSubmitSuccess = useCallback( (data: UserInputFormItemType, action: 'confirm' | 'continue') => { const isChangeKey = defaultValue.key !== data.key; @@ -90,6 +97,7 @@ const InputFormEditModal = ({ } data.key = data.label; + data.valueType = defaultValueType; if (action === 'confirm') { onSubmit(data); @@ -103,7 +111,7 @@ const InputFormEditModal = ({ reset(defaultFormInput); } }, - [toast, t, reset, onSubmit, onClose, defaultFormInput] + [toast, t, reset, onSubmit, onClose, defaultFormInput, defaultValueType] ); const onSubmitError = useCallback( @@ -192,6 +200,7 @@ const InputFormEditModal = ({ onClose={onClose} onSubmitSuccess={onSubmitSuccess} onSubmitError={onSubmitError} + valueType={defaultValueType} /> diff --git a/projects/app/src/pages/app/detail/components/WorkflowComponents/Flow/nodes/NodeFormInput/index.tsx b/projects/app/src/pages/app/detail/components/WorkflowComponents/Flow/nodes/NodeFormInput/index.tsx index 9f61f9f8e..5a393fd10 100644 --- a/projects/app/src/pages/app/detail/components/WorkflowComponents/Flow/nodes/NodeFormInput/index.tsx +++ b/projects/app/src/pages/app/detail/components/WorkflowComponents/Flow/nodes/NodeFormInput/index.tsx @@ -145,7 +145,7 @@ const NodeFormInput = ({ data, selected }: NodeProps) => { )} - + @@ -187,7 +187,6 @@ const NodeFormInput = ({ data, selected }: NodeProps) => { w={'16px'} color={'myGray.600'} cursor={'pointer'} - ml={2} _hover={{ color: 'red.500' }} onClick={() => { onDelete(item.key); diff --git a/projects/app/src/pages/app/detail/components/WorkflowComponents/Flow/nodes/NodePluginIO/InputTypeConfig.tsx b/projects/app/src/pages/app/detail/components/WorkflowComponents/Flow/nodes/NodePluginIO/InputTypeConfig.tsx index 9749490e9..0a18e5148 100644 --- a/projects/app/src/pages/app/detail/components/WorkflowComponents/Flow/nodes/NodePluginIO/InputTypeConfig.tsx +++ b/projects/app/src/pages/app/detail/components/WorkflowComponents/Flow/nodes/NodePluginIO/InputTypeConfig.tsx @@ -149,7 +149,7 @@ const InputTypeConfig = ({ {/* value type */} - {valueType && ( + {type === 'plugin' && ( {t('common:core.module.Data Type')}