mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-02-14 15:32:35 +08:00
added step to generate object_info
This commit is contained in:
parent
9dfd61b48d
commit
57d1bba5eb
1
.github/workflows/test-ui.yaml
vendored
1
.github/workflows/test-ui.yaml
vendored
@ -13,5 +13,6 @@ jobs:
|
|||||||
- name: Run Tests
|
- name: Run Tests
|
||||||
run: |
|
run: |
|
||||||
npm install
|
npm install
|
||||||
|
npm run test:generate
|
||||||
npm test
|
npm test
|
||||||
working-directory: ./tests-ui
|
working-directory: ./tests-ui
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -4,7 +4,8 @@
|
|||||||
"description": "UI tests",
|
"description": "UI tests",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "jest"
|
"test": "jest",
|
||||||
|
"test:generate": "node setup.js"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|||||||
68
tests-ui/setup.js
Normal file
68
tests-ui/setup.js
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
const { spawn } = require("child_process");
|
||||||
|
const { resolve } = require("path");
|
||||||
|
const { writeFile } = require("fs");
|
||||||
|
const http = require("http");
|
||||||
|
|
||||||
|
async function setup() {
|
||||||
|
// Wait up to 30s for it to start
|
||||||
|
let success = false;
|
||||||
|
let child;
|
||||||
|
for (let i = 0; i < 30; i++) {
|
||||||
|
try {
|
||||||
|
await new Promise((res, rej) => {
|
||||||
|
http
|
||||||
|
.get("http://127.0.0.1:8188/object_info", (resp) => {
|
||||||
|
let data = "";
|
||||||
|
resp.on("data", (chunk) => {
|
||||||
|
data += chunk;
|
||||||
|
});
|
||||||
|
resp.on("end", () => {
|
||||||
|
// Modify the response data to add some checkpoints
|
||||||
|
const objectInfo = JSON.parse(data);
|
||||||
|
objectInfo.CheckpointLoaderSimple.input.required.ckpt_name[0] = ["model1.safetensors", "model2.ckpt"];
|
||||||
|
|
||||||
|
data = JSON.stringify(objectInfo, undefined, "\t");
|
||||||
|
|
||||||
|
writeFile(
|
||||||
|
"data/object_info.json",
|
||||||
|
data,
|
||||||
|
{
|
||||||
|
encoding: "utf8",
|
||||||
|
},
|
||||||
|
(err) => {
|
||||||
|
if (err) {
|
||||||
|
rej(err);
|
||||||
|
} else {
|
||||||
|
res();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
res();
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.on("error", rej);
|
||||||
|
});
|
||||||
|
success = true;
|
||||||
|
break;
|
||||||
|
} catch (error) {
|
||||||
|
if (i === 0) {
|
||||||
|
// Start the server on first iteration if it fails to connect
|
||||||
|
console.log("Starting ComfyUI server...");
|
||||||
|
|
||||||
|
const python = resolve("../../python_embeded/python.exe");
|
||||||
|
child = spawn(python, ["-s", "ComfyUI/main.py", "--cpu"], { cwd: "../.." });
|
||||||
|
}
|
||||||
|
await new Promise((r) => {
|
||||||
|
setTimeout(r, 1000);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
child?.kill();
|
||||||
|
|
||||||
|
if (!success) {
|
||||||
|
throw new Error("Waiting for server timed out...");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setup();
|
||||||
Loading…
Reference in New Issue
Block a user