diff --git a/web/app/components/workflow/nodes/_base/hooks/use-one-step-run.ts b/web/app/components/workflow/nodes/_base/hooks/use-one-step-run.ts index 10e269084f..9f77e66d12 100644 --- a/web/app/components/workflow/nodes/_base/hooks/use-one-step-run.ts +++ b/web/app/components/workflow/nodes/_base/hooks/use-one-step-run.ts @@ -308,14 +308,14 @@ const useOneStepRun = ({ else { postData.inputs = submitData } - res = await singleNodeRun(flowId!, id, postData) as any + res = await singleNodeRun(flowType, flowId!, id, postData) as any } else if (isIteration) { setIterationRunResult([]) let _iterationResult: NodeTracing[] = [] let _runResult: any = null ssePost( - getIterationSingleNodeRunUrl(isChatMode, flowId!, id), + getIterationSingleNodeRunUrl(flowType, isChatMode, flowId!, id), { body: { inputs: submitData } }, { onWorkflowStarted: noop, @@ -418,7 +418,7 @@ const useOneStepRun = ({ let _loopResult: NodeTracing[] = [] let _runResult: any = null ssePost( - getLoopSingleNodeRunUrl(isChatMode, flowId!, id), + getLoopSingleNodeRunUrl(flowType, isChatMode, flowId!, id), { body: { inputs: submitData } }, { onWorkflowStarted: noop, diff --git a/web/service/workflow.ts b/web/service/workflow.ts index 3311d7a205..654fe3d01a 100644 --- a/web/service/workflow.ts +++ b/web/service/workflow.ts @@ -36,16 +36,16 @@ export const fetchChatRunHistory: Fetcher = (url return get(url) } -export const singleNodeRun = (appId: string, nodeId: string, params: object) => { - return post(`apps/${appId}/workflows/draft/nodes/${nodeId}/run`, { body: params }) +export const singleNodeRun = (flowType: FlowType, flowId: string, nodeId: string, params: object) => { + return post(`${getFlowPrefix(flowType)}/${flowId}/workflows/draft/nodes/${nodeId}/run`, { body: params }) } -export const getIterationSingleNodeRunUrl = (isChatFlow: boolean, appId: string, nodeId: string) => { - return `apps/${appId}/${isChatFlow ? 'advanced-chat/' : ''}workflows/draft/iteration/nodes/${nodeId}/run` +export const getIterationSingleNodeRunUrl = (flowType: FlowType, isChatFlow: boolean, flowId: string, nodeId: string) => { + return `${getFlowPrefix(flowType)}/${flowId}/${isChatFlow ? 'advanced-chat/' : ''}workflows/draft/iteration/nodes/${nodeId}/run` } -export const getLoopSingleNodeRunUrl = (isChatFlow: boolean, appId: string, nodeId: string) => { - return `apps/${appId}/${isChatFlow ? 'advanced-chat/' : ''}workflows/draft/loop/nodes/${nodeId}/run` +export const getLoopSingleNodeRunUrl = (flowType: FlowType, isChatFlow: boolean, flowId: string, nodeId: string) => { + return `${getFlowPrefix(flowType)}/${flowId}/${isChatFlow ? 'advanced-chat/' : ''}workflows/draft/loop/nodes/${nodeId}/run` } export const fetchPublishedWorkflow: Fetcher = (url) => {