Skip to content

Commit f6e04c0

Browse files
committed
small fix for split-string node-type and prep for llm-embeddings flow
1 parent 835f2f4 commit f6e04c0

File tree

2 files changed

+186
-16
lines changed

2 files changed

+186
-16
lines changed

examples-test-flows/openai-embeddings.json

Lines changed: 166 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
"id": "eff7d871-dfe3-47e9-b555-db2f110dc20f",
2626
"x": 2061.301297711772,
2727
"y": -155.57829060801922,
28-
"width": 120.00044953032436,
29-
"height": 56.00000513269601,
28+
"width": 119.99997811083799,
29+
"height": 56.00001051140906,
3030
"nodeType": "Shape",
3131
"nodeInfo": {
3232
"type": "show-input",
@@ -98,8 +98,8 @@
9898
"id": "3b1228b5-33dc-41a1-874b-a39edb778dd1",
9999
"x": 1295.9272852158813,
100100
"y": -340.2895021114527,
101-
"width": 120.00007744282978,
102-
"height": 272.00000499697916,
101+
"width": 119.99997811083799,
102+
"height": 56.00001051140906,
103103
"nodeType": "Shape",
104104
"nodeInfo": {
105105
"type": "show-input",
@@ -125,7 +125,8 @@
125125
"inputType": "number"
126126
},
127127
"showFormOnlyInPopup": true,
128-
"isSettingsPopup": true
128+
"isSettingsPopup": true,
129+
"supportsPreview": true
129130
}
130131
},
131132
{
@@ -198,15 +199,16 @@
198199
"inputType": "number"
199200
},
200201
"showFormOnlyInPopup": true,
201-
"isSettingsPopup": true
202+
"isSettingsPopup": true,
203+
"supportsPreview": true
202204
}
203205
},
204206
{
205207
"id": "40c5332c-ff6b-4fef-9ad3-8718a8d77cb1",
206208
"x": 1297.632412062497,
207209
"y": -11.704693521411087,
208-
"width": 120.00007744282978,
209-
"height": 272.00000499697916,
210+
"width": 119.99997811083799,
211+
"height": 56.00001051140906,
210212
"nodeType": "Shape",
211213
"nodeInfo": {
212214
"type": "show-input",
@@ -218,6 +220,39 @@
218220
"isSettingsPopup": true
219221
}
220222
},
223+
{
224+
"id": "a6d7931c-35dd-49b0-93e6-3917867647ba",
225+
"x": -3.587796927746922,
226+
"y": -740.8892564677036,
227+
"width": 200,
228+
"height": 128,
229+
"nodeType": "Shape",
230+
"nodeInfo": {
231+
"type": "split-string",
232+
"formValues": {
233+
"splitBy": "CRLF"
234+
},
235+
"nodeCannotBeReplaced": false,
236+
"showFormOnlyInPopup": false,
237+
"useInCompositionOnly": false,
238+
"keepPopupOpenAfterUpdate": false
239+
}
240+
},
241+
{
242+
"id": "4e80276b-bc0e-45bb-a3fb-af6e9a2904a4",
243+
"x": -457.3432450729476,
244+
"y": -816.2418075507301,
245+
"width": 199.9921875,
246+
"height": 55,
247+
"nodeType": "Shape",
248+
"nodeInfo": {
249+
"type": "load-text-file",
250+
"showFormOnlyInPopup": true,
251+
"formValues": {
252+
"image": ""
253+
}
254+
}
255+
},
221256
{
222257
"id": "b2c27105-8b44-43e7-b1a5-d93b0c6c3187",
223258
"x": 1956.3881124911093,
@@ -295,7 +330,7 @@
295330
},
296331
{
297332
"id": "abd03e4b-e683-4fdd-abce-039f4265aedc",
298-
"x": 1415.927362658711,
333+
"x": 1415.9272633267192,
299334
"y": -310.2895021114527,
300335
"endX": 1806.3881124911093,
301336
"endY": -137.98375372902578,
@@ -370,7 +405,7 @@
370405
},
371406
{
372407
"id": "c16b1fff-74ce-4b8f-9ae4-ed11a42621ec",
373-
"x": 1417.6324895053267,
408+
"x": 1417.632390173335,
374409
"y": 18.295306478588913,
375410
"endX": 1806.3881124911093,
376411
"endY": -87.98375372902578,
@@ -382,6 +417,127 @@
382417
"nodeType": "Connection",
383418
"layer": 1,
384419
"nodeInfo": {}
420+
},
421+
{
422+
"id": "d0c34e6d-f174-4812-90c8-e2354d154c68",
423+
"x": -257.3510575729476,
424+
"y": -786.2418075507301,
425+
"endX": 554.6188337091417,
426+
"endY": -799.9003774855503,
427+
"startNodeId": "4e80276b-bc0e-45bb-a3fb-af6e9a2904a4",
428+
"endNodeId": "16c9fac7-7273-4776-a34c-d35bbbd2eccb",
429+
"startThumbName": "output",
430+
"endThumbName": "input",
431+
"lineType": "BezierCubic",
432+
"nodeType": "Connection",
433+
"layer": 1,
434+
"nodeInfo": {}
435+
},
436+
{
437+
"id": "16c9fac7-7273-4776-a34c-d35bbbd2eccb",
438+
"x": 554.6188337091417,
439+
"y": -829.9003774855503,
440+
"width": 119.99997811083799,
441+
"height": 272.0000436531471,
442+
"nodeType": "Shape",
443+
"nodeInfo": {
444+
"type": "show-input",
445+
"formValues": {
446+
"name": "",
447+
"data-type": "default"
448+
},
449+
"initializeOnStartFlow": true,
450+
"isSettingsPopup": true,
451+
"taskType": "show-input"
452+
}
453+
},
454+
{
455+
"id": "c5be2913-7a16-4e08-91ed-1b4c66569eb5",
456+
"x": 1289.3974298808444,
457+
"y": -831.8771424755637,
458+
"width": 119.99987447908131,
459+
"height": 56.00001051140906,
460+
"nodeType": "Shape",
461+
"nodeInfo": {
462+
"type": "show-input",
463+
"formValues": {
464+
"name": "",
465+
"data-type": "default"
466+
},
467+
"initializeOnStartFlow": true,
468+
"isSettingsPopup": true,
469+
"taskType": "show-input"
470+
}
471+
},
472+
{
473+
"id": "18523407-4c95-43c6-95e2-995d95e2dafd",
474+
"x": 369.95452161165946,
475+
"y": -529.401995759163,
476+
"width": 267.74996850978164,
477+
"height": 135.9999944421373,
478+
"nodeType": "Shape",
479+
"nodeInfo": {
480+
"type": "register-expression-function-node",
481+
"formValues": {
482+
"customFunctionCode": "(a) => {\n console.log(\"a\",a.length,a);\n return a.length;\n};",
483+
"functionName": "arrayLength"
484+
},
485+
"nodeCannotBeReplaced": true,
486+
"showFormOnlyInPopup": true,
487+
"useInCompositionOnly": false,
488+
"keepPopupOpenAfterUpdate": true,
489+
"isRunOnStart": true,
490+
"taskType": "register-expression-function-node"
491+
}
492+
},
493+
{
494+
"id": "3864a9b1-9985-48a5-aba4-32f02a1b198a",
495+
"x": 866.954809220891,
496+
"y": -840.1717796692637,
497+
"width": 200,
498+
"height": 100,
499+
"nodeType": "Shape",
500+
"nodeInfo": {
501+
"type": "expression",
502+
"formValues": {
503+
"expression": "arrayLength(input)",
504+
"inputType": "number"
505+
},
506+
"showFormOnlyInPopup": true,
507+
"isSettingsPopup": true,
508+
"supportsPreview": true,
509+
"taskType": "expression"
510+
}
511+
},
512+
{
513+
"id": "d34c14af-f57e-4301-8a36-2d7d96434730",
514+
"x": 674.6188118199797,
515+
"y": -799.9003774855503,
516+
"endX": 866.954809220891,
517+
"endY": -790.1717796692637,
518+
"startNodeId": "16c9fac7-7273-4776-a34c-d35bbbd2eccb",
519+
"endNodeId": "3864a9b1-9985-48a5-aba4-32f02a1b198a",
520+
"startThumbName": "output",
521+
"endThumbName": "input",
522+
"lineType": "BezierCubic",
523+
"nodeType": "Connection",
524+
"layer": 1,
525+
"nodeInfo": {}
526+
},
527+
{
528+
"id": "971107d8-b1d0-4a6d-bd1c-a1544bfcff27",
529+
"x": 1066.954809220891,
530+
"y": -790.1717796692637,
531+
"endX": 1289.3974298808444,
532+
"endY": -801.8771424755637,
533+
"startNodeId": "3864a9b1-9985-48a5-aba4-32f02a1b198a",
534+
"endNodeId": "c5be2913-7a16-4e08-91ed-1b4c66569eb5",
535+
"startThumbName": "output",
536+
"endThumbName": "input",
537+
"lineType": "BezierCubic",
538+
"nodeType": "Connection",
539+
"layer": 1,
540+
"nodeInfo": {}
385541
}
386542
]
387543
}

libs/web-flow-executor/src/nodes/split-string.ts

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const splitString: NodeTaskFactory<NodeInfo> = (
2121
return;
2222
};
2323
const compute = (input: string, _loopIndex?: number, _payload?: any) => {
24-
const splitBy = node?.nodeInfo?.formValues?.[fieldName] ?? '';
24+
let splitBy = node?.nodeInfo?.formValues?.[fieldName] ?? '';
2525
if (!splitBy) {
2626
const array = Array.from(input);
2727
return {
@@ -30,7 +30,20 @@ export const splitString: NodeTaskFactory<NodeInfo> = (
3030
followPath: undefined,
3131
};
3232
}
33-
const splitLines = input.trim().split(splitBy);
33+
if (splitBy.toUpperCase() === 'SPACE') {
34+
splitBy = ' ';
35+
} else if (splitBy.toUpperCase() === 'COMMA') {
36+
splitBy = ',';
37+
} else if (splitBy.toUpperCase() === 'NEWLINE') {
38+
splitBy = '\n';
39+
} else if (splitBy.toUpperCase() === 'TAB') {
40+
splitBy = '\t';
41+
} else if (splitBy.toUpperCase() === 'PIPE') {
42+
splitBy = '|';
43+
} else if (splitBy.toUpperCase() === 'CRKF') {
44+
splitBy = '\r\n';
45+
}
46+
const splitLines = (input ?? '').toString().trim().split(splitBy);
3447

3548
if (splitLines) {
3649
return {
@@ -73,17 +86,18 @@ export const splitString: NodeTaskFactory<NodeInfo> = (
7386
connectionType: ThumbConnectionType.end,
7487
color: 'white',
7588
label: ' ',
76-
thumbConstraint: thumbConstraints.value,
89+
//thumbConstraint: thumbConstraints.value,
7790
},
7891
],
7992
(values?: InitialValues) => {
8093
const formElements = [
8194
{
8295
fieldType: FormFieldType.Text,
8396
fieldName: fieldName,
97+
label: 'Split by',
8498
value: values?.[fieldName] ?? '',
8599
settings: {
86-
showLabel: false,
100+
showLabel: true,
87101
},
88102
onChange: (value: string) => {
89103
if (!node.nodeInfo) {
@@ -101,8 +115,8 @@ export const splitString: NodeTaskFactory<NodeInfo> = (
101115
];
102116
return formElements;
103117
},
104-
(_nodeInstance) => {
105-
//
118+
(nodeInstance) => {
119+
node = nodeInstance.node as IRectNodeComponent<NodeInfo>;
106120
},
107121
{
108122
category: 'string',

0 commit comments

Comments
 (0)