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