Skip to content

Commit 899acac

Browse files
author
昔梦
committed
feat:新增并行节点
1 parent 62312b3 commit 899acac

File tree

12 files changed

+647
-5
lines changed

12 files changed

+647
-5
lines changed
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
import XFlow from '@xrenders/xflow';
2+
import settings from './setting';
3+
import React from 'react'
4+
5+
export default () => {
6+
const nodes = [
7+
{
8+
type: 'Start',
9+
10+
id: '1',
11+
position: {
12+
x: -40,
13+
y: 217.02097759552555,
14+
},
15+
},
16+
{
17+
type: 'End',
18+
position:{
19+
"x": 733,
20+
"y": 70
21+
},
22+
id: '2',
23+
},
24+
{
25+
id: 'qga2pm66shrcn0ir',
26+
position: {
27+
"x": 320,
28+
"y": 228
29+
},
30+
type: 'Parallel',
31+
data: {
32+
list: [
33+
{
34+
value: '并行事件1',
35+
},
36+
{
37+
value: '并行事件2',
38+
},
39+
],
40+
},
41+
},
42+
{
43+
id: 'z0ps4v0c8xkvuu5c',
44+
position: {
45+
"x": 640,
46+
"y": 461
47+
},
48+
type: 'Code',
49+
},
50+
];
51+
52+
const edges = [
53+
{
54+
source: '1',
55+
target: 'qga2pm66shrcn0ir',
56+
id: 'xy-edge__1-qga2pm66shrcn0ir',
57+
},
58+
{
59+
source: 'qga2pm66shrcn0ir',
60+
sourceHandle: 'id_0',
61+
target: '2',
62+
id: 'xy-edge__qga2pm66shrcn0irid_0-2',
63+
},
64+
{
65+
source: 'qga2pm66shrcn0ir',
66+
sourceHandle: 'id_1',
67+
target: 'z0ps4v0c8xkvuu5c',
68+
id: 'xy-edge__qga2pm66shrcn0irid_1-z0ps4v0c8xkvuu5c',
69+
},
70+
{
71+
source: 'z0ps4v0c8xkvuu5c',
72+
target: '2',
73+
id: 'xy-edge__z0ps4v0c8xkvuu5c-2',
74+
},
75+
];
76+
77+
return (
78+
<div style={{ height: '600px' }}>
79+
<XFlow
80+
initialValues={{ nodes, edges }}
81+
settings={settings}
82+
nodeSelector={{
83+
showSearch: true,
84+
}}
85+
/>
86+
</div>
87+
);
88+
};
Lines changed: 308 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,308 @@
1+
export default [
2+
{
3+
title: '开始',
4+
type: 'Start',
5+
hidden: true,
6+
targetHandleHidden: true,
7+
icon: {
8+
type: 'icon-start',
9+
bgColor: '#17B26A',
10+
},
11+
settingSchema: {
12+
type: 'object',
13+
properties: {
14+
input: {
15+
title: '变量一',
16+
type: 'string',
17+
widget: 'input',
18+
},
19+
select: {
20+
title: '变量二',
21+
type: 'string',
22+
widget: 'select',
23+
props: {
24+
options: [
25+
{ label: 'a', value: 'a' },
26+
{ label: 'b', value: 'b' },
27+
{ label: 'c', value: 'c' },
28+
],
29+
},
30+
},
31+
radio1: {
32+
title: '点击单选',
33+
type: 'string',
34+
widget: 'radio',
35+
props: {
36+
options: [
37+
{ label: '早', value: 'a' },
38+
{ label: '中', value: 'b' },
39+
{ label: '晚', value: 'c' }
40+
]
41+
}
42+
},
43+
textarea1: {
44+
title: '长文本',
45+
type: 'string',
46+
widget: 'textArea'
47+
},
48+
date1: {
49+
title: '日期选择',
50+
type: 'string',
51+
widget: 'datePicker'
52+
},
53+
dateRange1: {
54+
title: '日期范围',
55+
type: 'range',
56+
widget: 'dateRange'
57+
},
58+
time1: {
59+
title: '时间选择',
60+
type: 'string',
61+
widget: 'timePicker'
62+
},
63+
timeRange1: {
64+
title: '时间范围',
65+
type: 'range',
66+
widget: 'timeRange'
67+
},
68+
},
69+
},
70+
},
71+
{
72+
title: '结束',
73+
type: 'End',
74+
hidden: true,
75+
sourceHandleHidden: true,
76+
icon: {
77+
type: 'icon-end',
78+
bgColor: '#F79009',
79+
},
80+
settingSchema: {
81+
type: "object",
82+
properties: {
83+
input: {
84+
title: '变量一',
85+
type: 'string',
86+
widget: 'input',
87+
},
88+
select: {
89+
title: '变量二',
90+
type: 'string',
91+
widget: 'select',
92+
props: {
93+
options: [
94+
{ label: 'a', value: 'a' },
95+
{ label: 'b', value: 'b' },
96+
{ label: 'c', value: 'c' },
97+
],
98+
},
99+
},
100+
}
101+
}
102+
},
103+
{
104+
title: 'Parallel',
105+
type: 'Parallel',
106+
description: '并行节点',
107+
icon: {
108+
type: 'icon-parallel',
109+
bgColor: '#06AED4',
110+
},
111+
},
112+
{
113+
title: 'LLM',
114+
type: 'LLM',
115+
description: '调用大语言模型回答问题或者对自然语言进行处理',
116+
icon: {
117+
type: 'icon-model',
118+
bgColor: '#6172F3',
119+
},
120+
settingSchema: {
121+
type: "object",
122+
properties: {
123+
input: {
124+
title: '变量一',
125+
type: 'string',
126+
widget: 'input',
127+
},
128+
}
129+
}
130+
},
131+
{
132+
title: 'Prompt',
133+
type: 'Prompt',
134+
description: '通过精心设计提示词,提升大语言模型回答效果',
135+
icon: {
136+
type: 'icon-prompt',
137+
bgColor: '#17B26A',
138+
},
139+
settingSchema: {
140+
type: "object",
141+
properties: {
142+
input: {
143+
title: '变量一',
144+
type: 'string',
145+
widget: 'input',
146+
},
147+
}
148+
}
149+
},
150+
{
151+
title: '知识库',
152+
type: 'knowledge',
153+
description: '允许你从知识库中查询与用户问题相关的文本内容',
154+
icon: {
155+
type: 'icon-knowledge',
156+
bgColor: '#6172F3',
157+
},
158+
settingSchema: {
159+
type: "object",
160+
properties: {
161+
input: {
162+
title: '变量一',
163+
type: 'string',
164+
widget: 'input',
165+
},
166+
}
167+
}
168+
},
169+
{
170+
title: 'Switch',
171+
type: 'Switch',
172+
description: '允许你根据 if/else 条件将 workflow 拆分成两个分支',
173+
icon: {
174+
type: 'icon-fenzhi',
175+
bgColor: '#06AED4',
176+
},
177+
settingSchema: {
178+
type: "object",
179+
properties: {
180+
input: {
181+
title: '变量一',
182+
type: 'string',
183+
widget: 'input',
184+
},
185+
}
186+
}
187+
},
188+
{
189+
title: 'HSF',
190+
type: 'hsf',
191+
description: '允许通过 HSF 协议发送服务器请求',
192+
icon: {
193+
type: 'icon-hsf',
194+
bgColor: '#875BF7',
195+
},
196+
settingSchema: {
197+
type: "object",
198+
properties: {
199+
input: {
200+
title: '变量一',
201+
type: 'string',
202+
widget: 'input',
203+
},
204+
}
205+
}
206+
},
207+
{
208+
title: 'Http',
209+
type: 'http',
210+
description: '允许通过 HTTP 协议发送服务器请求',
211+
icon: {
212+
type: 'icon-http',
213+
bgColor: '#875BF7',
214+
},
215+
settingSchema: {
216+
type: "object",
217+
properties: {
218+
input: {
219+
title: '变量一',
220+
type: 'string',
221+
widget: 'input',
222+
},
223+
}
224+
}
225+
},
226+
{
227+
title: '代码执行',
228+
type: 'Code',
229+
description: '执行一段 Groovy 或 Python 或 NodeJS 代码实现自定义逻辑',
230+
icon: {
231+
type: 'icon-code',
232+
bgColor: '#2E90FA',
233+
},
234+
settingSchema: {
235+
type: "object",
236+
properties: {
237+
input: {
238+
title: '变量一',
239+
type: 'string',
240+
widget: 'input',
241+
},
242+
}
243+
}
244+
},
245+
{
246+
title: '工具',
247+
type: 'tool',
248+
description: '允许使用工具能力',
249+
icon: {
250+
type: 'icon-gongju',
251+
bgColor: '#2E90FA',
252+
},
253+
settingSchema: {
254+
type: "object",
255+
properties: {
256+
input: {
257+
title: '变量一',
258+
type: 'string',
259+
widget: 'input',
260+
},
261+
}
262+
}
263+
},
264+
{
265+
title: '工具',
266+
type: '_group',
267+
items: [
268+
{
269+
title: '代码执行',
270+
type: 'Code',
271+
description: '执行一段 Groovy 或 Python 或 NodeJS 代码实现自定义逻辑',
272+
icon: {
273+
type: 'icon-code',
274+
bgColor: '#2E90FA',
275+
},
276+
settingSchema: {
277+
type: "object",
278+
properties: {
279+
input: {
280+
title: '变量一',
281+
type: 'string',
282+
widget: 'input',
283+
},
284+
}
285+
}
286+
},
287+
{
288+
title: '工具',
289+
type: 'tool',
290+
description: '允许使用工具能力',
291+
icon: {
292+
type: 'icon-gongju',
293+
bgColor: '#2E90FA',
294+
},
295+
settingSchema: {
296+
type: "object",
297+
properties: {
298+
input: {
299+
title: '变量一',
300+
type: 'string',
301+
widget: 'input',
302+
},
303+
}
304+
}
305+
},
306+
],
307+
},
308+
];

0 commit comments

Comments
 (0)