mirror of https://github.com/langgenius/dify.git
feat: Add support for hidden attributes to form item types (#20956)
This commit is contained in:
parent
945d1569ee
commit
8ac3bd1768
|
|
@ -90,6 +90,7 @@ export type TextTypeFormItem = {
|
||||||
variable: string
|
variable: string
|
||||||
required: boolean
|
required: boolean
|
||||||
max_length: number
|
max_length: number
|
||||||
|
hide: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export type SelectTypeFormItem = {
|
export type SelectTypeFormItem = {
|
||||||
|
|
@ -98,6 +99,7 @@ export type SelectTypeFormItem = {
|
||||||
variable: string
|
variable: string
|
||||||
required: boolean
|
required: boolean
|
||||||
options: string[]
|
options: string[]
|
||||||
|
hide: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ParagraphTypeFormItem = {
|
export type ParagraphTypeFormItem = {
|
||||||
|
|
@ -105,6 +107,7 @@ export type ParagraphTypeFormItem = {
|
||||||
label: string
|
label: string
|
||||||
variable: string
|
variable: string
|
||||||
required: boolean
|
required: boolean
|
||||||
|
hide: boolean
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* User Input Form Item
|
* User Input Form Item
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ export const userInputsFormToPromptVariables = (useInputs: UserInputFormItem[] |
|
||||||
max_length: content.max_length,
|
max_length: content.max_length,
|
||||||
options: [],
|
options: [],
|
||||||
is_context_var,
|
is_context_var,
|
||||||
|
hide: content.hide,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
else if (type === 'number') {
|
else if (type === 'number') {
|
||||||
|
|
@ -49,6 +50,7 @@ export const userInputsFormToPromptVariables = (useInputs: UserInputFormItem[] |
|
||||||
required: content.required,
|
required: content.required,
|
||||||
type,
|
type,
|
||||||
options: [],
|
options: [],
|
||||||
|
hide: content.hide,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
else if (type === 'select') {
|
else if (type === 'select') {
|
||||||
|
|
@ -59,6 +61,7 @@ export const userInputsFormToPromptVariables = (useInputs: UserInputFormItem[] |
|
||||||
type: 'select',
|
type: 'select',
|
||||||
options: content.options,
|
options: content.options,
|
||||||
is_context_var,
|
is_context_var,
|
||||||
|
hide: content.hide,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
else if (type === 'file') {
|
else if (type === 'file') {
|
||||||
|
|
@ -73,6 +76,7 @@ export const userInputsFormToPromptVariables = (useInputs: UserInputFormItem[] |
|
||||||
allowed_file_upload_methods: content.allowed_file_upload_methods,
|
allowed_file_upload_methods: content.allowed_file_upload_methods,
|
||||||
number_limits: 1,
|
number_limits: 1,
|
||||||
},
|
},
|
||||||
|
hide: content.hide,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
else if (type === 'file-list') {
|
else if (type === 'file-list') {
|
||||||
|
|
@ -87,6 +91,7 @@ export const userInputsFormToPromptVariables = (useInputs: UserInputFormItem[] |
|
||||||
allowed_file_upload_methods: content.allowed_file_upload_methods,
|
allowed_file_upload_methods: content.allowed_file_upload_methods,
|
||||||
number_limits: content.max_length,
|
number_limits: content.max_length,
|
||||||
},
|
},
|
||||||
|
hide: content.hide,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -100,6 +105,7 @@ export const userInputsFormToPromptVariables = (useInputs: UserInputFormItem[] |
|
||||||
icon: content.icon,
|
icon: content.icon,
|
||||||
icon_background: content.icon_background,
|
icon_background: content.icon_background,
|
||||||
is_context_var,
|
is_context_var,
|
||||||
|
hide: content.hide,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -119,6 +125,7 @@ export const promptVariablesToUserInputsForm = (promptVariables: PromptVariable[
|
||||||
required: item.required !== false, // default true
|
required: item.required !== false, // default true
|
||||||
max_length: item.max_length,
|
max_length: item.max_length,
|
||||||
default: '',
|
default: '',
|
||||||
|
hide: item.hide,
|
||||||
},
|
},
|
||||||
} as any)
|
} as any)
|
||||||
return
|
return
|
||||||
|
|
@ -130,6 +137,7 @@ export const promptVariablesToUserInputsForm = (promptVariables: PromptVariable[
|
||||||
variable: item.key,
|
variable: item.key,
|
||||||
required: item.required !== false, // default true
|
required: item.required !== false, // default true
|
||||||
default: '',
|
default: '',
|
||||||
|
hide: item.hide,
|
||||||
},
|
},
|
||||||
} as any)
|
} as any)
|
||||||
}
|
}
|
||||||
|
|
@ -141,6 +149,7 @@ export const promptVariablesToUserInputsForm = (promptVariables: PromptVariable[
|
||||||
required: item.required !== false, // default true
|
required: item.required !== false, // default true
|
||||||
options: item.options,
|
options: item.options,
|
||||||
default: '',
|
default: '',
|
||||||
|
hide: item.hide,
|
||||||
},
|
},
|
||||||
} as any)
|
} as any)
|
||||||
}
|
}
|
||||||
|
|
@ -155,6 +164,7 @@ export const promptVariablesToUserInputsForm = (promptVariables: PromptVariable[
|
||||||
required: item.required,
|
required: item.required,
|
||||||
icon: item.icon,
|
icon: item.icon,
|
||||||
icon_background: item.icon_background,
|
icon_background: item.icon_background,
|
||||||
|
hide: item.hide,
|
||||||
},
|
},
|
||||||
} as any)
|
} as any)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue