Skip to content

Commit

Permalink
Enhance parsing functionality for ComfyUI Prompt:
Browse files Browse the repository at this point in the history
KSampler_A1111, ControlNetApplySD3, StabilityAPI_SD3, easy preSampling, SamplerCustomAdvanced, FluxSamplerParams+, XlabsSampler, ImpactKSamplerAdvancedBasicPipe, ImpactKSamplerBasicPipe, LuminaT2ISampler, DualCLIPLoader, KSampler //Inspire,
Power Lora Loader (rgthree),
Text Concatenate (JPS), Multi Text Merge, JoinStrings, Text Concatenate,
extraMetadata
  • Loading branch information
hbl917070 committed Nov 2, 2024
1 parent 5be1d59 commit e303438
Show file tree
Hide file tree
Showing 9 changed files with 1,265 additions and 832 deletions.
13 changes: 8 additions & 5 deletions Www/ts/Lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -593,19 +593,22 @@ export class Lib {
if (typeof str === "object") {
jsonFormat = JSON.stringify(str, null, space);
ok = true;
} else if (
(str.startsWith('{') && str.endsWith('}'))
|| (str.startsWith('[') && str.endsWith(']'))
}
else if ((str.startsWith('{') && str.endsWith('}')) ||
(str.startsWith('[') && str.endsWith(']'))
) {
try {
str = str.replace(/": NaN/g, `": null`); // 將 NaN 轉成 null
// 將 NaN 轉成 null
str = str.replace(/": NaN/g, `": null`)
.replace(/": \[NaN/g, `": [null`);
json = JSON.parse(str);
jsonFormat = JSON.stringify(json, null, space);
ok = true;
} catch (e) {
jsonFormat = str;
}
} else {
}
else {
jsonFormat = str;
}
return {
Expand Down
Loading

0 comments on commit e303438

Please sign in to comment.