mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### What problem does this PR solve? feat: Build options for the component id field of the Switch operator #1739 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -563,3 +563,26 @@ export const useWatchNodeFormDataChange = () => {
|
||||
buildSwitchEdgesByFormData,
|
||||
]);
|
||||
};
|
||||
|
||||
// exclude nodes with branches
|
||||
const ExcludedNodes = [
|
||||
Operator.Categorize,
|
||||
Operator.Relevant,
|
||||
Operator.Begin,
|
||||
Operator.Answer,
|
||||
];
|
||||
|
||||
export const useBuildComponentIdSelectOptions = (nodeId?: string) => {
|
||||
const nodes = useGraphStore((state) => state.nodes);
|
||||
|
||||
const options = useMemo(() => {
|
||||
return nodes
|
||||
.filter(
|
||||
(x) =>
|
||||
x.id !== nodeId && !ExcludedNodes.some((y) => y === x.data.label),
|
||||
)
|
||||
.map((x) => ({ label: x.data.name, value: x.id }));
|
||||
}, [nodes, nodeId]);
|
||||
|
||||
return options;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user