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

@ -159,7 +159,7 @@ function buildAgentTools(edges: Edge[], nodes: Node[], nodeId: string) {
return {
component_name: Operator.Agent,
id,
name,
name: name as string, // Cast name to string and provide fallback
params: { ...formData },
};
}),
@ -172,27 +172,29 @@ function filterTargetsBySourceHandleId(edges: Edge[], handleId: string) {
return edges.filter((x) => x.sourceHandle === handleId).map((x) => x.target);
}
function buildCategorizeTos(edges: Edge[], nodes: Node[], nodeId: string) {
function buildCategorize(edges: Edge[], nodes: Node[], nodeId: string) {
const node = nodes.find((x) => x.id === nodeId);
const params = { ...(node?.data.form ?? {}) } as ICategorizeForm;
if (node && node.data.label === Operator.Categorize) {
const subEdges = edges.filter((x) => x.source === nodeId);
const categoryDescription = params.category_description || {};
const items = params.items || [];
const nextCategoryDescription = Object.entries(categoryDescription).reduce<
const nextCategoryDescription = items.reduce<
ICategorizeForm['category_description']
>((pre, [key, val]) => {
>((pre, val) => {
const key = val.name;
pre[key] = {
...val,
to: filterTargetsBySourceHandleId(subEdges, key),
...omit(val, 'name', 'uuid'),
examples: val.examples?.map((x) => x.value) || [],
to: filterTargetsBySourceHandleId(subEdges, val.uuid),
};
return pre;
}, {});
params.category_description = nextCategoryDescription;
}
return params;
return omit(params, 'items');
}
const buildOperatorParams = (operatorName: string) =>
@ -236,7 +238,7 @@ export const buildDslComponentsByGraph = (
break;
}
case Operator.Categorize:
params = buildCategorizeTos(edges, nodes, id);
params = buildCategorize(edges, nodes, id);
break;
default: