diff --git a/web/app/components/workflow/hooks/use-workflow-run-event/use-workflow-node-human-input-required.ts b/web/app/components/workflow/hooks/use-workflow-run-event/use-workflow-node-human-input-required.ts index 9b21835ee2..4097675854 100644 --- a/web/app/components/workflow/hooks/use-workflow-run-event/use-workflow-node-human-input-required.ts +++ b/web/app/components/workflow/hooks/use-workflow-run-event/use-workflow-node-human-input-required.ts @@ -4,20 +4,15 @@ import { useCallback } from 'react' import { useStoreApi, } from 'reactflow' -import { useWorkflowStore } from '@/app/components/workflow/store' import { NodeRunningStatus } from '@/app/components/workflow/types' -// import { WorkflowRunningStatus } from '@/app/components/workflow/types' export const useWorkflowNodeHumanInputRequired = () => { - const workflowStore = useWorkflowStore() const store = useStoreApi() + // ! Human input required !== Workflow Paused const handleWorkflowNodeHumanInputRequired = useCallback((params: HumanInputRequiredResponse) => { const { data } = params - const { - workflowRunningData, - setWorkflowRunningData, - } = workflowStore.getState() + const { getNodes, setNodes, @@ -26,19 +21,9 @@ export const useWorkflowNodeHumanInputRequired = () => { const currentNodeIndex = nodes.findIndex(node => node.id === data.node_id) const newNodes = produce(nodes, (draft) => { draft[currentNodeIndex].data._runningStatus = NodeRunningStatus.Paused - // draft[currentNodeIndex].data._waitingRun = false - // store form data & input form schema }) setNodes(newNodes) - - // cache form data & generate input form UI in node data - setWorkflowRunningData(produce(workflowRunningData!, (draft) => { - draft.result = { - ...draft.result, - // status: WorkflowRunningStatus.Paused, // human input required !== workflow 'Paused' - } - })) - }, [store, workflowStore]) + }, [store]) return { handleWorkflowNodeHumanInputRequired, diff --git a/web/app/components/workflow/hooks/use-workflow.ts b/web/app/components/workflow/hooks/use-workflow.ts index 990c8c950d..0c6aa7466e 100644 --- a/web/app/components/workflow/hooks/use-workflow.ts +++ b/web/app/components/workflow/hooks/use-workflow.ts @@ -479,11 +479,21 @@ export const useNodesReadOnly = () => { isRestoring, } = workflowStore.getState() - return !!(workflowRunningData?.result.status === WorkflowRunningStatus.Running || historyWorkflowData || isRestoring) + return !!( + workflowRunningData?.result.status === WorkflowRunningStatus.Running + || workflowRunningData?.result.status === WorkflowRunningStatus.Paused + || historyWorkflowData + || isRestoring + ) }, [workflowStore]) return { - nodesReadOnly: !!(workflowRunningData?.result.status === WorkflowRunningStatus.Running || historyWorkflowData || isRestoring), + nodesReadOnly: !!( + workflowRunningData?.result.status === WorkflowRunningStatus.Running + || workflowRunningData?.result.status === WorkflowRunningStatus.Paused + || historyWorkflowData + || isRestoring + ), getNodesReadOnly, } } diff --git a/web/app/components/workflow/panel/debug-and-preview/hooks.ts b/web/app/components/workflow/panel/debug-and-preview/hooks.ts index 4f84f7c857..34533a9117 100644 --- a/web/app/components/workflow/panel/debug-and-preview/hooks.ts +++ b/web/app/components/workflow/panel/debug-and-preview/hooks.ts @@ -515,13 +515,13 @@ export const useChat = ( const currentTracingIndex = responseItem.workflowProcess!.tracing!.findIndex(item => item.node_id === data.node_id) if (currentTracingIndex > -1) { responseItem.workflowProcess!.tracing[currentTracingIndex].status = NodeRunningStatus.Paused + updateCurrentQAOnTree({ + placeholderQuestionId, + questionItem, + responseItem, + parentId: params.parent_message_id, + }) } - updateCurrentQAOnTree({ - placeholderQuestionId, - questionItem, - responseItem, - parentId: params.parent_message_id, - }) }, onWorkflowPaused: ({ data: _data }) => { responseItem.workflowProcess!.status = WorkflowRunningStatus.Paused