From ccd346d1da28fbcfdcd49c7b2f4ff99b8129cc61 Mon Sep 17 00:00:00 2001 From: twwu Date: Wed, 25 Jun 2025 10:40:48 +0800 Subject: [PATCH] feat: add handling for RAG pipeline variables in node interactions --- .../workflow/hooks/use-nodes-interactions.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/web/app/components/workflow/hooks/use-nodes-interactions.ts b/web/app/components/workflow/hooks/use-nodes-interactions.ts index 40f2c23ccb..4b736292c5 100644 --- a/web/app/components/workflow/hooks/use-nodes-interactions.ts +++ b/web/app/components/workflow/hooks/use-nodes-interactions.ts @@ -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[]) => {