feat: get the operator type from id #918 (#1323)

### What problem does this PR solve?

feat: get the operator type from id #918

### Type of change

- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2024-07-01 10:27:32 +08:00
committed by GitHub
parent fc7cc1d36c
commit 4542346f18
6 changed files with 521 additions and 15 deletions

View File

@ -5,7 +5,7 @@ import { curry, isEmpty } from 'lodash';
import pipe from 'lodash/fp/pipe';
import { Edge, MarkerType, Node, Position } from 'reactflow';
import { v4 as uuidv4 } from 'uuid';
import { Operator, initialFormValuesMap } from './constant';
import { NodeMap, Operator, initialFormValuesMap } from './constant';
import { NodeData } from './interface';
const buildEdges = (
@ -41,7 +41,7 @@ export const buildNodesAndEdgesFromDSLComponents = (data: DSLComponents) => {
const upstream = [...value.upstream];
nodes.push({
id: key,
type: 'ragNode',
type: NodeMap[value.obj.component_name as Operator] || 'ragNode',
position: { x: 0, y: 0 },
data: {
label: value.obj.component_name,
@ -162,7 +162,3 @@ export const buildDslComponentsByGraph = (
return components;
};
export const getOperatorTypeFromId = (id: string | null) => {
return id?.split(':')[0] as Operator | undefined;
};