From 0e2b59d661a0bd4b99b33e201449d4971e2c7cfd Mon Sep 17 00:00:00 2001 From: twwu Date: Tue, 30 Dec 2025 10:45:59 +0800 Subject: [PATCH] fix: update placeholder handling in ContentItem and remove unused error messages from HumanInputNode --- .../chat/answer/human-input-content/content-item.tsx | 8 +++++--- .../components/workflow/nodes/human-input/default.ts | 10 ---------- web/i18n/en-US/workflow.json | 2 -- web/i18n/zh-Hans/workflow.json | 2 -- 4 files changed, 5 insertions(+), 17 deletions(-) diff --git a/web/app/components/base/chat/chat/answer/human-input-content/content-item.tsx b/web/app/components/base/chat/chat/answer/human-input-content/content-item.tsx index bf833c27d3..6835a6d1a5 100644 --- a/web/app/components/base/chat/chat/answer/human-input-content/content-item.tsx +++ b/web/app/components/base/chat/chat/answer/human-input-content/content-item.tsx @@ -31,9 +31,11 @@ const ContentItem = ({ }, [formInputFields, fieldName]) const placeholder = useMemo(() => { - return formInputField?.placeholder.type === 'variable' - ? resolvedPlaceholderValues?.[fieldName] - : formInputField?.placeholder.value + if (!formInputField) + return '' + return formInputField.placeholder.type === 'variable' + ? resolvedPlaceholderValues?.[fieldName] || '' + : formInputField.placeholder.value }, [formInputField, resolvedPlaceholderValues, fieldName]) if (!isInputField(content)) { diff --git a/web/app/components/workflow/nodes/human-input/default.ts b/web/app/components/workflow/nodes/human-input/default.ts index dbd99b5dfa..b9b95ae1cc 100644 --- a/web/app/components/workflow/nodes/human-input/default.ts +++ b/web/app/components/workflow/nodes/human-input/default.ts @@ -2,7 +2,6 @@ import type { NodeDefault, Var } from '../../types' import type { HumanInputNodeType } from './types' import { BlockClassificationEnum } from '@/app/components/workflow/block-selector/types' import { BlockEnum, VarType } from '@/app/components/workflow/types' -// import { DeliveryMethodType, UserActionButtonType } from './types' import { genNodeMetaData } from '@/app/components/workflow/utils' const i18nPrefix = 'nodes.humanInput.errorMsg' @@ -40,15 +39,6 @@ const nodeDefault: NodeDefault = { if (!errorMessages && payload.delivery_methods.length > 0 && !payload.delivery_methods.some(method => method.enabled)) errorMessages = t(`${i18nPrefix}.noDeliveryMethodEnabled`, { ns: 'workflow' }) - if (!errorMessages && !payload.form_content) - errorMessages = t(`${i18nPrefix}.noFormContent`, { ns: 'workflow' }) - - if (!errorMessages && payload.form_content) { - const regex = /\{\{#\$output\.[^#]+#\}\}/ - if (!regex.test(payload.form_content)) - errorMessages = t(`${i18nPrefix}.noFormInputField`, { ns: 'workflow' }) - } - if (!errorMessages && !payload.user_actions.length) errorMessages = t(`${i18nPrefix}.noUserActions`, { ns: 'workflow' }) diff --git a/web/i18n/en-US/workflow.json b/web/i18n/en-US/workflow.json index e309825c6f..37eeef06d3 100644 --- a/web/i18n/en-US/workflow.json +++ b/web/i18n/en-US/workflow.json @@ -558,8 +558,6 @@ "nodes.humanInput.editor.previewTip": "In preview mode, action buttons are not functional.", "nodes.humanInput.errorMsg.noDeliveryMethod": "Please select at least one delivery method", "nodes.humanInput.errorMsg.noDeliveryMethodEnabled": "Please enable at least one delivery method", - "nodes.humanInput.errorMsg.noFormContent": "Please add form content", - "nodes.humanInput.errorMsg.noFormInputField": "Please add at least one form input field", "nodes.humanInput.errorMsg.noUserActions": "Please add at least one user action", "nodes.humanInput.formContent.hotkeyTip": "Press to insert variable, to insert input field", "nodes.humanInput.formContent.preview": "Preview", diff --git a/web/i18n/zh-Hans/workflow.json b/web/i18n/zh-Hans/workflow.json index 356b3533fc..99fc9ca68b 100644 --- a/web/i18n/zh-Hans/workflow.json +++ b/web/i18n/zh-Hans/workflow.json @@ -558,8 +558,6 @@ "nodes.humanInput.editor.previewTip": "在预览模式下,操作按钮无法使用。", "nodes.humanInput.errorMsg.noDeliveryMethod": "请至少选择一种提交方式", "nodes.humanInput.errorMsg.noDeliveryMethodEnabled": "请至少启用一种提交方式", - "nodes.humanInput.errorMsg.noFormContent": "请添加表单内容", - "nodes.humanInput.errorMsg.noFormInputField": "请至少添加一个表单输入字段", "nodes.humanInput.errorMsg.noUserActions": "请添加至少一个用户操作", "nodes.humanInput.formContent.hotkeyTip": "按 插入变量,按 插入输入字段", "nodes.humanInput.formContent.preview": "预览",