Update defaultGraph

This commit is contained in:
space-nuko
2023-05-08 15:15:59 -05:00
parent f823818674
commit ec6e0f17b1
6 changed files with 7257 additions and 4174 deletions

View File

@@ -131,3 +131,17 @@ export function convertComfyOutputToGradio(output: GalleryOutput): GradioFileDat
}
});
}
export function jsonToJsObject(json: string): string {
// Try to parse, to see if it's real JSON
JSON.parse(json);
const regex = /\"([^"]+)\":/g;
const hyphenRegex = /-([a-z])/g;
return json.replace(regex, match => {
return match
.replace(hyphenRegex, g => g[1].toUpperCase())
.replace(regex, "$1:");
});
}