Introducing Versatile IO Components: JSON Viewer, DictionaryIO, and InputListIO (#1822)
In our ongoing commitment to enhancing user experience and streamlining data interaction, we are thrilled to introduce a trio of powerful IO components: JSON Viewer, DictionaryIO, and InputListIO. These components are meticulously crafted to empower developers with seamless data handling capabilities, enabling efficient processing and visualization of JSON data structures, dictionaries, and input lists.
This commit is contained in:
commit
bbe72887eb
22 changed files with 495 additions and 15 deletions
17
src/backend/base/langflow/components/inputs/JsonInput.py
Normal file
17
src/backend/base/langflow/components/inputs/JsonInput.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
from langflow.base.io.text import TextComponent
|
||||
from langflow.field_typing.constants import Data, NestedDict
|
||||
|
||||
class JsonInput(TextComponent):
|
||||
display_name = "JSON Input"
|
||||
description = "JSON Input."
|
||||
|
||||
def build_config(self):
|
||||
return {
|
||||
"input_value": {
|
||||
"display_name": "JSON",
|
||||
"field_type": "NestedDict"
|
||||
}
|
||||
}
|
||||
|
||||
def build(self, input_value: NestedDict) -> NestedDict:
|
||||
return input_value
|
||||
19
src/backend/base/langflow/components/inputs/KeyPairInput.py
Normal file
19
src/backend/base/langflow/components/inputs/KeyPairInput.py
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
from langflow.base.io.text import TextComponent
|
||||
from langflow.field_typing.constants import Data
|
||||
|
||||
|
||||
class KeyPairInput(TextComponent):
|
||||
display_name = "Dictionary Input"
|
||||
description = "Dictionary Input."
|
||||
|
||||
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
|
||||
|
|
@ -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 {"input_value": {"display_name": "String List Input", "field_type": "str", "list": True}}
|
||||
|
||||
def build(self, input_value: list) -> Record:
|
||||
return Record(data=input_value)
|
||||
17
src/backend/base/langflow/components/outputs/CSVOutput.py
Normal file
17
src/backend/base/langflow/components/outputs/CSVOutput.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
from typing import Optional
|
||||
|
||||
from langflow.base.io.text import TextComponent
|
||||
from langflow.field_typing import Text, Data
|
||||
|
||||
|
||||
class CSVOutput(TextComponent):
|
||||
display_name = "CSV Output"
|
||||
description = "Used view csv files"
|
||||
|
||||
field_config = {
|
||||
"input_value": {"display_name": "csv","info":"A csv blob","input_types":["Data"]},
|
||||
"separator": {"display_name": "separator","info":"The separator used in the csv file","input_types":["Text"], "field_type":"Text","default_value":";","options":[";", ",", "|"]},
|
||||
}
|
||||
|
||||
def build(self, input_value: Data, separator) -> Data:
|
||||
return {"data": input_value, "separator": separator}
|
||||
15
src/backend/base/langflow/components/outputs/ImageOutput.py
Normal file
15
src/backend/base/langflow/components/outputs/ImageOutput.py
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
from typing import Optional
|
||||
|
||||
from langflow.base.io.text import TextComponent
|
||||
from langflow.field_typing import Text
|
||||
|
||||
class ImageOutput(TextComponent):
|
||||
display_name = "Image Output"
|
||||
description = "Used view image files"
|
||||
|
||||
field_config = {
|
||||
"input_value": {"display_name": "image","info":"A image url","input_types":["Text"]},
|
||||
}
|
||||
|
||||
def build(self, input_value: Text) -> Text:
|
||||
return input_value
|
||||
17
src/backend/base/langflow/components/outputs/JsonOutput.py
Normal file
17
src/backend/base/langflow/components/outputs/JsonOutput.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
from langflow.base.io.text import TextComponent
|
||||
from langflow.field_typing.constants import Data, NestedDict
|
||||
|
||||
class JsonOutput(TextComponent):
|
||||
display_name = "JSON Output"
|
||||
description = "JSON Output."
|
||||
|
||||
def build_config(self):
|
||||
return {
|
||||
"input_value": {
|
||||
"display_name": "JSON",
|
||||
"field_type": "NestedDict"
|
||||
}
|
||||
}
|
||||
|
||||
def build(self, input_value: NestedDict) -> NestedDict:
|
||||
return input_value
|
||||
|
|
@ -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
|
||||
16
src/backend/base/langflow/components/outputs/PDFOutput.py
Normal file
16
src/backend/base/langflow/components/outputs/PDFOutput.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
from typing import Optional
|
||||
|
||||
from langflow.base.io.text import TextComponent
|
||||
from langflow.field_typing import Text
|
||||
|
||||
|
||||
class PDFOutput(TextComponent):
|
||||
display_name = "PDF Output"
|
||||
description = "Used view pdf files"
|
||||
|
||||
field_config = {
|
||||
"input_value": {"display_name": "pdf","info":"A pdf url","input_types":["Text"]},
|
||||
}
|
||||
|
||||
def build(self, input_value: Text) -> Text:
|
||||
return input_value
|
||||
|
|
@ -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 {"input_value": {"display_name": "String List Output", "field_type": "str", "list": True}}
|
||||
|
||||
def build(self, input_value: list) -> Record:
|
||||
return Record(data=input_value)
|
||||
Loading…
Add table
Add a link
Reference in a new issue