diff --git a/web/app/components/workflow-app/components/workflow-main.tsx b/web/app/components/workflow-app/components/workflow-main.tsx index 2f2295cb5..6be190c89 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,14 +21,28 @@ const WorkflowMain = ({ viewport, }: WorkflowMainProps) => { const featuresStore = useFeaturesStore() + const workflowStore = useWorkflowStore() const handleWorkflowDataUpdate = useCallback((payload: any) => { - if (payload.features && featuresStore) { + const { + features, + conversation_variables, + environment_variables, + } = payload + if (features && featuresStore) { const { setFeatures } = featuresStore.getState() - setFeatures(payload.features) + setFeatures(features) } - }, [featuresStore]) + if (conversation_variables) { + const { setConversationVariables } = workflowStore.getState() + setConversationVariables(conversation_variables) + } + if (environment_variables) { + const { setEnvironmentVariables } = workflowStore.getState() + setEnvironmentVariables(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 b789e3b2f..00c36cce9 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])