mirror of
https://github.com/langgenius/dify.git
synced 2025-06-27 05:30:04 +00:00
fix: workflow import sync env and conversation variables (#21215)
This commit is contained in:
parent
0cfdb8c043
commit
cff039d123
@ -12,6 +12,7 @@ import {
|
||||
useWorkflowRun,
|
||||
useWorkflowStartRun,
|
||||
} from '../hooks'
|
||||
import { useWorkflowStore } from '@/app/components/workflow/store'
|
||||
|
||||
type WorkflowMainProps = Pick<WorkflowProps, 'nodes' | 'edges' | 'viewport'>
|
||||
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,
|
||||
|
@ -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])
|
||||
|
Loading…
x
Reference in New Issue
Block a user