From bf26f1129ed6c8a4206783f7676fcf7ba2ace89c Mon Sep 17 00:00:00 2001 From: NFish Date: Fri, 11 Apr 2025 13:52:19 +0800 Subject: [PATCH] fix: run button disappeared when where is no inputs in form (#17854) --- .../share/text-generation/run-once/index.tsx | 124 +++++++++--------- 1 file changed, 61 insertions(+), 63 deletions(-) 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 f31c5d5e85..e413bd53ac 100644 --- a/web/app/components/share/text-generation/run-once/index.tsx +++ b/web/app/components/share/text-generation/run-once/index.tsx @@ -1,4 +1,4 @@ -import type { FC, FormEvent } from 'react' +import type { ChangeEvent, FC, FormEvent } from 'react' import { useEffect } from 'react' import React, { useCallback } from 'react' import { useTranslation } from 'react-i18next' @@ -66,75 +66,73 @@ const RunOnce: FC = ({ newInputs[item.key] = '' }) onInputsChange(newInputs) - }, [promptConfig.prompt_variables]) - - if (inputs === null || inputs === undefined || Object.keys(inputs).length === 0) - return null + }, [promptConfig.prompt_variables, onInputsChange]) return (
{/* input form */}
- {promptConfig.prompt_variables.map(item => ( -
- -
- {item.type === 'select' && ( - { handleInputsChange({ ...inputsRef.current, [item.key]: e.target.value }) }} - maxLength={item.max_length || DEFAULT_VALUE_MAX_LEN} - /> - )} - {item.type === 'paragraph' && ( -