mirror of
https://github.com/langgenius/dify.git
synced 2025-11-01 19:32:58 +00:00
feat: add handling for RAG pipeline variables in node interactions
This commit is contained in:
parent
a866cbc6d7
commit
ccd346d1da
@ -60,6 +60,7 @@ import {
|
||||
} from './use-workflow'
|
||||
import { WorkflowHistoryEvent, useWorkflowHistory } from './use-workflow-history'
|
||||
import { useNodesMetaData } from './use-nodes-meta-data'
|
||||
import type { RAGPipelineVariables } from '@/models/pipeline'
|
||||
|
||||
export const useNodesInteractions = () => {
|
||||
const { t } = useTranslation()
|
||||
@ -628,6 +629,19 @@ export const useNodesInteractions = () => {
|
||||
}
|
||||
}
|
||||
|
||||
if (currentNode.data.type === BlockEnum.DataSource) {
|
||||
const { id } = currentNode
|
||||
const { ragPipelineVariables, setRagPipelineVariables } = workflowStore.getState()
|
||||
if (ragPipelineVariables && setRagPipelineVariables) {
|
||||
const newRagPipelineVariables: RAGPipelineVariables = []
|
||||
ragPipelineVariables.forEach((variable) => {
|
||||
if (variable.belong_to_node_id === id) return
|
||||
newRagPipelineVariables.push(variable)
|
||||
})
|
||||
setRagPipelineVariables(newRagPipelineVariables)
|
||||
}
|
||||
}
|
||||
|
||||
const connectedEdges = getConnectedEdges([{ id: nodeId } as Node], edges)
|
||||
const nodesConnectedSourceOrTargetHandleIdsMap = getNodesConnectedSourceOrTargetHandleIdsMap(connectedEdges.map(edge => ({ type: 'remove', edge })), nodes)
|
||||
const newNodes = produce(nodes, (draft: Node[]) => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user