mirror of https://github.com/langgenius/dify.git
Merge branch 'feat/rag-pipeline' of https://github.com/langgenius/dify into feat/rag-pipeline
This commit is contained in:
commit
3899211c41
|
|
@ -1,4 +1,5 @@
|
|||
import {
|
||||
useCallback,
|
||||
useMemo,
|
||||
} from 'react'
|
||||
import { WorkflowWithInnerContext } from '@/app/components/workflow'
|
||||
|
|
@ -13,6 +14,7 @@ import {
|
|||
usePipelineRun,
|
||||
usePipelineStartRun,
|
||||
} from '../hooks'
|
||||
import { useWorkflowStore } from '@/app/components/workflow/store'
|
||||
|
||||
type RagPipelineMainProps = Pick<WorkflowProps, 'nodes' | 'edges' | 'viewport'>
|
||||
const RagPipelineMain = ({
|
||||
|
|
@ -20,6 +22,23 @@ const RagPipelineMain = ({
|
|||
edges,
|
||||
viewport,
|
||||
}: RagPipelineMainProps) => {
|
||||
const workflowStore = useWorkflowStore()
|
||||
|
||||
const handleWorkflowDataUpdate = useCallback((payload: any) => {
|
||||
const {
|
||||
rag_pipeline_variables,
|
||||
environment_variables,
|
||||
} = payload
|
||||
if (rag_pipeline_variables) {
|
||||
const { setRagPipelineVariables } = workflowStore.getState()
|
||||
setRagPipelineVariables?.(rag_pipeline_variables)
|
||||
}
|
||||
if (environment_variables) {
|
||||
const { setEnvironmentVariables } = workflowStore.getState()
|
||||
setEnvironmentVariables(environment_variables)
|
||||
}
|
||||
}, [workflowStore])
|
||||
|
||||
const {
|
||||
doSyncWorkflowDraft,
|
||||
syncWorkflowDraftWhenPageClose,
|
||||
|
|
@ -83,6 +102,7 @@ const RagPipelineMain = ({
|
|||
edges={edges}
|
||||
viewport={viewport}
|
||||
hooksStore={hooksStore as any}
|
||||
onWorkflowDataUpdate={handleWorkflowDataUpdate}
|
||||
>
|
||||
<RagPipelineChildren />
|
||||
</WorkflowWithInnerContext>
|
||||
|
|
|
|||
Loading…
Reference in New Issue