✨ (StringListInput.py): add a new custom component called "StringListInput" to handle string list inputs

✨ (KeyPairOutput.py): add a new custom component called "KeyPairOutput" to handle dictionary outputs
✨ (StringListOutput.py): add a new custom component called "StringListOutput" to handle string list outputs
🚀 (constants.ts): add "StringListInput" and "StringListOutput" to the list of supported input and output types
♻️ (index.tsx): refactor IOKeyPairInput component to accept an additional prop "isInputField" and disable input fields if it's false
♻️ (index.tsx): refactor IOFieldView component to handle rendering of "StringListInput" and "StringListOutput" components
This commit is contained in:
cristhianzl 2024-04-30 13:33:37 -03:00
commit edabb31112
6 changed files with 92 additions and 3 deletions

View file

@ -0,0 +1,13 @@
# from langflow.field_typing import Data
from langflow.schema import Record
from langflow.interface.custom.custom_component import CustomComponent
class StringListInput(CustomComponent):
display_name = "String List Input"
def build_config(self):
return {"param": {"display_name": "String List Input", "field_type": "str", "list": True}}
def build(self, param: list) -> Record:
return Record(data=param)

View file

@ -0,0 +1,19 @@
from langflow.base.io.text import TextComponent
from langflow.field_typing.constants import Data
class KeyPairOutput(TextComponent):
display_name = "Dictionary Output"
description = "Dictionary Output."
def build_config(self):
return {
"input_value": {
"display_name": "Dictionaries",
"field_type": "dict",
"list": True
}
}
def build(self, input_value: dict) -> dict:
return input_value

View file

@ -0,0 +1,13 @@
# from langflow.field_typing import Data
from langflow.schema import Record
from langflow.interface.custom.custom_component import CustomComponent
class StringListOutput(CustomComponent):
display_name = "String List Output"
def build_config(self):
return {"param": {"display_name": "String List Output", "field_type": "str", "list": True}}
def build(self, param: list) -> Record:
return Record(data=param)