Merge pull request #217 from griptape-ai:feature/switch

Feature/switch
This commit is contained in:
Jason Schleifer
2025-01-04 05:14:28 +13:00
committed by GitHub
6 changed files with 65 additions and 3 deletions
+7 -1
View File
@@ -12,7 +12,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Deprecated
### Removed
### Fixed
### Security -->
### Security -->
## [2.1.04] - 2025-04-01
### Added
- `Griptape Util: Switch Node` - This node lets you choose an output from multiple inputs.
![switch node](docs/images/switch_node.png)
## [2.1.03] - 2025-03-01
### Fixed
+2
View File
@@ -292,6 +292,7 @@ from .nodes.tools.gtUIWebSearch import gtUIWebSearch
from .nodes.utils.gtUICreateAgentModelfile import gtUICreateAgentModelfile
from .nodes.utils.gtUICreateModelFromModelfile import gtUICreateModelFromModelfile
from .nodes.utils.gtUIRemoveOllamaModel import gtUIRemoveOllamaModel
from .nodes.utils.gtUISwitchNode import gtUISwitchNode
# Load existing environment variables
load_dotenv()
@@ -420,6 +421,7 @@ NODE_CLASS_MAPPINGS = {
"Griptape Util: Create Agent Modelfile": gtUICreateAgentModelfile,
"Griptape Util: Create Model from Modelfile": gtUICreateModelFromModelfile,
"Griptape Util: Remove Ollama Model": gtUIRemoveOllamaModel,
"Griptape Util: Switch Node": gtUISwitchNode,
# DISPLAY
"Griptape Display: Image": gtUIOutputImageNode,
"Griptape Display: Text": gtUIOutputStringNode,
Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

+1
View File
@@ -4,6 +4,7 @@ export function setupCombineNodes(nodeType, nodeData, app) {
nodeData.name === "Griptape Combine: Rules List" ||
nodeData.name === "Griptape Combine: Tool List" ||
nodeData.name === "Griptape Combine: RAG Module List" ||
nodeData.name === "Griptape Util: Switch Node" ||
nodeData.name === "Griptape Create: Pipeline") {
setupCombineNode(nodeType, nodeData, app);
+53
View File
@@ -0,0 +1,53 @@
class AnyType(str):
def __ne__(self, __value: object) -> bool:
return False
any = AnyType("*")
class gtUISwitchNode:
"""
Takes any inputs and gives the user the ability to choose which one will be the output.
"""
DESCRIPTION = "Takes any inputs and gives the user the ability to choose which one will be the output."
def __init__(self):
pass
@classmethod
def INPUT_TYPES(cls):
return {
"required": {},
"optional": {
"input_1": (
any,
{
"tooltip": "An input to choose. Connect an input to dynamically create more inputs."
},
),
"switch": (
"INT",
{
"default": 1,
"tooltip": "The input to choose.",
},
),
},
}
RETURN_TYPES = (any,)
RETURN_NAMES = ("OUTPUT",)
FUNCTION = "create"
CATEGORY = "Griptape/Agent Utils"
def create(
self,
**kwargs,
):
switch = kwargs.pop("switch")
inputs = [value for value in kwargs.values()]
output = inputs[switch - 1]
return (output,)
+2 -2
View File
@@ -1,6 +1,6 @@
[tool.poetry]
name = "comfyui-griptape"
version = "2.1.03"
version = "2.1.04"
description = "Griptape LLM(Large Language Model) Nodes for ComfyUI."
authors = ["Jason Schleifer <jason.schleifer@gmail.com>"]
readme = "README.md"
@@ -9,7 +9,7 @@ readme = "README.md"
[project]
name = "comfyui-griptape"
description = "Griptape LLM(Large Language Model) Nodes for ComfyUI."
version = "2.1.03"
version = "2.1.04"
license = {file = "LICENSE"}
dependencies = ["attrs==^24.3.0", "openai==^1.58.1", "griptape[all]==^1.1.0", "python-dotenv", "poetry==1.8.5", "griptape-black-forest @ git+https://github.com/griptape-ai/griptape-black-forest.git"]