mirror of https://github.com/langgenius/dify.git
step run of human input params
This commit is contained in:
parent
20ba0de47d
commit
8f6a0e2d8e
|
|
@ -29,6 +29,7 @@ const useSingleRunFormParams = ({
|
|||
const { inputs } = useNodeCrud<HumanInputNodeType>(id, payload)
|
||||
const [showGeneratedForm, setShowGeneratedForm] = useState(false)
|
||||
const [formData, setFormData] = useState<any>(null)
|
||||
const [requiredInputs, setRequiredInputs] = useState<Record<string, any>>()
|
||||
const generatedInputs = useMemo(() => {
|
||||
if (!inputs.form_content)
|
||||
return []
|
||||
|
|
@ -84,12 +85,17 @@ const useSingleRunFormParams = ({
|
|||
}
|
||||
const data = await fetchHumanInputNodeStepRunForm(fetchURL, { inputs: requestParamsObj! })
|
||||
setFormData(data)
|
||||
setRequiredInputs(requestParamsObj)
|
||||
return data
|
||||
}, [fetchURL])
|
||||
|
||||
const handleSubmitHumanInputForm = useCallback(async (formData: any) => {
|
||||
await submitHumanInputNodeStepRunForm(fetchURL, formData)
|
||||
}, [fetchURL])
|
||||
await submitHumanInputNodeStepRunForm(fetchURL, {
|
||||
inputs: requiredInputs,
|
||||
form_inputs: formData.inputs,
|
||||
action: formData.action,
|
||||
})
|
||||
}, [fetchURL, requiredInputs])
|
||||
|
||||
const handleShowGeneratedForm = async (formValue: Record<string, any>) => {
|
||||
setShowGeneratedForm(true)
|
||||
|
|
|
|||
|
|
@ -121,7 +121,8 @@ export const fetchHumanInputNodeStepRunForm = (
|
|||
export const submitHumanInputNodeStepRunForm = (
|
||||
url: string,
|
||||
data: {
|
||||
inputs: Record<string, any>
|
||||
inputs: Record<string, any> | undefined
|
||||
form_inputs: Record<string, any> | undefined
|
||||
action: string
|
||||
},
|
||||
) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue