feat: add human input output structure and enhance filtering in human input form components

This commit is contained in:
twwu 2026-01-07 18:07:30 +08:00
parent ebb816b90b
commit d3299db915
8 changed files with 38 additions and 7 deletions

View File

@ -41,10 +41,14 @@ const HumanInputFormList = ({
}, {} as Record<string, { showEmailTip: boolean, isEmailDebugMode: boolean, showDebugModeTip: boolean }>)
}, [getHumanInputNodeData, humanInputFormDataList])
const filteredHumanInputFormDataList = useMemo(() => {
return humanInputFormDataList.filter(formData => formData.display_in_ui)
}, [humanInputFormDataList])
return (
<div className="mt-2 flex flex-col gap-y-2">
{
humanInputFormDataList.map(formData => (
filteredHumanInputFormDataList.map(formData => (
<ContentWrapper
key={formData.node_id}
nodeTitle={formData.node_title}

View File

@ -212,6 +212,17 @@ export const TOOL_OUTPUT_STRUCT: Var[] = [
},
]
export const HUMAN_INPUT_OUTPUT_STRUCT: Var[] = [
{
variable: '__action_id',
type: VarType.string,
},
{
variable: '__rendered_content',
type: VarType.string,
},
]
export const PARAMETER_EXTRACTOR_COMMON_STRUCT: Var[] = [
{
variable: '__is_success',

View File

@ -42,6 +42,7 @@ import {
FILE_STRUCT,
getGlobalVars,
HTTP_REQUEST_OUTPUT_STRUCT,
HUMAN_INPUT_OUTPUT_STRUCT,
KNOWLEDGE_RETRIEVAL_OUTPUT_STRUCT,
LLM_OUTPUT_STRUCT,
PARAMETER_EXTRACTOR_COMMON_STRUCT,
@ -640,7 +641,7 @@ const formatItem = (
[],
{ schemaTypeDefinitions },
) || []
res.vars = outputSchema
res.vars = [...outputSchema, ...HUMAN_INPUT_OUTPUT_STRUCT]
break
}

View File

@ -62,7 +62,7 @@ const Node: FC<NodeProps<HumanInputNodeType>> = (props) => {
<div className="system-xs-semibold-uppercase truncate text-text-secondary">Timeout</div>
<NodeSourceHandle
{...props}
handleId="timeout"
handleId="__timeout"
handleClassName="!top-1/2 !-right-[9px] !-translate-y-1/2"
/>
</div>

View File

@ -205,6 +205,16 @@ const Panel: FC<NodePanelProps<HumanInputNodeType>> = ({
/>
))
}
<VarItem
name="__action_id"
type="string"
description="Action ID user triggered"
/>
<VarItem
name="__rendered_content"
type="string"
description="Rendered content"
/>
</OutputVars>
{isPreview && (

View File

@ -52,10 +52,14 @@ const HumanInputFormList = ({
}, {} as Record<string, { showEmailTip: boolean, isEmailDebugMode: boolean, showDebugModeTip: boolean }>)
}, [getHumanInputNodeData, humanInputFormDataList])
const filteredHumanInputFormDataList = useMemo(() => {
return humanInputFormDataList.filter(formData => formData.display_in_ui)
}, [humanInputFormDataList])
return (
<div className="flex flex-col gap-y-3">
{
humanInputFormDataList.map(formData => (
filteredHumanInputFormDataList.map(formData => (
<ContentWrapper
key={formData.node_id}
nodeTitle={formData.node_title}

View File

@ -334,12 +334,12 @@ export const getHumanInputForm = (token: string) => {
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<string, any>
action: string
}) => {
return post(`/api/form/human_input/${token}`, { body: data })
return post(`/form/human_input/${token}`, { body: data })
}

View File

@ -321,7 +321,8 @@ export type HumanInputFormData = {
inputs: FormInputItem[]
actions: UserAction[]
form_token: string
resolved_placeholder_values: Record<string, string> // For human input placeholder when its type is variable
resolved_placeholder_values: Record<string, string>
display_in_ui: boolean
}
export type HumanInputRequiredResponse = {