Skip to content

Commit 6e4ce4c

Browse files
committed
scoped variable improvements
1 parent f676136 commit 6e4ce4c

File tree

3 files changed

+50
-41
lines changed

3 files changed

+50
-41
lines changed

examples-test-flows/openai-fetch-completion-as-stream-with-toolcall.json

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@
4444
},
4545
{
4646
"id": "d186a002-218b-47dc-aae8-07522a3da6ed",
47-
"x": 4483.127557710089,
48-
"y": 1053.7416050816996,
49-
"width": 120.00005631995279,
50-
"height": 55.99999584447307,
47+
"x": 4483.128089787184,
48+
"y": 1055.631264357424,
49+
"width": 119.99994892943876,
50+
"height": 271.9999476823221,
5151
"nodeType": "Shape",
5252
"nodeInfo": {
5353
"type": "show-input",
@@ -63,8 +63,8 @@
6363
"id": "383eb9cf-3b45-489e-8281-720b702b9159",
6464
"x": 3302.618503441852,
6565
"y": 529.4952407721033,
66-
"width": 120.00005631995279,
67-
"height": 108.0000164450145,
66+
"width": 240.00003417791402,
67+
"height": 216.00004186971287,
6868
"nodeType": "Shape",
6969
"nodeInfo": {
7070
"type": "scope-variable",
@@ -203,8 +203,8 @@
203203
"id": "b936e1cd-134c-4476-b412-342c7d89c762",
204204
"x": 5386.76078539173,
205205
"y": 1471.9176827094705,
206-
"width": 120.00005631995279,
207-
"height": 55.99999584447307,
206+
"width": 120.00001708895701,
207+
"height": 103.99998518485536,
208208
"nodeType": "Shape",
209209
"nodeInfo": {
210210
"type": "show-input",
@@ -236,8 +236,8 @@
236236
},
237237
{
238238
"id": "6631fbab-1a06-4f8e-9abc-ee8ac2c3f923",
239-
"x": 2179.535054083234,
240-
"y": 1038.141199304024,
239+
"x": 2179.535249615978,
240+
"y": 1039.0974158395657,
241241
"width": 434.54733649065247,
242242
"height": 185.8378093625031,
243243
"nodeType": "Shape",
@@ -255,10 +255,10 @@
255255
},
256256
{
257257
"id": "6e164a19-962b-412d-ad81-8505dcc24783",
258-
"x": 3750.2931677583306,
259-
"y": 557.7131314862974,
260-
"width": 120.00005631995279,
261-
"height": 108.0000164450145,
258+
"x": 3750.292871193505,
259+
"y": 557.7131389156825,
260+
"width": 240.00003417791402,
261+
"height": 144.00000939715815,
262262
"nodeType": "Shape",
263263
"nodeInfo": {
264264
"type": "scope-variable",
@@ -421,7 +421,7 @@
421421
"useExpression": true,
422422
"case1": "hasContent(choices[0].delta)",
423423
"case2": "isCallTool(choices[0].delta)",
424-
"case3": "isCallToolParameters(choices[0].delta)"
424+
"case3": "isCallToolParameters(choices[0].delta) && isToolCall(tool)"
425425
},
426426
"showFormOnlyInPopup": false,
427427
"hasNoFormPopup": true,
@@ -485,10 +485,10 @@
485485
},
486486
{
487487
"id": "597efff5-91e1-40f2-bd4d-993567abb93a",
488-
"x": 4136.596628175566,
489-
"y": 525.8274531461741,
490-
"width": 120.00005631995279,
491-
"height": 108.0000164450145,
488+
"x": 4136.596689010678,
489+
"y": 525.8275219295643,
490+
"width": 120.00013253873077,
491+
"height": 108.00000116087155,
492492
"nodeType": "Shape",
493493
"nodeInfo": {
494494
"type": "scope-variable",
@@ -584,7 +584,7 @@
584584
"x": 6229.851452752843,
585585
"y": 982.5117711628676,
586586
"width": 200,
587-
"height": 128,
587+
"height": 127.99993896484375,
588588
"nodeType": "Shape",
589589
"nodeInfo": {
590590
"type": "set-variable",
@@ -723,10 +723,10 @@
723723
},
724724
{
725725
"id": "f02b98f8-d7be-40ec-82da-0fcaddda5663",
726-
"x": 6021.410911217391,
727-
"y": 2274.2595061883017,
728-
"width": 120.00005631995279,
729-
"height": 55.99999584447307,
726+
"x": 6021.410858818388,
727+
"y": 2273.5351450129733,
728+
"width": 120.00001708895701,
729+
"height": 272.00020908202,
730730
"nodeType": "Shape",
731731
"nodeInfo": {
732732
"type": "show-input",
@@ -742,8 +742,8 @@
742742
"id": "a16c5c54-c867-41af-a922-9a014786c513",
743743
"x": 4288.402495467255,
744744
"y": 1035.8785419019923,
745-
"endX": 4483.127557710089,
746-
"endY": 1083.7416050816996,
745+
"endX": 4483.128089787184,
746+
"endY": 1085.631264357424,
747747
"startNodeId": "8f4ac174-5c8e-45da-8ad4-a81a40f4f666",
748748
"endNodeId": "d186a002-218b-47dc-aae8-07522a3da6ed",
749749
"startThumbName": "output",
@@ -755,8 +755,8 @@
755755
},
756756
{
757757
"id": "9c9efadf-8473-439f-849b-1fa8cbc09ad5",
758-
"x": 4603.1276140300415,
759-
"y": 1083.7416050816996,
758+
"x": 4603.1280387166225,
759+
"y": 1085.631264357424,
760760
"endX": 4762.8962698236355,
761761
"endY": 1116.0163345637106,
762762
"startNodeId": "d186a002-218b-47dc-aae8-07522a3da6ed",
@@ -860,8 +860,8 @@
860860
},
861861
{
862862
"id": "3601f5bf-09f9-401d-b7de-28d1be639fb5",
863-
"x": 2614.0823905738866,
864-
"y": 1117.141199304024,
863+
"x": 2614.0825861066305,
864+
"y": 1118.0974158395657,
865865
"endX": 2886.530679091066,
866866
"endY": 1127.7022502825994,
867867
"startNodeId": "6631fbab-1a06-4f8e-9abc-ee8ac2c3f923",
@@ -890,7 +890,7 @@
890890
},
891891
{
892892
"id": "7619188f-269f-46a1-b144-d641b411a547",
893-
"x": 5506.760841711683,
893+
"x": 5506.760802480687,
894894
"y": 1501.9176827094705,
895895
"endX": 5660.339934319284,
896896
"endY": 1508.1553278560464,
@@ -950,8 +950,8 @@
950950
},
951951
{
952952
"id": "000e9d47-dfae-4e6e-a9b9-32ccb2eeb6f4",
953-
"x": 2614.0823905738866,
954-
"y": 1117.141199304024,
953+
"x": 2614.0825861066305,
954+
"y": 1118.0974158395657,
955955
"endX": 2864.01552290941,
956956
"endY": 1340.7535959916072,
957957
"startNodeId": "6631fbab-1a06-4f8e-9abc-ee8ac2c3f923",
@@ -1073,7 +1073,7 @@
10731073
"x": 6074.434653632948,
10741074
"y": 1044.742694970008,
10751075
"endX": 6229.851452752843,
1076-
"endY": 1046.5117711628677,
1076+
"endY": 1046.5117406452896,
10771077
"startNodeId": "c21fde5d-4990-4dcf-964e-3fa5a8688b38",
10781078
"endNodeId": "6522fcb7-a5b2-4d1f-be09-5796cb78e018",
10791079
"startThumbName": "output",
@@ -1162,8 +1162,8 @@
11621162
"id": "45b89ff9-cea6-4ddd-85ed-f1925f7f1730",
11631163
"x": 5768.971508916734,
11641164
"y": 2299.7993271591404,
1165-
"endX": 6021.410911217391,
1166-
"endY": 2304.2595061883017,
1165+
"endX": 6021.410858818388,
1166+
"endY": 2303.5351450129733,
11671167
"startNodeId": "9cfbb4cf-59ea-40ae-898e-d232d139b3c4",
11681168
"endNodeId": "f02b98f8-d7be-40ec-82da-0fcaddda5663",
11691169
"startThumbName": "output",

libs/visual-programming-system/src/utils/getFormattedValue.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ export const getFormattedVariableValue = (
2626
if (typeof value === 'number') {
2727
return `${(value as number).toFixed(decimalCount)}${appendText}`;
2828
} else if (typeof value === 'string') {
29-
return `${value}${appendText}`;
29+
return `${value}${appendText}` || '-';
3030
} else {
31-
return `${(value as any).toString()}${appendText}`;
31+
return `${(value as any).toString()}${appendText}` || '-';
3232
}
3333
return '-';
3434
};

libs/web-flow-executor/src/nodes/scoped-variable.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -936,8 +936,8 @@ export const getScopedVariable =
936936
rect = canvasApp.createRect(
937937
x,
938938
y,
939-
100,
940-
100,
939+
150,
940+
200,
941941
undefined,
942942
[],
943943
componentWrapper,
@@ -969,12 +969,21 @@ export const getScopedVariable =
969969
'div',
970970
{
971971
class:
972-
'absolute top-0 left-0 bg-slate-700 text-white px-1 rounded -translate-y-2/4 translate-x-1 whitespace-nowrap',
972+
'absolute flex flex-row gap-2 items-center top-0 left-0 bg-slate-700 text-white px-1 rounded -translate-y-2/4 translate-x-1 whitespace-nowrap',
973973
},
974974
rect.nodeComponent?.domElement as unknown as HTMLElement,
975975
variableName
976976
) as unknown as INodeComponent<NodeInfo>;
977977

978+
createElement(
979+
'div',
980+
{
981+
class: 'block order-first text-white icon icon-all_inbox',
982+
},
983+
tagNode?.domElement as unknown as HTMLElement,
984+
undefined
985+
) as unknown as INodeComponent<NodeInfo>;
986+
978987
node = rect.nodeComponent;
979988

980989
if (node.nodeInfo) {

0 commit comments

Comments
 (0)