@@ -16,6 +16,7 @@ const deleteFile = require('../utils/filemanager/deletefile');
1616const { flowDataToReadableData, readableDataToFlowData } = require ( '../utils/parser' ) ;
1717const readFile = require ( '../utils/filemanager/readfile' ) ;
1818const FlowtestAI = require ( '../utils/flowtestai' ) ;
19+ const { stringify, parse } = require ( 'flatted' ) ;
1920
2021const collectionStore = new Collections ( ) ;
2122const flowTestAI = new FlowtestAI ( ) ;
@@ -87,7 +88,7 @@ const registerRendererEventHandlers = (mainWindow, watcher) => {
8788 id : id ,
8889 name : collectionName ,
8990 pathname : pathname ,
90- openapi_spec : resolvedSpec . resolved ,
91+ openapi_spec : stringify ( resolvedSpec . resolved ) ,
9192 nodes : parsedNodes ,
9293 } ;
9394
@@ -122,7 +123,7 @@ const registerRendererEventHandlers = (mainWindow, watcher) => {
122123 id : id ,
123124 name : collectionName ,
124125 pathname : collectionFolderPath ,
125- openapi_spec : resolvedSpec . resolved ,
126+ openapi_spec : stringify ( resolvedSpec . resolved ) ,
126127 nodes : parsedNodes ,
127128 } ;
128129
@@ -309,7 +310,7 @@ const registerRendererEventHandlers = (mainWindow, watcher) => {
309310 try {
310311 const collection = collectionStore . getAll ( ) . find ( ( c ) => c . id === collectionId ) ;
311312 if ( collection ) {
312- return await flowTestAI . generate ( collection . openapi_spec , instruction , model ) ;
313+ return await flowTestAI . generate ( parse ( collection . openapi_spec ) , instruction , model ) ;
313314 } else {
314315 return Promise . reject ( new Error ( 'Collection not found' ) ) ;
315316 }
0 commit comments