Add Nano Banana 2.1 and preserve image workflow values
This commit is contained in:
@@ -110,7 +110,7 @@ function findLegacySeedanceAssetWidgets(wv) {
|
||||
: -1;
|
||||
}
|
||||
const NANO_BANANA_MODELS = new Set([
|
||||
"Nano Banana Pro", "Nano Banana 2 Lite", "Nano Banana 2", "Nano Banana",
|
||||
"Nano Banana Pro", "Nano Banana 2 Lite", "Nano Banana 2.1", "Nano Banana 2", "Nano Banana",
|
||||
]);
|
||||
const NANO_BANANA_ROUTE_ALIASES = new Map([
|
||||
["特价", "畅速"],
|
||||
@@ -229,6 +229,14 @@ function batchNanoRandomWidgetIndex(wv) {
|
||||
// 新增规则时:type 填节点的注册名(与保存文件里的 "type" 一致),
|
||||
// when 判断旧结构特征(务必保证幂等,避免对已迁移的数据重复处理),apply 做数组修正。
|
||||
const MIGRATIONS = [
|
||||
{
|
||||
type: "O1keyImageGenerator",
|
||||
note: "移除旧图片面板存档中的生成后控制占位,保持参数位置",
|
||||
when: (wv) => Number.isInteger(wv[7])
|
||||
&& ["fixed", "increment", "decrement", "randomize"].includes(wv[8])
|
||||
&& typeof wv[9] === "string" && /^\s*\[/.test(wv[9]),
|
||||
apply: (wv) => wv.splice(8, 1),
|
||||
},
|
||||
{
|
||||
type: "O1keyAutoRedCast",
|
||||
note: "为旧版自动红偏校正补齐末尾 seed 参数",
|
||||
@@ -1447,6 +1455,15 @@ app.registerExtension({
|
||||
migrated += migrateUnifiedOnlineSearch(container);
|
||||
migrated += migrateUnifiedLayerDecomposition(container);
|
||||
migrated += migrateUnifiedModeration(container);
|
||||
for (const node of container?.nodes || []) {
|
||||
const values = node?.widgets_values;
|
||||
if (node?.type === "O1keyImageGenerator" && Array.isArray(values)
|
||||
&& values.length === 24 && values[23] === ""
|
||||
&& ["关闭", "打开"].includes(values[21]) && typeof values[22] === "boolean") {
|
||||
values.pop(); // Retired non-serialized HTML panel value.
|
||||
migrated++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (migrated > 0) {
|
||||
console.log(`[o1key] 工作流参数迁移:已修复 ${migrated} 处参数或端口`);
|
||||
|
||||
Reference in New Issue
Block a user