This commit is contained in:
StyleZhang
2024-03-16 15:00:30 +08:00
parent 5ee7fc4fde
commit 05f97f6e06
20 changed files with 78 additions and 43 deletions

View File

@ -47,10 +47,12 @@ export const useIsChatMode = () => {
export const useWorkflow = () => {
const store = useStoreApi()
const reactflow = useReactFlow()
const workflowStore = useWorkflowStore()
const nodesExtraData = useNodesExtraData()
const { handleSyncWorkflowDraft } = useNodesSyncDraft()
const handleLayout = useCallback(async () => {
workflowStore.setState({ nodeAnimation: true })
const {
getNodes,
edges,
@ -70,13 +72,16 @@ export const useWorkflow = () => {
})
})
setNodes(newNodes)
const zoom = 0.7
setViewport({
x: 0,
y: 0,
zoom: 0.8,
zoom,
})
setTimeout(() => handleSyncWorkflowDraft())
}, [store, reactflow, handleSyncWorkflowDraft])
setTimeout(() => {
handleSyncWorkflowDraft()
})
}, [store, reactflow, handleSyncWorkflowDraft, workflowStore])
const getTreeLeafNodes = useCallback((nodeId: string) => {
const {