Make trigger_words input optional for TriggerWord Toggle node. This will fix https://github.com/willmiao/ComfyUI-Lora-Manager/issues/31

This commit is contained in:
Will Miao
2025-03-10 20:19:01 +08:00
parent 2783782669
commit c48da5300e

View File

@@ -10,10 +10,11 @@ class TriggerWordToggle:
@classmethod @classmethod
def INPUT_TYPES(cls): def INPUT_TYPES(cls):
return { return {
"required": { "required": {},
"trigger_words": ("STRING", {"defaultInput": True, "forceInput": True}), "optional": {
**FlexibleOptionalInputType(any_type),
"trigger_words": ("STRING", {"default": "", "defaultInput": True}),
}, },
"optional": FlexibleOptionalInputType(any_type),
"hidden": { "hidden": {
"id": "UNIQUE_ID", # 会被 ComfyUI 自动替换为唯一ID "id": "UNIQUE_ID", # 会被 ComfyUI 自动替换为唯一ID
}, },
@@ -23,7 +24,7 @@ class TriggerWordToggle:
RETURN_NAMES = ("filtered_trigger_words",) RETURN_NAMES = ("filtered_trigger_words",)
FUNCTION = "process_trigger_words" FUNCTION = "process_trigger_words"
def process_trigger_words(self, trigger_words, id, **kwargs): def process_trigger_words(self, id, trigger_words="", **kwargs):
# Send trigger words to frontend # Send trigger words to frontend
PromptServer.instance.send_sync("trigger_word_update", { PromptServer.instance.send_sync("trigger_word_update", {
"id": id, "id": id,