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"],
|
"title": kwargs["input_name"],
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"default": kwargs["default_value"],
|
"default": kwargs["default_value"],
|
||||||
"description": kwargs["description"],
|
"description": kwargs.get("description", ""),
|
||||||
"url_type": "image"
|
"url_type": "image"
|
||||||
}
|
}
|
||||||
return schema
|
return schema
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ class ShellAgentPluginInputText:
|
|||||||
"title": kwargs["input_name"],
|
"title": kwargs["input_name"],
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"default": kwargs["default_value"],
|
"default": kwargs["default_value"],
|
||||||
"description": kwargs["description"],
|
"description": kwargs.get("description", ""),
|
||||||
}
|
}
|
||||||
if kwargs.get("choices", "") != "":
|
if kwargs.get("choices", "") != "":
|
||||||
schema["enums"] = eval(kwargs["choices"])
|
schema["enums"] = eval(kwargs["choices"])
|
||||||
@@ -101,7 +101,7 @@ class ShellAgentPluginInputFloat:
|
|||||||
"title": kwargs["input_name"],
|
"title": kwargs["input_name"],
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"default": kwargs["default_value"],
|
"default": kwargs["default_value"],
|
||||||
"description": kwargs["description"],
|
"description": kwargs.get("description", ""),
|
||||||
}
|
}
|
||||||
if kwargs.get("choices", "") != "":
|
if kwargs.get("choices", "") != "":
|
||||||
schema["enums"] = eval(kwargs["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):
|
def run(self, input_name, default_value=None, display_name=None, description=None, **kwargs):
|
||||||
return [default_value]
|
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 = {
|
NODE_CLASS_MAPPINGS = {
|
||||||
"ShellAgentPluginInputText": ShellAgentPluginInputText,
|
"ShellAgentPluginInputText": ShellAgentPluginInputText,
|
||||||
"ShellAgentPluginInputFloat": ShellAgentPluginInputFloat,
|
"ShellAgentPluginInputFloat": ShellAgentPluginInputFloat,
|
||||||
"ShellAgentPluginInputInteger": ShellAgentPluginInputInteger
|
"ShellAgentPluginInputInteger": ShellAgentPluginInputInteger,
|
||||||
|
"ShellAgentPluginInputBoolean": ShellAgentPluginInputBoolean,
|
||||||
}
|
}
|
||||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||||
"ShellAgentPluginInputText": "Input Text (ShellAgent Plugin)",
|
"ShellAgentPluginInputText": "Input Text (ShellAgent Plugin)",
|
||||||
"ShellAgentPluginInputFloat": "Input Float (ShellAgent Plugin)",
|
"ShellAgentPluginInputFloat": "Input Float (ShellAgent Plugin)",
|
||||||
"ShellAgentPluginInputInteger": "Input Integer (ShellAgent Plugin)",
|
"ShellAgentPluginInputInteger": "Input Integer (ShellAgent Plugin)",
|
||||||
|
"ShellAgentPluginInputBoolean": "Input Boolean (ShellAgent Plugin)",
|
||||||
}
|
}
|
||||||
@@ -120,6 +120,13 @@ class ShellAgentPluginInputVideo:
|
|||||||
"url_type": "video"
|
"url_type": "video"
|
||||||
}
|
}
|
||||||
return schema
|
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):
|
def run(self, input_name, default_value=None, description=None):
|
||||||
input_dir = folder_paths.get_input_directory()
|
input_dir = folder_paths.get_input_directory()
|
||||||
|
|||||||
@@ -2,7 +2,8 @@
|
|||||||
json_type_mapipng = {
|
json_type_mapipng = {
|
||||||
"text": "string",
|
"text": "string",
|
||||||
"float": "number",
|
"float": "number",
|
||||||
"integer": "integer"
|
"integer": "integer",
|
||||||
|
"boolean": "boolean",
|
||||||
}
|
}
|
||||||
|
|
||||||
class ShellAgentOutputText:
|
class ShellAgentOutputText:
|
||||||
@@ -43,7 +44,7 @@ class ShellAgentOutputFloat(ShellAgentOutputText):
|
|||||||
def INPUT_TYPES(s):
|
def INPUT_TYPES(s):
|
||||||
return {
|
return {
|
||||||
"required": {
|
"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}"},),
|
"output_name": ("STRING", {"multiline": False, "default": f"output_{s.TYPE_STR}"},),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -56,7 +57,19 @@ class ShellAgentOutputInteger(ShellAgentOutputText):
|
|||||||
def INPUT_TYPES(s):
|
def INPUT_TYPES(s):
|
||||||
return {
|
return {
|
||||||
"required": {
|
"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}"},),
|
"output_name": ("STRING", {"multiline": False, "default": f"output_{s.TYPE_STR}"},),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -65,7 +78,8 @@ class ShellAgentOutputInteger(ShellAgentOutputText):
|
|||||||
NODE_CLASS_MAPPINGS = {
|
NODE_CLASS_MAPPINGS = {
|
||||||
"ShellAgentPluginOutputText": ShellAgentOutputText,
|
"ShellAgentPluginOutputText": ShellAgentOutputText,
|
||||||
"ShellAgentPluginOutputFloat": ShellAgentOutputFloat,
|
"ShellAgentPluginOutputFloat": ShellAgentOutputFloat,
|
||||||
"ShellAgentPluginOutputInteger": ShellAgentOutputInteger
|
"ShellAgentPluginOutputInteger": ShellAgentOutputInteger,
|
||||||
|
"ShellAgentPluginOutputBoolean": ShellAgentOutputBoolean,
|
||||||
}
|
}
|
||||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||||
"ShellAgentPluginOutputText": "Output Text (ShellAgent Plugin)",
|
"ShellAgentPluginOutputText": "Output Text (ShellAgent Plugin)",
|
||||||
|
|||||||
Reference in New Issue
Block a user