From 4d8b8f92105b5b719aa1b2ef74cdc187a10d7b48 Mon Sep 17 00:00:00 2001 From: znn Date: Wed, 15 Oct 2025 08:49:53 +0530 Subject: [PATCH] allow editing of hidden inputs in preview (#24370) Co-authored-by: crazywoola <100913391+crazywoola@users.noreply.github.com> Co-authored-by: crazywoola <427733928@qq.com> --- .../components/before-run-form/form-item.tsx | 16 ++++++++++++++-- .../workflow/panel/debug-and-preview/index.tsx | 2 +- .../panel/debug-and-preview/user-input.tsx | 3 ++- web/i18n/en-US/workflow.ts | 1 + web/i18n/zh-Hans/workflow.ts | 1 + 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/web/app/components/workflow/nodes/_base/components/before-run-form/form-item.tsx b/web/app/components/workflow/nodes/_base/components/before-run-form/form-item.tsx index fd1cd01abf..d6f56b8c43 100644 --- a/web/app/components/workflow/nodes/_base/components/before-run-form/form-item.tsx +++ b/web/app/components/workflow/nodes/_base/components/before-run-form/form-item.tsx @@ -118,8 +118,20 @@ const FormItem: FC = ({
{!isArrayLikeType && !isBooleanType && (
-
{typeof payload.label === 'object' ? nodeKey : payload.label}
- {!payload.required && {t('workflow.panel.optional')}} +
+ {typeof payload.label === 'object' ? nodeKey : payload.label} +
+ {payload.hide === true ? ( + + {t('workflow.panel.optional_and_hidden')} + + ) : ( + !payload.required && ( + + {t('workflow.panel.optional')} + + ) + )}
)}
diff --git a/web/app/components/workflow/panel/debug-and-preview/index.tsx b/web/app/components/workflow/panel/debug-and-preview/index.tsx index baf4c21dcd..9c64849dc5 100644 --- a/web/app/components/workflow/panel/debug-and-preview/index.tsx +++ b/web/app/components/workflow/panel/debug-and-preview/index.tsx @@ -39,7 +39,7 @@ const DebugAndPreview = () => { const selectedNode = nodes.find(node => node.data.selected) const startNode = nodes.find(node => node.data.type === BlockEnum.Start) const variables = startNode?.data.variables || [] - const visibleVariables = variables.filter(v => v.hide !== true) + const visibleVariables = variables const [showConversationVariableModal, setShowConversationVariableModal] = useState(false) diff --git a/web/app/components/workflow/panel/debug-and-preview/user-input.tsx b/web/app/components/workflow/panel/debug-and-preview/user-input.tsx index 0670d9a52b..b7ed2a54fd 100644 --- a/web/app/components/workflow/panel/debug-and-preview/user-input.tsx +++ b/web/app/components/workflow/panel/debug-and-preview/user-input.tsx @@ -14,10 +14,11 @@ import cn from '@/utils/classnames' const UserInput = () => { const workflowStore = useWorkflowStore() const inputs = useStore(s => s.inputs) + const showDebugAndPreviewPanel = useStore(s => s.showDebugAndPreviewPanel) const nodes = useNodes() const startNode = nodes.find(node => node.data.type === BlockEnum.Start) const variables = startNode?.data.variables || [] - const visibleVariables = variables.filter(v => v.hide !== true) + const visibleVariables = showDebugAndPreviewPanel ? variables : variables.filter(v => v.hide !== true) const handleValueChange = (variable: string, v: string) => { const { diff --git a/web/i18n/en-US/workflow.ts b/web/i18n/en-US/workflow.ts index a5862bef86..01d17a4111 100644 --- a/web/i18n/en-US/workflow.ts +++ b/web/i18n/en-US/workflow.ts @@ -340,6 +340,7 @@ const translation = { optional: '(optional)', maximize: 'Maximize Canvas', minimize: 'Exit Full Screen', + optional_and_hidden: '(optional & hidden)', }, nodes: { common: { diff --git a/web/i18n/zh-Hans/workflow.ts b/web/i18n/zh-Hans/workflow.ts index a497bca56a..441c0a707e 100644 --- a/web/i18n/zh-Hans/workflow.ts +++ b/web/i18n/zh-Hans/workflow.ts @@ -340,6 +340,7 @@ const translation = { moveToThisNode: '定位至此节点', maximize: '最大化画布', minimize: '退出最大化', + optional_and_hidden: '(选填 & 隐藏)', }, nodes: { common: {