mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-01 04:02:00 +08:00
fix: do not submit value when file input is optional (#17861)
This commit is contained in:
parent
3ece713a05
commit
78da4ca024
@ -45,7 +45,10 @@ const RunOnce: FC<IRunOnceProps> = ({
|
|||||||
const onClear = () => {
|
const onClear = () => {
|
||||||
const newInputs: Record<string, any> = {}
|
const newInputs: Record<string, any> = {}
|
||||||
promptConfig.prompt_variables.forEach((item) => {
|
promptConfig.prompt_variables.forEach((item) => {
|
||||||
newInputs[item.key] = ''
|
if (item.type === 'text-input' || item.type === 'paragraph')
|
||||||
|
newInputs[item.key] = ''
|
||||||
|
else
|
||||||
|
newInputs[item.key] = undefined
|
||||||
})
|
})
|
||||||
onInputsChange(newInputs)
|
onInputsChange(newInputs)
|
||||||
}
|
}
|
||||||
@ -63,7 +66,10 @@ const RunOnce: FC<IRunOnceProps> = ({
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const newInputs: Record<string, any> = {}
|
const newInputs: Record<string, any> = {}
|
||||||
promptConfig.prompt_variables.forEach((item) => {
|
promptConfig.prompt_variables.forEach((item) => {
|
||||||
newInputs[item.key] = ''
|
if (item.type === 'text-input' || item.type === 'paragraph')
|
||||||
|
newInputs[item.key] = ''
|
||||||
|
else
|
||||||
|
newInputs[item.key] = undefined
|
||||||
})
|
})
|
||||||
onInputsChange(newInputs)
|
onInputsChange(newInputs)
|
||||||
}, [promptConfig.prompt_variables, onInputsChange])
|
}, [promptConfig.prompt_variables, onInputsChange])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user