Fix: Fixed the issue that the condition of deleting the classification operator cannot be connected anymore #3221 (#9068)

### What problem does this PR solve?
Fix: Fixed the issue that the condition of deleting the classification
operator cannot be connected anymore #3221
### Type of change



- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
balibabu
2025-07-28 14:16:20 +08:00
committed by GitHub
parent 905dab22a6
commit cc0227cf6e
16 changed files with 150 additions and 146 deletions

View File

@ -84,6 +84,7 @@ export type RFState = {
setClickedNodeId: (id?: string) => void;
setClickedToolId: (id?: string) => void;
findUpstreamNodeById: (id?: string | null) => RAGFlowNodeType | undefined;
deleteCategorizeCaseEdges: (source: string, sourceHandle: string) => void; // Deleting a condition of a classification operator will delete the related edge
};
// this is our useStore hook that we can use in our components to get parts of the store and call actions
@ -307,14 +308,14 @@ const useGraphStore = create<RFState>()(
[sourceHandle as string]: undefined,
});
break;
case Operator.Categorize:
if (sourceHandle)
updateNodeForm(source, undefined, [
'category_description',
sourceHandle,
'to',
]);
break;
// case Operator.Categorize:
// if (sourceHandle)
// updateNodeForm(source, undefined, [
// 'category_description',
// sourceHandle,
// 'to',
// ]);
// break;
case Operator.Switch: {
updateSwitchFormData(source, sourceHandle, target, false);
break;
@ -508,6 +509,15 @@ const useGraphStore = create<RFState>()(
const edge = edges.find((x) => x.target === id);
return getNode(edge?.source);
},
deleteCategorizeCaseEdges: (source, sourceHandle) => {
const { edges, setEdges } = get();
setEdges(
edges.filter(
(edge) =>
!(edge.source === source && edge.sourceHandle === sourceHandle),
),
);
},
})),
{ name: 'graph', trace: true },
),