From d3299db91520e9ea411e853a7af474b14f08b3e2 Mon Sep 17 00:00:00 2001 From: twwu Date: Wed, 7 Jan 2026 18:07:30 +0800 Subject: [PATCH] feat: add human input output structure and enhance filtering in human input form components --- .../base/chat/chat/answer/human-input-form-list.tsx | 6 +++++- web/app/components/workflow/constants.ts | 11 +++++++++++ .../workflow/nodes/_base/components/variable/utils.ts | 3 ++- .../components/workflow/nodes/human-input/node.tsx | 2 +- .../components/workflow/nodes/human-input/panel.tsx | 10 ++++++++++ .../workflow/panel/human-input-form-list.tsx | 6 +++++- web/service/share.ts | 4 ++-- web/types/workflow.ts | 3 ++- 8 files changed, 38 insertions(+), 7 deletions(-) diff --git a/web/app/components/base/chat/chat/answer/human-input-form-list.tsx b/web/app/components/base/chat/chat/answer/human-input-form-list.tsx index 93e6975853..65b5f24c33 100644 --- a/web/app/components/base/chat/chat/answer/human-input-form-list.tsx +++ b/web/app/components/base/chat/chat/answer/human-input-form-list.tsx @@ -41,10 +41,14 @@ const HumanInputFormList = ({ }, {} as Record) }, [getHumanInputNodeData, humanInputFormDataList]) + const filteredHumanInputFormDataList = useMemo(() => { + return humanInputFormDataList.filter(formData => formData.display_in_ui) + }, [humanInputFormDataList]) + return (
{ - humanInputFormDataList.map(formData => ( + filteredHumanInputFormDataList.map(formData => ( > = (props) => {
Timeout
diff --git a/web/app/components/workflow/nodes/human-input/panel.tsx b/web/app/components/workflow/nodes/human-input/panel.tsx index b49845e457..7b02124094 100644 --- a/web/app/components/workflow/nodes/human-input/panel.tsx +++ b/web/app/components/workflow/nodes/human-input/panel.tsx @@ -205,6 +205,16 @@ const Panel: FC> = ({ /> )) } + + {isPreview && ( diff --git a/web/app/components/workflow/panel/human-input-form-list.tsx b/web/app/components/workflow/panel/human-input-form-list.tsx index d8557edc56..e032bfbb89 100644 --- a/web/app/components/workflow/panel/human-input-form-list.tsx +++ b/web/app/components/workflow/panel/human-input-form-list.tsx @@ -52,10 +52,14 @@ const HumanInputFormList = ({ }, {} as Record) }, [getHumanInputNodeData, humanInputFormDataList]) + const filteredHumanInputFormDataList = useMemo(() => { + return humanInputFormDataList.filter(formData => formData.display_in_ui) + }, [humanInputFormDataList]) + return (
{ - humanInputFormDataList.map(formData => ( + filteredHumanInputFormDataList.map(formData => ( { inputs: FormInputItem[] user_actions: UserAction[] expiration_time: number - }>(`/api/form/human_input/${token}`) + }>(`/form/human_input/${token}`) } export const submitHumanInputForm = (token: string, data: { inputs: Record action: string }) => { - return post(`/api/form/human_input/${token}`, { body: data }) + return post(`/form/human_input/${token}`, { body: data }) } diff --git a/web/types/workflow.ts b/web/types/workflow.ts index 0f68f84e24..bc34abafdc 100644 --- a/web/types/workflow.ts +++ b/web/types/workflow.ts @@ -321,7 +321,8 @@ export type HumanInputFormData = { inputs: FormInputItem[] actions: UserAction[] form_token: string - resolved_placeholder_values: Record // For human input placeholder when its type is variable + resolved_placeholder_values: Record + display_in_ui: boolean } export type HumanInputRequiredResponse = {