feat: add DynamicCategorize #918 (#1273)

### What problem does this PR solve?

feat: add DynamicCategorize #918

### Type of change

- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2024-06-25 16:17:12 +08:00
committed by GitHub
parent f6ae8fcb71
commit 83b91d90fe
9 changed files with 114 additions and 13 deletions

View File

@ -0,0 +1,13 @@
import { Operator } from '../constant';
import useGraphStore from '../store';
// exclude some nodes downstream of the classification node
const excludedNodes = [Operator.Categorize, Operator.Answer, Operator.Begin];
export const useBuildCategorizeToOptions = () => {
const nodes = useGraphStore((state) => state.nodes);
return nodes
.filter((x) => excludedNodes.every((y) => y !== x.data.label))
.map((x) => ({ label: x.id, value: x.id }));
};