Open cellis opened 4 months ago
UPDATE: turns out I was using standard workflow.json instead of api json. I tried with api json and it is still broken.
Yes, you should indeed be using an API format JSON file to generate the code.
Could you share your JSON file (in API format)? Also, could you provide the broken error message you're encountering?
Hello, here's the json:
"1": {
"inputs": {
"image": "image.png",
"upload": "image"
},
"class_type": "LoadImage",
"_meta": {
"title": "Load Image"
}
},
"2": {
"inputs": {
"pixels": [
"1",
0
],
"vae": [
"3",
2
]
},
"class_type": "VAEEncode",
"_meta": {
"title": "VAE Encode"
}
},
"3": {
"inputs": {
"ckpt_name": "aniverseXL_v10.safetensors"
},
"class_type": "CheckpointLoaderSimple",
"_meta": {
"title": "Load Checkpoint"
}
},
"4": {
"inputs": {
"seed": 223493558817724,
"steps": 20,
"cfg": 8,
"sampler_name": "euler",
"scheduler": "normal",
"denoise": 1,
"model": [
"3",
0
],
"positive": [
"5",
0
],
"negative": [
"6",
0
],
"latent_image": [
"2",
0
]
},
"class_type": "KSampler",
"_meta": {
"title": "KSampler"
}
},
"5": {
"inputs": {
"text": "",
"clip": [
"3",
1
]
},
"class_type": "CLIPTextEncode",
"_meta": {
"title": "CLIP Text Encode (Prompt)"
}
},
"6": {
"inputs": {
"text": "",
"clip": [
"3",
1
]
},
"class_type": "CLIPTextEncode",
"_meta": {
"title": "CLIP Text Encode (Prompt)"
}
},
"7": {
"inputs": {
"samples": [
"4",
0
],
"vae": [
"3",
2
]
},
"class_type": "VAEDecode",
"_meta": {
"title": "VAE Decode"
}
},
"8": {
"inputs": {
"images": [
"7",
0
]
},
"class_type": "PreviewImage",
"_meta": {
"title": "Preview Image"
}
}
}
That is in API format. The error I get is
yarn cuc-w2c -i ./src/workflows/jsons/simple-api.json -t none
/home/cameronellis/work/komfy/node_modules/.bin/cuc-w2c: 1: Syntax error: "(" unexpected
error Command failed with exit code 2.```
Hello, here's the JSON: ...
I tried the JSON you provided, and I can output it normally. The result is as follows:
const [MODEL_1, CLIP_1, VAE_1] = cls.CheckpointLoaderSimple({
ckpt_name: "aniverseXL_v10.safetensors",
});
const [CONDITIONING_2] = cls.CLIPTextEncode({
text: "",
clip: CLIP_1,
});
const [CONDITIONING_1] = cls.CLIPTextEncode({
text: "",
clip: CLIP_1,
});
const [IMAGE_1, MASK_1] = cls.LoadImage({
image: "image.png",
upload: "image",
});
const [LATENT_1] = cls.VAEEncode({
pixels: IMAGE_1,
vae: VAE_1,
});
const [LATENT_2] = cls.KSampler({
seed: 223493558817724,
steps: 20,
cfg: 8,
sampler_name: "euler",
scheduler: "normal",
denoise: 1,
model: MODEL_1,
positive: CONDITIONING_1,
negative: CONDITIONING_2,
latent_image: LATENT_1,
});
const [IMAGE_2] = cls.VAEDecode({
samples: LATENT_2,
vae: VAE_1,
});
const [] = cls.PreviewImage({
images: IMAGE_2,
});
One possible issue could be that your Node.js version does not support certain packaging features. Since the CLI tool is now pre-packaged into a /dist/*.js
file, I suspect your issues might be related to version compatibility.
You can try running the script directly using ./node_modules/@stable-canvas/comfyui-client-cli/src/main-cli.ts
(using ts-node
or tsx
) to work around the issue.
Additionally, regarding the minified output you mentioned earlier, it's likely caused by the .map
files not being loaded correctly after the packaging, which is why the error is pointing to the compressed code. Running the script from the .ts
files should give you more accurate error locations.
Thank you for your feedback! Please give it another try and let us know how it goes.
Describe the bug The cli does not write to the
-o <file>.js
, and only outputs to stdio..nvm/versions/node/v20.9.0/bin/cuc-w2c: line 1: syntax error near unexpected token
('`Example:
To Reproduce I have a simple json like this:
simple.json Install:
npm install -g @stable-canvas/comfyui-client-cli
Runcuc-w2c -i simple.json -t cjs -o whatever.js
Expected behavior whatever.js is populated per the readme.
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):