Make BOOL an intrinsically supported type

This commit is contained in:
Jacob Segal 2023-07-20 21:02:06 -07:00
parent 4f1858cacf
commit 88fc046180
3 changed files with 8 additions and 1 deletions

View File

@ -667,6 +667,9 @@ def validate_inputs(prompt, item, validated):
if type_input == "STRING":
val = str(val)
inputs[x] = val
if type_input == "BOOL":
val = bool(val)
inputs[x] = val
except Exception as ex:
error = {
"type": "invalid_input_type",

View File

@ -2,7 +2,7 @@ import { ComfyWidgets, addValueControlWidget } from "../../scripts/widgets.js";
import { app } from "../../scripts/app.js";
const CONVERTED_TYPE = "converted-widget";
const VALID_TYPES = ["STRING", "combo", "number"];
const VALID_TYPES = ["STRING", "combo", "number", "toggle"];
function isConvertableWidget(widget, config) {
return VALID_TYPES.includes(widget.type) || VALID_TYPES.includes(config[0]);

View File

@ -273,6 +273,10 @@ export const ComfyWidgets = {
),
};
},
BOOL(node, inputName, inputData) {
const defaultVal = inputData[1]?.default || false;
return { widget: node.addWidget("toggle", inputName, defaultVal, () => {}, {}) };
},
STRING(node, inputName, inputData, app) {
const defaultVal = inputData[1].default || "";
const multiline = !!inputData[1].multiline;