Publish current ComfyUI O1Key code baseline
Replace the prior release tree with the current plugin, frontend, tests, and documentation. Document retired node IDs and the public Gitea update source.
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import assert from "node:assert/strict";
|
||||
import fs from "node:fs";
|
||||
import vm from "node:vm";
|
||||
|
||||
|
||||
const migrationPath = new URL("../web/js/migrateWorkflow.js", import.meta.url);
|
||||
const migrationSource = fs.readFileSync(migrationPath, "utf8");
|
||||
let migrationExtension;
|
||||
const context = {
|
||||
app: {
|
||||
registerExtension(extension) {
|
||||
migrationExtension = extension;
|
||||
},
|
||||
},
|
||||
console: { log() {}, warn() {} },
|
||||
};
|
||||
|
||||
vm.runInNewContext(
|
||||
migrationSource.replace(/^import .*;\s*$/gm, ""),
|
||||
context,
|
||||
{ filename: migrationPath.pathname },
|
||||
);
|
||||
|
||||
const legacyValues = ["第一套\n---\n第二套", "随机抽取1套"];
|
||||
const legacyGraph = {
|
||||
nodes: [{ type: "O1keyPromptMultiFunction", widgets_values: legacyValues }],
|
||||
};
|
||||
migrationExtension.beforeConfigureGraph(legacyGraph);
|
||||
assert.deepEqual(legacyValues, [
|
||||
"第一套\n---\n第二套",
|
||||
"随机抽取n套",
|
||||
1,
|
||||
"1,2,3",
|
||||
]);
|
||||
|
||||
migrationExtension.beforeConfigureGraph(legacyGraph);
|
||||
assert.equal(legacyValues.length, 4, "迁移重复执行时不得再次追加控件值");
|
||||
|
||||
const partialValues = ["提示词", "随机抽取多套", 5];
|
||||
migrationExtension.beforeConfigureGraph({
|
||||
nodes: [{ type: "O1keyPromptMultiFunction", widgets_values: partialValues }],
|
||||
});
|
||||
assert.deepEqual(partialValues, ["提示词", "随机抽取n套", 5, "1,2,3"]);
|
||||
|
||||
console.log("prompt multi-function frontend migration tests passed");
|
||||
Reference in New Issue
Block a user