mirror of
https://github.com/langgenius/dify.git
synced 2026-05-05 01:48:04 +08:00
switch to skills tab, keep ws connected and ensure has leader
This commit is contained in:
@ -18,6 +18,7 @@ import { FeaturesProvider } from '@/app/components/base/features'
|
||||
import Loading from '@/app/components/base/loading'
|
||||
import { FILE_EXTS } from '@/app/components/base/prompt-editor/constants'
|
||||
import WorkflowWithDefaultContext from '@/app/components/workflow'
|
||||
import { useCollaboration } from '@/app/components/workflow/collaboration'
|
||||
import { collaborationManager } from '@/app/components/workflow/collaboration/core/collaboration-manager'
|
||||
import {
|
||||
WorkflowContextProvider,
|
||||
@ -52,6 +53,12 @@ const SkillMain = dynamic(() => import('@/app/components/workflow/skill/main'),
|
||||
ssr: false,
|
||||
})
|
||||
|
||||
const CollaborationSession = () => {
|
||||
const appId = useStore(s => s.appId)
|
||||
useCollaboration(appId || '')
|
||||
return null
|
||||
}
|
||||
|
||||
type WorkflowViewContentProps = {
|
||||
renderGraph: (headerLeftSlot: ReactNode) => ReactNode
|
||||
reload: () => Promise<void>
|
||||
@ -95,6 +102,20 @@ const WorkflowViewContent = ({
|
||||
}
|
||||
}, [doSetViewType, refreshGraph, syncWorkflowDraftImmediately, viewType])
|
||||
|
||||
useEffect(() => {
|
||||
if (!isSupportSandbox) {
|
||||
collaborationManager.emitGraphViewActive(true)
|
||||
return () => {
|
||||
collaborationManager.emitGraphViewActive(false)
|
||||
}
|
||||
}
|
||||
|
||||
collaborationManager.emitGraphViewActive(viewType === ViewType.graph)
|
||||
return () => {
|
||||
collaborationManager.emitGraphViewActive(false)
|
||||
}
|
||||
}, [isSupportSandbox, viewType])
|
||||
|
||||
if (!isSupportSandbox)
|
||||
return renderGraph(null)
|
||||
|
||||
@ -321,17 +342,20 @@ const WorkflowAppWithAdditionalContext = () => {
|
||||
}
|
||||
|
||||
return (
|
||||
<WorkflowWithDefaultContext
|
||||
edges={edgesData}
|
||||
nodes={nodesData}
|
||||
>
|
||||
<FeaturesProvider features={initialFeatures}>
|
||||
<WorkflowViewContent
|
||||
renderGraph={renderGraph}
|
||||
reload={reload}
|
||||
/>
|
||||
</FeaturesProvider>
|
||||
</WorkflowWithDefaultContext>
|
||||
<>
|
||||
<CollaborationSession />
|
||||
<WorkflowWithDefaultContext
|
||||
edges={edgesData}
|
||||
nodes={nodesData}
|
||||
>
|
||||
<FeaturesProvider features={initialFeatures}>
|
||||
<WorkflowViewContent
|
||||
renderGraph={renderGraph}
|
||||
reload={reload}
|
||||
/>
|
||||
</FeaturesProvider>
|
||||
</WorkflowWithDefaultContext>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user