diff --git a/web/app/components/workflow-app/components/workflow-main.tsx b/web/app/components/workflow-app/components/workflow-main.tsx index 2f2295cb59..a8627585ae 100644 --- a/web/app/components/workflow-app/components/workflow-main.tsx +++ b/web/app/components/workflow-app/components/workflow-main.tsx @@ -12,6 +12,7 @@ import { useWorkflowRun, useWorkflowStartRun, } from '../hooks' +import { useWorkflowStore } from '@/app/components/workflow/store' type WorkflowMainProps = Pick const WorkflowMain = ({ @@ -20,6 +21,7 @@ const WorkflowMain = ({ viewport, }: WorkflowMainProps) => { const featuresStore = useFeaturesStore() + const workflowStore = useWorkflowStore() const handleWorkflowDataUpdate = useCallback((payload: any) => { if (payload.features && featuresStore) { @@ -27,7 +29,15 @@ const WorkflowMain = ({ setFeatures(payload.features) } - }, [featuresStore]) + if (payload.conversation_variables) { + const { setConversationVariables } = workflowStore.getState() + setConversationVariables(payload.conversation_variables) + } + if (payload.environment_variables) { + const { setEnvironmentVariables } = workflowStore.getState() + setEnvironmentVariables(payload.environment_variables) + } + }, [featuresStore, workflowStore]) const { doSyncWorkflowDraft, diff --git a/web/app/components/workflow/update-dsl-modal.tsx b/web/app/components/workflow/update-dsl-modal.tsx index b789e3b2fd..00c36cce90 100644 --- a/web/app/components/workflow/update-dsl-modal.tsx +++ b/web/app/components/workflow/update-dsl-modal.tsx @@ -86,6 +86,8 @@ const UpdateDSLModal = ({ graph, features, hash, + conversation_variables, + environment_variables, } = await fetchWorkflowDraft(`/apps/${app_id}/workflows/draft`) const { nodes, edges, viewport } = graph @@ -122,6 +124,8 @@ const UpdateDSLModal = ({ viewport, features: newFeatures, hash, + conversation_variables: conversation_variables || [], + environment_variables: environment_variables || [], }, } as any) }, [eventEmitter])