diff --git a/web/app/components/share/text-generation/index.tsx b/web/app/components/share/text-generation/index.tsx index 9dd86335b6..75a1937b7f 100644 --- a/web/app/components/share/text-generation/index.tsx +++ b/web/app/components/share/text-generation/index.tsx @@ -302,10 +302,17 @@ const TextGeneration: FC = ({ const varLen = promptConfig?.prompt_variables.length || 0 setIsCallBatchAPI(true) const allTaskList: Task[] = payloadData.map((item, i) => { - const inputs: Record = {} + const inputs: Record = {} if (varLen > 0) { item.slice(0, varLen).forEach((input, index) => { - inputs[promptConfig?.prompt_variables[index].key as string] = input + const varSchema = promptConfig?.prompt_variables[index] + inputs[varSchema?.key as string] = input + if (!input) { + if (varSchema?.type === 'string' || varSchema?.type === 'paragraph') + inputs[varSchema?.key as string] = '' + else + inputs[varSchema?.key as string] = undefined + } }) } return { 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 721dbb42c3..546b21d2b0 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,7 @@ const RunOnce: FC = ({ const onClear = () => { const newInputs: Record = {} promptConfig.prompt_variables.forEach((item) => { - if (item.type === 'text-input' || item.type === 'paragraph') + if (item.type === 'string' || item.type === 'paragraph') newInputs[item.key] = '' else newInputs[item.key] = undefined @@ -66,7 +66,7 @@ const RunOnce: FC = ({ useEffect(() => { const newInputs: Record = {} promptConfig.prompt_variables.forEach((item) => { - if (item.type === 'text-input' || item.type === 'paragraph') + if (item.type === 'string' || item.type === 'paragraph') newInputs[item.key] = '' else newInputs[item.key] = undefined