From d65523aa0b34ff2edbf01aed3f01614f1c188592 Mon Sep 17 00:00:00 2001 From: JzoNg Date: Thu, 22 Jan 2026 14:03:15 +0800 Subject: [PATCH 1/4] save draft when delivery method changed --- .../nodes/human-input/components/delivery-method/index.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/index.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/index.tsx index c9b911896c..62a0ba0d8b 100644 --- a/web/app/components/workflow/nodes/human-input/components/delivery-method/index.tsx +++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/index.tsx @@ -7,6 +7,7 @@ import { produce } from 'immer' import * as React from 'react' import { useTranslation } from 'react-i18next' import Tooltip from '@/app/components/base/tooltip' +import { useNodesSyncDraft } from '@/app/components/workflow/hooks' import MethodItem from './method-item' import MethodSelector from './method-selector' import UpgradeModal from './upgrade-modal' @@ -35,6 +36,7 @@ const DeliveryMethodForm: React.FC = ({ readonly, }) => { const { t } = useTranslation() + const { handleSyncWorkflowDraft } = useNodesSyncDraft() const handleMethodChange = (target: DeliveryMethod) => { const newMethods = produce(value, (draft) => { @@ -43,6 +45,7 @@ const DeliveryMethodForm: React.FC = ({ draft[index] = target }) onChange(newMethods) + handleSyncWorkflowDraft(true, true) } const handleMethodAdd = (newMethod: DeliveryMethod) => { From b242578b86c953181591bf8306966c2d6fbdc4fa Mon Sep 17 00:00:00 2001 From: JzoNg Date: Thu, 22 Jan 2026 14:24:17 +0800 Subject: [PATCH 2/4] enhancement: add email address when input blur --- .../delivery-method/recipient/email-input.tsx | 39 ++++++++++++------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/email-input.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/email-input.tsx index 8881bcf414..ab1c7a6189 100644 --- a/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/email-input.tsx +++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/email-input.tsx @@ -81,23 +81,32 @@ const EmailInput = ({ return emailRegex.test(email) } + const handleEmailAdd = () => { + const emailAddress = searchKey.trim() + if (!checkEmailValid(emailAddress)) + return + if (value.some(item => item.email === emailAddress)) + return + if (list.some(item => item.email === emailAddress)) { + const item = list.find(item => item.email === emailAddress)! + onSelect(item.id) + } + else { + onAdd(emailAddress) + } + setSearchKey('') + setOpen(false) + } + + const handleInputBlur = () => { + setIsFocus(false) + handleEmailAdd() + } + const handleKeyDown = (e: React.KeyboardEvent) => { if (e.key === 'Enter' || e.key === 'Tab' || e.key === ' ' || e.key === ',') { e.preventDefault() - const emailAddress = searchKey.trim() - if (!checkEmailValid(emailAddress)) - return - if (value.some(item => item.email === emailAddress)) - return - if (list.some(item => item.email === emailAddress)) { - const item = list.find(item => item.email === emailAddress)! - onSelect(item.id) - } - else { - onAdd(emailAddress) - } - setSearchKey('') - setOpen(false) + handleEmailAdd() } else if (e.key === 'Backspace') { if (searchKey === '' && value.length > 0) { @@ -144,7 +153,7 @@ const EmailInput = ({ className="system-sm-regular h-6 min-w-[166px] appearance-none bg-transparent p-1 text-components-input-text-filled caret-primary-600 outline-none placeholder:text-components-input-text-placeholder" placeholder={placeholder} onFocus={() => setIsFocus(true)} - onBlur={() => setIsFocus(false)} + onBlur={handleInputBlur} value={searchKey} onChange={handleValueChange} onKeyDown={handleKeyDown} From 45c2167e0f4963838bf064bed826f9b23dec5815 Mon Sep 17 00:00:00 2001 From: JzoNg Date: Thu, 22 Jan 2026 14:49:38 +0800 Subject: [PATCH 3/4] fix: default value of input field in form content editor --- .../plugins/hitl-input-block/component-ui.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/web/app/components/base/prompt-editor/plugins/hitl-input-block/component-ui.tsx b/web/app/components/base/prompt-editor/plugins/hitl-input-block/component-ui.tsx index c55261f809..36dd2959e3 100644 --- a/web/app/components/base/prompt-editor/plugins/hitl-input-block/component-ui.tsx +++ b/web/app/components/base/prompt-editor/plugins/hitl-input-block/component-ui.tsx @@ -71,17 +71,19 @@ const HITLInputComponentUI: FC = ({ if (editBtn) editBtn.removeEventListener('click', showEditModal) } + // eslint-disable-next-line react-hooks/exhaustive-deps }, []) const removeBtnRef = useRef(null) useEffect(() => { const removeBtn = removeBtnRef.current + const removeHandler = () => onRemove(varName) if (removeBtn) - removeBtn.addEventListener('click', () => onRemove(varName)) + removeBtn.addEventListener('click', removeHandler) return () => { if (removeBtn) - removeBtn.removeEventListener('click', () => onRemove(varName)) + removeBtn.removeEventListener('click', removeHandler) } }, [onRemove, varName]) @@ -123,7 +125,7 @@ const HITLInputComponentUI: FC = ({ /> )} {!isPlaceholderVariable && ( -
{formInput.placeholder.value}
+
{formInput.placeholder.value}
)} From 6aa452d4e356468db4293d6dfa3a4f1ecd3d621b Mon Sep 17 00:00:00 2001 From: JzoNg Date: Thu, 22 Jan 2026 15:33:01 +0800 Subject: [PATCH 4/4] fix: add default value for form in HITL --- web/app/(humanInputLayout)/form/[token]/form.tsx | 10 +++++----- .../chat/answer/human-input-content/content-item.tsx | 10 ---------- .../answer/human-input-content/human-input-form.tsx | 9 +++++---- .../base/chat/chat/answer/human-input-content/type.ts | 1 - .../base/chat/chat/answer/human-input-content/utils.ts | 4 ++-- .../nodes/human-input/components/single-run-form.tsx | 3 +-- web/eslint-suppressions.json | 2 +- 7 files changed, 14 insertions(+), 25 deletions(-) diff --git a/web/app/(humanInputLayout)/form/[token]/form.tsx b/web/app/(humanInputLayout)/form/[token]/form.tsx index 033168e7a7..75cd3b6cb9 100644 --- a/web/app/(humanInputLayout)/form/[token]/form.tsx +++ b/web/app/(humanInputLayout)/form/[token]/form.tsx @@ -1,4 +1,5 @@ 'use client' +import type { ButtonProps } from '@/app/components/base/button' import type { FormInputItem, UserAction } from '@/app/components/workflow/nodes/human-input/types' import type { HumanInputFormError } from '@/service/use-share' import { @@ -66,10 +67,10 @@ const FormContent = () => { return const initialInputs: Record = {} formData.inputs.forEach((item) => { - initialInputs[item.output_variable_name] = '' + initialInputs[item.output_variable_name] = item.placeholder.type === 'variable' ? formData.resolved_placeholder_values[item.output_variable_name] || '' : item.placeholder.value }) setInputs(initialInputs) - }, [formData?.inputs]) + }, [formData?.inputs, formData?.resolved_placeholder_values]) // use immer const handleInputsChange = (name: string, value: string) => { @@ -227,15 +228,14 @@ const FormContent = () => { formInputFields={formData.inputs} inputs={inputs} onInputChange={handleInputsChange} - resolvedPlaceholderValues={formData.resolved_placeholder_values} /> ))}
- {formData.user_actions.map((action: any) => ( + {formData.user_actions.map((action: UserAction) => (