Add MJ image node, GIF save, and Kling/image generator updates
Ship o1key MJ图片生成 with content/style refs and prompt flags, save-GIF with preview, Kling 4.0 helpers, plus GPT/unified image node polish and docs.
This commit is contained in:
@@ -108,3 +108,58 @@ assert.equal(backgroundWidget.options.getOptionLabel("transparent"), "透明");
|
||||
assert.equal(backgroundWidget.options.getOptionLabel("opaque"), "不透明");
|
||||
assert.equal(backgroundWidget.value, "transparent");
|
||||
assert.deepEqual(Array.from(backgroundWidget.options.values), ["auto", "transparent", "opaque"]);
|
||||
|
||||
for (const nodeType of ["O1keyGPTImage", "O1keyGPTImageBatch"]) {
|
||||
const node = makeNode("gpt-image-2.6-sunburst", "最高", nodeType);
|
||||
const size = () => [150, 20];
|
||||
const complexity = { name: "复杂度", value: "中", options: {}, computeSize: size };
|
||||
node.widgets.push(complexity);
|
||||
extension.nodeCreated(node);
|
||||
const callback = node.modelWidget.callback;
|
||||
extension.nodeCreated(node);
|
||||
assert.equal(node.modelWidget.callback, callback, "Extension binding remains idempotent");
|
||||
assert.equal(node.qualityWidget.value, "最高");
|
||||
assert.equal(complexity.hidden, false);
|
||||
assert.equal(complexity.computeSize, size);
|
||||
node.modelWidget.value = "gpt-image-2.5-flare";
|
||||
node.modelWidget.callback();
|
||||
assert.equal(complexity.hidden, true);
|
||||
assert.equal(complexity.options.hidden, true);
|
||||
assert.equal(complexity.value, "中");
|
||||
assert.deepEqual(Array.from(complexity.computeSize()), [0, -4]);
|
||||
node.modelWidget.value = "gpt-image-2.6-flare";
|
||||
node.onConfigure({});
|
||||
extension.loadedGraphNode(node);
|
||||
assert.equal(complexity.hidden, false);
|
||||
assert.equal(complexity.computeSize, size);
|
||||
assert.equal(complexity.value, "中");
|
||||
assert.equal(node.qualityWidget.value, "最高");
|
||||
}
|
||||
|
||||
for (const nodeType of ["O1keyGPTImage", "O1keyGPTImageBatch"]) {
|
||||
const node = makeNode("gpt-image-2.6-sunburst", "最高", nodeType);
|
||||
const size = () => [150, 20];
|
||||
const complexity = { name: "复杂度", value: "中", options: {}, computeSize: size };
|
||||
const formatName = nodeType === "O1keyGPTImageBatch" ? "图片输出格式" : "输出格式";
|
||||
const format = {
|
||||
name: formatName,
|
||||
value: nodeType === "O1keyGPTImageBatch" ? "PNG" : "png",
|
||||
options: { values: [] },
|
||||
callback() {},
|
||||
};
|
||||
const frameCount = { name: "帧数", value: 9, options: {}, computeSize: size };
|
||||
const frameDuration = { name: "帧时长ms", value: 200, options: {}, computeSize: size };
|
||||
node.widgets.push(complexity, format, frameCount, frameDuration);
|
||||
extension.nodeCreated(node);
|
||||
assert.equal(complexity.hidden, false);
|
||||
assert.ok(format.options.values.includes(nodeType === "O1keyGPTImageBatch" ? "GIF" : "gif"));
|
||||
assert.equal(frameCount.hidden, true);
|
||||
format.value = nodeType === "O1keyGPTImageBatch" ? "GIF" : "gif";
|
||||
format.callback();
|
||||
assert.equal(frameCount.hidden, false);
|
||||
assert.equal(frameDuration.hidden, false);
|
||||
node.modelWidget.value = "gpt-image-2";
|
||||
node.modelWidget.callback();
|
||||
assert.equal(format.options.values.includes(nodeType === "O1keyGPTImageBatch" ? "GIF" : "gif"), false);
|
||||
assert.equal(frameCount.hidden, true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user