Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: do not submit value when file input is optional (#17861)

KVOJJJin78da4ca024c1
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 e413bd53ac3..721dbb42c38 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<IRunOnceProps> = ({
const onClear = () => {
const newInputs: Record<string, any> = {}
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<IRunOnceProps> = ({
useEffect(() => {
const newInputs: Record<string, any> = {}
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])