add boolean; fix output nodes input type bugs; fix input_video enum validate bug; compatible with none desc
This commit is contained in:
@@ -45,7 +45,7 @@ class ShellAgentPluginInputImage:
|
||||
"title": kwargs["input_name"],
|
||||
"type": "string",
|
||||
"default": kwargs["default_value"],
|
||||
"description": kwargs["description"],
|
||||
"description": kwargs.get("description", ""),
|
||||
"url_type": "image"
|
||||
}
|
||||
return schema
|
||||
|
||||
@@ -42,7 +42,7 @@ class ShellAgentPluginInputText:
|
||||
"title": kwargs["input_name"],
|
||||
"type": "string",
|
||||
"default": kwargs["default_value"],
|
||||
"description": kwargs["description"],
|
||||
"description": kwargs.get("description", ""),
|
||||
}
|
||||
if kwargs.get("choices", "") != "":
|
||||
schema["enums"] = eval(kwargs["choices"])
|
||||
@@ -101,7 +101,7 @@ class ShellAgentPluginInputFloat:
|
||||
"title": kwargs["input_name"],
|
||||
"type": "number",
|
||||
"default": kwargs["default_value"],
|
||||
"description": kwargs["description"],
|
||||
"description": kwargs.get("description", ""),
|
||||
}
|
||||
if kwargs.get("choices", "") != "":
|
||||
schema["enums"] = eval(kwargs["choices"])
|
||||
@@ -184,14 +184,58 @@ class ShellAgentPluginInputInteger:
|
||||
def run(self, input_name, default_value=None, display_name=None, description=None, **kwargs):
|
||||
return [default_value]
|
||||
|
||||
class ShellAgentPluginInputBoolean:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
"required": {
|
||||
"input_name": (
|
||||
"STRING",
|
||||
{"multiline": False, "default": "input_bool"},
|
||||
),
|
||||
},
|
||||
"optional": {
|
||||
"default_value": (
|
||||
"BOOLEAN",
|
||||
{"default": False},
|
||||
),
|
||||
"description": (
|
||||
"STRING",
|
||||
{"multiline": True, "default": ""},
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("BOOLEAN",)
|
||||
RETURN_NAMES = ("boolean",)
|
||||
|
||||
FUNCTION = "run"
|
||||
|
||||
CATEGORY = "shellagent"
|
||||
|
||||
@classmethod
|
||||
def validate(cls, **kwargs):
|
||||
schema = {
|
||||
"title": kwargs["input_name"],
|
||||
"type": "boolean",
|
||||
"default": kwargs["default_value"],
|
||||
"description": kwargs.get("description", ""),
|
||||
}
|
||||
return schema
|
||||
|
||||
def run(self, input_name, default_value=None, display_name=None, description=None, **kwargs):
|
||||
return [default_value]
|
||||
|
||||
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
"ShellAgentPluginInputText": ShellAgentPluginInputText,
|
||||
"ShellAgentPluginInputFloat": ShellAgentPluginInputFloat,
|
||||
"ShellAgentPluginInputInteger": ShellAgentPluginInputInteger
|
||||
"ShellAgentPluginInputInteger": ShellAgentPluginInputInteger,
|
||||
"ShellAgentPluginInputBoolean": ShellAgentPluginInputBoolean,
|
||||
}
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"ShellAgentPluginInputText": "Input Text (ShellAgent Plugin)",
|
||||
"ShellAgentPluginInputFloat": "Input Float (ShellAgent Plugin)",
|
||||
"ShellAgentPluginInputInteger": "Input Integer (ShellAgent Plugin)",
|
||||
"ShellAgentPluginInputBoolean": "Input Boolean (ShellAgent Plugin)",
|
||||
}
|
||||
@@ -120,6 +120,13 @@ class ShellAgentPluginInputVideo:
|
||||
"url_type": "video"
|
||||
}
|
||||
return schema
|
||||
|
||||
@classmethod
|
||||
def VALIDATE_INPUTS(s, input_name, default_value, description=""):
|
||||
video = default_value
|
||||
if not folder_paths.exists_annotated_filepath(video):
|
||||
return "Invalid video file: {}".format(video)
|
||||
return True
|
||||
|
||||
def run(self, input_name, default_value=None, description=None):
|
||||
input_dir = folder_paths.get_input_directory()
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
json_type_mapipng = {
|
||||
"text": "string",
|
||||
"float": "number",
|
||||
"integer": "integer"
|
||||
"integer": "integer",
|
||||
"boolean": "boolean",
|
||||
}
|
||||
|
||||
class ShellAgentOutputText:
|
||||
@@ -43,7 +44,7 @@ class ShellAgentOutputFloat(ShellAgentOutputText):
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
"required": {
|
||||
s.TYPE_STR: ("STRING", {"tooltip": f"The {s.TYPE_STR} to output."}),
|
||||
s.TYPE_STR: ("FLOAT", {"tooltip": f"The {s.TYPE_STR} to output."}),
|
||||
"output_name": ("STRING", {"multiline": False, "default": f"output_{s.TYPE_STR}"},),
|
||||
},
|
||||
}
|
||||
@@ -56,7 +57,19 @@ class ShellAgentOutputInteger(ShellAgentOutputText):
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
"required": {
|
||||
s.TYPE_STR: ("STRING", {"tooltip": f"The {s.TYPE_STR} to output."}),
|
||||
s.TYPE_STR: ("INT", {"tooltip": f"The {s.TYPE_STR} to output."}),
|
||||
"output_name": ("STRING", {"multiline": False, "default": f"output_{s.TYPE_STR}"},),
|
||||
},
|
||||
}
|
||||
|
||||
class ShellAgentOutputBoolean(ShellAgentOutputText):
|
||||
TYPE_STR = "boolean"
|
||||
DESCRIPTION = "output the integer"
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
"required": {
|
||||
s.TYPE_STR: ("BOOLEAN", {"tooltip": f"The {s.TYPE_STR} to output."}),
|
||||
"output_name": ("STRING", {"multiline": False, "default": f"output_{s.TYPE_STR}"},),
|
||||
},
|
||||
}
|
||||
@@ -65,7 +78,8 @@ class ShellAgentOutputInteger(ShellAgentOutputText):
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
"ShellAgentPluginOutputText": ShellAgentOutputText,
|
||||
"ShellAgentPluginOutputFloat": ShellAgentOutputFloat,
|
||||
"ShellAgentPluginOutputInteger": ShellAgentOutputInteger
|
||||
"ShellAgentPluginOutputInteger": ShellAgentOutputInteger,
|
||||
"ShellAgentPluginOutputBoolean": ShellAgentOutputBoolean,
|
||||
}
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"ShellAgentPluginOutputText": "Output Text (ShellAgent Plugin)",
|
||||
|
||||
Reference in New Issue
Block a user