step run of human input

This commit is contained in:
JzoNg 2026-01-12 14:16:19 +08:00
parent 68885afac6
commit 72bc396646
2 changed files with 18 additions and 8 deletions

View File

@ -61,18 +61,28 @@ const useSingleRunFormParams = ({
const fetchURL = useMemo(() => {
if (!appId)
return ''
if (isWorkflowMode) {
return `/apps/${appId}/advanced-chat/workflows/draft/human_input/nodes/${id}/form`
if (!isWorkflowMode) {
return `/apps/${appId}/advanced-chat/workflows/draft/human-input/nodes/${id}/form`
}
else {
return `/apps/${appId}/workflows/draft/human_input/nodes/${id}/form`
return `/apps/${appId}/workflows/draft/human-input/nodes/${id}/form`
}
}, [appId, id, isWorkflowMode])
const handleFetchFormContent = useCallback(async (inputs: Record<string, any>) => {
if (!fetchURL)
return null
const data = await fetchHumanInputNodeStepRunForm(fetchURL, { inputs })
let requestParamsObj
Object.keys(inputs).forEach((key) => {
if (inputs[key] === undefined) {
delete inputs[key]
}
})
requestParamsObj = { ...inputs }
if (Object.keys(requestParamsObj).length === 0) {
requestParamsObj = undefined
}
const data = await fetchHumanInputNodeStepRunForm(fetchURL, { inputs: requestParamsObj! })
setFormData(data)
return data
}, [fetchURL])

View File

@ -107,15 +107,15 @@ export const submitHumanInputForm = (token: string, data: {
export const fetchHumanInputNodeStepRunForm = (
url: string,
params: {
data: {
inputs: Record<string, any>
},
) => {
return get<{
return post<{
form_content: string
inputs: FormInputItem[]
user_actions: UserAction[]
}>(url, { params })
}>(`${url}/preview`, { body: data })
}
export const submitHumanInputNodeStepRunForm = (
@ -125,5 +125,5 @@ export const submitHumanInputNodeStepRunForm = (
action: string
},
) => {
return post<CommonResponse>(url, { body: data })
return post<CommonResponse>(`${url}/run`, { body: data })
}