Skip to content

Commit 8618adc

Browse files
committed
small tweaks to array variable and openai flow
1 parent c4abe44 commit 8618adc

File tree

3 files changed

+52
-39
lines changed

3 files changed

+52
-39
lines changed

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

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
},
2727
{
2828
"id": "3cf44538-9913-4aa2-aade-a7c619910f45",
29-
"x": 2885.951639601829,
30-
"y": 1081.5205098352317,
31-
"width": 178.8125,
29+
"x": 2887.5718169151805,
30+
"y": 1081.520535336577,
31+
"width": 178.5078125,
3232
"height": 80,
3333
"nodeType": "Shape",
3434
"nodeInfo": {
@@ -46,8 +46,8 @@
4646
"id": "d186a002-218b-47dc-aae8-07522a3da6ed",
4747
"x": 4483.009756940378,
4848
"y": 1009.3019209291535,
49-
"width": 119.99988085213484,
50-
"height": 272.00008303849967,
49+
"width": 120.00007622353782,
50+
"height": 272.0001093260645,
5151
"nodeType": "Shape",
5252
"nodeInfo": {
5353
"type": "show-input",
@@ -63,8 +63,8 @@
6363
"id": "383eb9cf-3b45-489e-8281-720b702b9159",
6464
"x": 3432.5612033082357,
6565
"y": 115.23188115191351,
66-
"width": 134.79682943708278,
67-
"height": 300.00001109895686,
66+
"width": 136.6721573559701,
67+
"height": 179.99997929781577,
6868
"nodeType": "Shape",
6969
"nodeInfo": {
7070
"type": "scope-variable",
@@ -131,7 +131,7 @@
131131
"id": "604d00b5-69c4-4beb-8aca-394674de0d61",
132132
"x": 2271.125446852334,
133133
"y": 2443.313810875826,
134-
"width": 256.28125,
134+
"width": 260.03125,
135135
"height": 136,
136136
"nodeType": "Shape",
137137
"nodeInfo": {
@@ -187,8 +187,8 @@
187187
"id": "b936e1cd-134c-4476-b412-342c7d89c762",
188188
"x": 5386.760673284272,
189189
"y": 1453.0422559463495,
190-
"width": 120.00023395912888,
191-
"height": 271.99999476175117,
190+
"width": 120.00039345997722,
191+
"height": 56.000162465560074,
192192
"nodeType": "Shape",
193193
"nodeInfo": {
194194
"type": "show-input",
@@ -220,8 +220,8 @@
220220
},
221221
{
222222
"id": "6631fbab-1a06-4f8e-9abc-ee8ac2c3f923",
223-
"x": 2179.5351124795216,
224-
"y": 1044.7199328631427,
223+
"x": 2179.535144410175,
224+
"y": 1044.72003035068,
225225
"width": 434.54733649065247,
226226
"height": 185.8378093625031,
227227
"nodeType": "Shape",
@@ -241,8 +241,8 @@
241241
"id": "6e164a19-962b-412d-ad81-8505dcc24783",
242242
"x": 3704.108661886171,
243243
"y": 119.86193279391406,
244-
"width": 134.79682943708278,
245-
"height": 372.00007202536057,
244+
"width": 136.67180282346746,
245+
"height": 276.00014359049305,
246246
"nodeType": "Shape",
247247
"nodeInfo": {
248248
"type": "scope-variable",
@@ -376,7 +376,7 @@
376376
"id": "160fd17b-6dab-44df-ac4f-2073e89a995f",
377377
"x": 2609.829233433685,
378378
"y": 2446.9818600634853,
379-
"width": 225.375,
379+
"width": 234.0546875,
380380
"height": 136,
381381
"nodeType": "Shape",
382382
"nodeInfo": {
@@ -416,7 +416,7 @@
416416
"id": "ff2152e5-a94a-4350-b595-e619d5ccaa61",
417417
"x": 3222.972106283653,
418418
"y": 2565.125260492554,
419-
"width": 225.375,
419+
"width": 234.0546875,
420420
"height": 136,
421421
"nodeType": "Shape",
422422
"nodeInfo": {
@@ -471,8 +471,8 @@
471471
"id": "597efff5-91e1-40f2-bd4d-993567abb93a",
472472
"x": 3974.168193064425,
473473
"y": 150.3145919802341,
474-
"width": 117.70311895430847,
475-
"height": 107.99998273871567,
474+
"width": 186.83573761583273,
475+
"height": 83.99985121372731,
476476
"nodeType": "Shape",
477477
"nodeInfo": {
478478
"type": "scope-variable",
@@ -510,7 +510,7 @@
510510
"id": "00ba66f5-4918-4ec8-a5f9-1aaa4a61ae6e",
511511
"x": 3225.0022363539265,
512512
"y": 2749.4773409190907,
513-
"width": 414.9375,
513+
"width": 417.0390625,
514514
"height": 136,
515515
"nodeType": "Shape",
516516
"nodeInfo": {
@@ -547,7 +547,7 @@
547547
"id": "8e10a4f8-45d2-40b5-a8d6-53b5fa3ff2fb",
548548
"x": 3211.274441980975,
549549
"y": 2928.1770533946383,
550-
"width": 366.296875,
550+
"width": 360.578125,
551551
"height": 136,
552552
"nodeType": "Shape",
553553
"nodeInfo": {
@@ -599,15 +599,15 @@
599599
},
600600
{
601601
"id": "a1b1b5b0-c32b-4ba0-92f6-f0fc62570e5f",
602-
"x": 4005.3929368958507,
603-
"y": 2741.7234631710567,
604-
"width": 555.124755859375,
602+
"x": 4005.3929990972306,
603+
"y": 2741.7233854722363,
604+
"width": 553.288818359375,
605605
"height": 136,
606606
"nodeType": "Shape",
607607
"nodeInfo": {
608608
"type": "register-expression-function-node",
609609
"formValues": {
610-
"customFunctionCode": "(a) => {\n const result = a != \"\" &&\n typeof a == \"string\" &&\n typeof a != \"number\" &&\n a != 0 &&\n a != undefined && \n a != null;\n console.log(\"istool\", a, result);\n return result;\n};",
610+
"customFunctionCode": "(a) => {\n const result = a != \"\" &&\n typeof a == \"string\" &&\n typeof a != \"number\" &&\n a == \"get_current_weather\" &&\n a != undefined && \n a != null; \n return result;\n};",
611611
"functionName": "isGetCurrentWeatherToolCall"
612612
},
613613
"nodeCannotBeReplaced": true,
@@ -709,8 +709,8 @@
709709
"id": "f02b98f8-d7be-40ec-82da-0fcaddda5663",
710710
"x": 7103.127550404835,
711711
"y": 2409.6998600641537,
712-
"width": 119.99988085213484,
713-
"height": 271.99990648500267,
712+
"width": 120.00039345997722,
713+
"height": 272.0001093260645,
714714
"nodeType": "Shape",
715715
"nodeInfo": {
716716
"type": "show-input",
@@ -827,7 +827,7 @@
827827
},
828828
{
829829
"id": "9c9efadf-8473-439f-849b-1fa8cbc09ad5",
830-
"x": 4603.009637792513,
830+
"x": 4603.009833163916,
831831
"y": 1039.3019209291535,
832832
"endX": 4808.82988279589,
833833
"endY": 1032.15973144007,
@@ -902,10 +902,10 @@
902902
},
903903
{
904904
"id": "3601f5bf-09f9-401d-b7de-28d1be639fb5",
905-
"x": 2614.082448970174,
906-
"y": 1123.7199328631427,
907-
"endX": 2885.951639601829,
908-
"endY": 1121.5205098352317,
905+
"x": 2614.0824809008272,
906+
"y": 1123.72003035068,
907+
"endX": 2887.5718169151805,
908+
"endY": 1121.520535336577,
909909
"startNodeId": "6631fbab-1a06-4f8e-9abc-ee8ac2c3f923",
910910
"endNodeId": "3cf44538-9913-4aa2-aade-a7c619910f45",
911911
"startThumbName": "output",
@@ -917,8 +917,8 @@
917917
},
918918
{
919919
"id": "993273ac-60cc-4c0b-9f50-31b62d6ec3f0",
920-
"x": 3064.764139601829,
921-
"y": 1121.5205098352317,
920+
"x": 3066.0796294151805,
921+
"y": 1121.520535336577,
922922
"endX": 3286.817011462188,
923923
"endY": 1119.1708983882722,
924924
"startNodeId": "3cf44538-9913-4aa2-aade-a7c619910f45",
@@ -932,7 +932,7 @@
932932
},
933933
{
934934
"id": "7619188f-269f-46a1-b144-d641b411a547",
935-
"x": 5506.760907243402,
935+
"x": 5506.76106674425,
936936
"y": 1483.0422559463495,
937937
"endX": 5725.337982593981,
938938
"endY": 1685.1782664011737,
@@ -992,8 +992,8 @@
992992
},
993993
{
994994
"id": "000e9d47-dfae-4e6e-a9b9-32ccb2eeb6f4",
995-
"x": 2614.082448970174,
996-
"y": 1123.7199328631427,
995+
"x": 2614.0824809008272,
996+
"y": 1123.72003035068,
997997
"endX": 2864.01552290941,
998998
"endY": 1340.7535959916072,
999999
"startNodeId": "6631fbab-1a06-4f8e-9abc-ee8ac2c3f923",
@@ -1232,7 +1232,7 @@
12321232
},
12331233
{
12341234
"id": "aa63fd0c-c4ee-46b8-abd4-d6d2d6c142c2",
1235-
"x": 7223.12743125697,
1235+
"x": 7223.127943864813,
12361236
"y": 2439.6998600641537,
12371237
"endX": 7514.403158840748,
12381238
"endY": 2444.619283380733,

libs/visual-programming-system/src/components/rect.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,7 @@ export class Rect<T extends BaseNodeInfo> {
930930
};
931931
let autoSizeClasses = '';
932932
if (this.autSizeToContentIfNodeHasNoThumbs) {
933-
autoSizeClasses = 'w-[min-content] h-[min-content]';
933+
autoSizeClasses = 'w-[fit-content] h-[min-content]';
934934
}
935935
const rectContainerElement = createNodeElement(
936936
'div',

libs/web-flow-executor/src/nodes/data-viewers/array.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
import { IElementNode } from '@devhelpr/visual-programming-system';
22
import { NodeInfo } from '../../types/node-info';
33

4+
function getStringForObject(object: Record<string, any>) {
5+
let data = '';
6+
for (const [key, value] of Object.entries(object)) {
7+
data += `<div class="flex flex-row gap-2">
8+
<div class="flex-grow text-left font-bold">${key}</div>
9+
<div class="flex-grow text-right">${value}</div>
10+
</div>`;
11+
}
12+
return data;
13+
}
14+
415
function createArrayView(
516
array: any[],
617
htmlNode: IElementNode<NodeInfo>,
@@ -13,13 +24,15 @@ function createArrayView(
1324
if (index >= pageIndex * pageSize && index < (pageIndex + 1) * pageSize) {
1425
return `
1526
<div class="flex flex-row justify-start text-left">
16-
<div class="flex-grow overflow-hidden text-ellipsis">${
27+
<div class="flex-row flex flex-grow gap-4 overflow-hidden text-ellipsis">${
1728
typeof data === 'number'
1829
? data.toFixed(2)
1930
: Array.isArray(data)
2031
? data.map((item) => {
2132
return typeof item === 'number' ? item.toFixed(2) : item;
2233
})
34+
: typeof data === 'object'
35+
? getStringForObject(data)
2336
: data
2437
}</div>
2538
</div>`;

0 commit comments

Comments
 (0)