mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-25 16:26:51 +08:00
### 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:
@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user