🔧 (FileInput.py, JsonInput.py, KeyPairInput.py, StringListInput.py, CSVOutput.py, ImageOutput.py, JsonOutput.py, KeyPairOutput.py, PDFOutput.py, StringListOutput.py): delete unused input and output components
The input and output components FileInput.py, JsonInput.py, KeyPairInput.py, StringListInput.py, CSVOutput.py, ImageOutput.py, JsonOutput.py, KeyPairOutput.py, PDFOutput.py, and StringListOutput.py were deleted as they were no longer being used in the project. This cleanup improves code organization and reduces unnecessary dependencies.
This commit is contained in:
parent
c9248d253a
commit
d057dc1600
10 changed files with 0 additions and 194 deletions
|
|
@ -1,48 +0,0 @@
|
|||
from pathlib import Path
|
||||
from typing import Any, Dict
|
||||
|
||||
from langflow.base.data.utils import TEXT_FILE_TYPES, parse_text_file_to_record
|
||||
from langflow.interface.custom.custom_component import CustomComponent
|
||||
from langflow.schema import Record
|
||||
|
||||
|
||||
class FileInput(CustomComponent):
|
||||
display_name = "File Input"
|
||||
description = "A generic file input."
|
||||
icon = "file-text"
|
||||
|
||||
def build_config(self) -> Dict[str, Any]:
|
||||
return {
|
||||
"path": {
|
||||
"display_name": "Path",
|
||||
"field_type": "file",
|
||||
"file_types": TEXT_FILE_TYPES,
|
||||
"info": f"Supported file types: {', '.join(TEXT_FILE_TYPES)}",
|
||||
},
|
||||
"silent_errors": {
|
||||
"display_name": "Silent Errors",
|
||||
"advanced": True,
|
||||
"info": "If true, errors will not raise an exception.",
|
||||
},
|
||||
}
|
||||
|
||||
def load_file(self, path: str, silent_errors: bool = False) -> Record:
|
||||
resolved_path = self.resolve_path(path)
|
||||
path_obj = Path(resolved_path)
|
||||
extension = path_obj.suffix[1:].lower()
|
||||
if extension == "doc":
|
||||
raise ValueError("doc files are not supported. Please save as .docx")
|
||||
if extension not in TEXT_FILE_TYPES:
|
||||
raise ValueError(f"Unsupported file type: {extension}")
|
||||
record = parse_text_file_to_record(resolved_path, silent_errors)
|
||||
self.status = record if record else "No data"
|
||||
return record or Record()
|
||||
|
||||
def build(
|
||||
self,
|
||||
path: str,
|
||||
silent_errors: bool = False,
|
||||
) -> Record:
|
||||
record = self.load_file(path, silent_errors)
|
||||
self.status = record
|
||||
return record
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
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
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
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
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
# 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)
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
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}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
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
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
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
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
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
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
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
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
# 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