mirror of
https://github.com/langgenius/dify.git
synced 2026-04-28 03:36:36 +08:00
feat: one step run support boolean
This commit is contained in:
parent
fc0dea5647
commit
f2dfb5363f
@ -32,6 +32,8 @@ export type BeforeRunFormProps = {
|
|||||||
} & Partial<SpecialResultPanelProps>
|
} & Partial<SpecialResultPanelProps>
|
||||||
|
|
||||||
function formatValue(value: string | any, type: InputVarType) {
|
function formatValue(value: string | any, type: InputVarType) {
|
||||||
|
if(type === InputVarType.boolean)
|
||||||
|
return !!value
|
||||||
if(value === undefined || value === null)
|
if(value === undefined || value === null)
|
||||||
return value
|
return value
|
||||||
if (type === InputVarType.number)
|
if (type === InputVarType.number)
|
||||||
@ -87,7 +89,7 @@ const BeforeRunForm: FC<BeforeRunFormProps> = ({
|
|||||||
|
|
||||||
form.inputs.forEach((input) => {
|
form.inputs.forEach((input) => {
|
||||||
const value = form.values[input.variable] as any
|
const value = form.values[input.variable] as any
|
||||||
if (!errMsg && input.required && !(input.variable in existVarValuesInForm) && (value === '' || value === undefined || value === null || (input.type === InputVarType.files && value.length === 0)))
|
if (!errMsg && input.required && (input.type !== InputVarType.boolean) && !(input.variable in existVarValuesInForm) && (value === '' || value === undefined || value === null || (input.type === InputVarType.files && value.length === 0)))
|
||||||
errMsg = t('workflow.errorMsg.fieldRequired', { field: typeof input.label === 'object' ? input.label.variable : input.label })
|
errMsg = t('workflow.errorMsg.fieldRequired', { field: typeof input.label === 'object' ? input.label.variable : input.label })
|
||||||
|
|
||||||
if (!errMsg && (input.type === InputVarType.singleFile || input.type === InputVarType.multiFiles) && value) {
|
if (!errMsg && (input.type === InputVarType.singleFile || input.type === InputVarType.multiFiles) && value) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user