Skip to content

Commit 0382579

Browse files
committed
be able to inspect last execution of json-node and show input/output (not yet attached to timeline store)
1 parent 937f55c commit 0382579

File tree

4 files changed

+39
-10
lines changed

4 files changed

+39
-10
lines changed

apps/vps-web/src/main.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ if (url.pathname === '/run-flow') {
4747
container = document.getElementById(
4848
`${formId}_${formField.fieldName}__html`
4949
);
50-
const popupContainer = document.getElementById('textAreaContainer');
50+
const popupContainer = document.querySelector(
51+
`[id='${formId}_${formField.fieldName}'].code-editor`
52+
);
5153
if (!container || !popupContainer) return;
5254

5355
// with a node that contains a button below the editor in the node-type, the new grid css setup

apps/vps-web/src/styles.css

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -727,17 +727,19 @@ html:active-view-transition-type(normal) {
727727

728728
.code-editor {
729729
width: 100%;
730-
height: 320px;
730+
height: auto;
731731
min-height: 320px;
732732
transition: height var(--popup-fullscreen-duration)
733733
var(--popup-fullscreen-timing-function);
734734
/*height: 100%;*/
735735

736736
display: grid;
737-
grid-template-rows: auto 1fr;
737+
grid-template-rows: auto 320px;
738+
grid-template-columns: 100%;
738739
}
739740
.fullscreen .code-editor {
740741
height: calc(100vh - 110px);
742+
grid-template-rows: auto 1fr;
741743
}
742744
.code-editor .editor-instance {
743745
/* height: 40rem; */

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
},
2626
{
2727
"id": "3cf44538-9913-4aa2-aade-a7c619910f45",
28-
"x": 2883.462127419976,
29-
"y": 1083.5811430954288,
28+
"x": 2888.3560355256773,
29+
"y": 1088.3988411546893,
3030
"width": 178.5078125,
3131
"height": 80,
3232
"nodeType": "Shape",
@@ -430,8 +430,8 @@
430430
"id": "3601f5bf-09f9-401d-b7de-28d1be639fb5",
431431
"x": 2614.0830229763683,
432432
"y": 1116.511744316569,
433-
"endX": 2883.462127419976,
434-
"endY": 1123.5811430954288,
433+
"endX": 2888.3560355256773,
434+
"endY": 1128.3988411546893,
435435
"startNodeId": "6631fbab-1a06-4f8e-9abc-ee8ac2c3f923",
436436
"endNodeId": "3cf44538-9913-4aa2-aade-a7c619910f45",
437437
"startThumbName": "output",
@@ -443,8 +443,8 @@
443443
},
444444
{
445445
"id": "993273ac-60cc-4c0b-9f50-31b62d6ec3f0",
446-
"x": 3061.969939919976,
447-
"y": 1123.5811430954288,
446+
"x": 3066.8638480256773,
447+
"y": 1128.3988411546893,
448448
"endX": 3287.94780194177,
449449
"endY": 1118.0470007342954,
450450
"startNodeId": "3cf44538-9913-4aa2-aade-a7c619910f45",

libs/web-flow-executor/src/nodes/raw-json.tsx

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ export const getRawJsonNode: NodeTaskFactory<NodeInfo> = (
5252
let canvasAppInstance: IFlowCanvasBase<NodeInfo> | undefined = undefined;
5353
let setErrorMessage: undefined | ((message: string) => void) = undefined;
5454
let clearErrorMessage: undefined | (() => void) = undefined;
55-
55+
let currentOutput: any = undefined;
56+
let currentSerializedInput: any = undefined;
5657
const initializeCompute = () => {
5758
return;
5859
};
@@ -88,6 +89,8 @@ export const getRawJsonNode: NodeTaskFactory<NodeInfo> = (
8889
canvasAppInstance
8990
);
9091

92+
currentSerializedInput = payloadForExpression;
93+
9194
const json = JSON.parse(
9295
node.nodeInfo.formValues['json'].replace('[openai-key]', openAIKey)
9396
);
@@ -99,6 +102,8 @@ export const getRawJsonNode: NodeTaskFactory<NodeInfo> = (
99102
payloadForExpression
100103
);
101104

105+
currentOutput = transformedJson;
106+
102107
console.log('transformedJson', transformedJson);
103108

104109
return {
@@ -192,6 +197,26 @@ export const getRawJsonNode: NodeTaskFactory<NodeInfo> = (
192197
}`,
193198
};
194199
}
200+
if (node.nodeInfo) {
201+
node.nodeInfo.meta = [
202+
{
203+
type: 'json',
204+
propertyName: 'input',
205+
displayName: 'Input',
206+
getData: () => {
207+
return currentSerializedInput;
208+
},
209+
},
210+
{
211+
type: 'json',
212+
propertyName: 'output',
213+
displayName: 'Output',
214+
getData: () => {
215+
return currentOutput;
216+
},
217+
},
218+
];
219+
}
195220
},
196221
{
197222
category: 'data',

0 commit comments

Comments
 (0)