diff --git a/web/app/components/share/text-generation/run-once/index.tsx b/web/app/components/share/text-generation/run-once/index.tsx index e413bd53ac..721dbb42c3 100644 --- a/web/app/components/share/text-generation/run-once/index.tsx +++ b/web/app/components/share/text-generation/run-once/index.tsx @@ -45,7 +45,10 @@ const RunOnce: FC = ({ const onClear = () => { const newInputs: Record = {} 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) } @@ -63,7 +66,10 @@ const RunOnce: FC = ({ useEffect(() => { const newInputs: Record = {} 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) }, [promptConfig.prompt_variables, onInputsChange])