mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-02-11 05:52:33 +08:00
Make BOOL an intrinsically supported type
This commit is contained in:
parent
4f1858cacf
commit
88fc046180
@ -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",
|
||||
|
||||
@ -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]);
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user