按 OpenAI 官方放开 GIF+参考图,SVG 仍仅文生图;有蒙版禁用 GIF/SVG
This commit is contained in:
@@ -27,8 +27,18 @@ function setWidgetHidden(widget, hidden) {
|
||||
} else delete widget.computeSize;
|
||||
}
|
||||
|
||||
function hasReferenceOrMask(node) {
|
||||
function hasMask(node) {
|
||||
if (findWidget(node, "遮罩")?.value) return true;
|
||||
// Connected inputs on modern nodes are not always mirrored into widget values.
|
||||
const inputs = node.inputs || [];
|
||||
for (const input of inputs) {
|
||||
if (!input || input.link == null) continue;
|
||||
if (input.name === "遮罩") return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function hasReference(node) {
|
||||
const widgets = node.widgets || [];
|
||||
for (const widget of widgets) {
|
||||
if (/^参考图/.test(widget.name) && widget.value) return true;
|
||||
@@ -37,7 +47,7 @@ function hasReferenceOrMask(node) {
|
||||
const inputs = node.inputs || [];
|
||||
for (const input of inputs) {
|
||||
if (!input || input.link == null) continue;
|
||||
if (input.name === "遮罩" || /^参考图/.test(input.name) || input.name === "参考图组") {
|
||||
if (/^参考图/.test(input.name) || input.name === "参考图组") {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -77,12 +87,15 @@ function updateQualityOptions(node) {
|
||||
const formatWidget = findWidget(node, "输出格式") || findWidget(node, "图片输出格式");
|
||||
const isBatch = (node.comfyClass || node.type) === "O1keyGPTImageBatch";
|
||||
if (formatWidget) {
|
||||
const blocked = hasReferenceOrMask(node);
|
||||
let values = isBatch
|
||||
? (is26 ? BATCH_26 : BATCH_RASTER)
|
||||
: (is26 ? FORMAT_26 : RASTER_FORMATS);
|
||||
if (is26 && blocked) {
|
||||
values = values.filter((value) => !/^(svg|gif|SVG|GIF)$/i.test(value));
|
||||
if (is26) {
|
||||
if (hasMask(node)) {
|
||||
values = values.filter((value) => !/^(svg|gif|SVG|GIF)$/i.test(value));
|
||||
} else if (hasReference(node)) {
|
||||
values = values.filter((value) => !/^(svg|SVG)$/i.test(value));
|
||||
}
|
||||
}
|
||||
formatWidget.options ??= {};
|
||||
formatWidget.options.values = [...values];
|
||||
|
||||
Reference in New Issue
Block a user