From 042ea079771efd9806b100284e456a87e23a658b Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Sun, 25 Feb 2024 12:33:29 -0300 Subject: [PATCH] Refactor TextInput and add TextOutput component --- .../langflow/components/io/TextInput.py | 3 --- .../langflow/components/io/TextOutput.py | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 src/backend/langflow/components/io/TextOutput.py diff --git a/src/backend/langflow/components/io/TextInput.py b/src/backend/langflow/components/io/TextInput.py index 3f0125b1a..b0d2eb0a7 100644 --- a/src/backend/langflow/components/io/TextInput.py +++ b/src/backend/langflow/components/io/TextInput.py @@ -9,9 +9,6 @@ class TextInput(CustomComponent): description = "Used to pass text input to the next component." field_config = { - "code": { - "show": False, - }, "value": {"display_name": "Value"}, } diff --git a/src/backend/langflow/components/io/TextOutput.py b/src/backend/langflow/components/io/TextOutput.py new file mode 100644 index 000000000..d3fd37f66 --- /dev/null +++ b/src/backend/langflow/components/io/TextOutput.py @@ -0,0 +1,19 @@ +from typing import Optional + +from langflow import CustomComponent +from langflow.field_typing import Text + + +class TextOutput(CustomComponent): + display_name = "Text Output" + description = "Used to pass text output to the next component." + + field_config = { + "value": {"display_name": "Value"}, + } + + def build(self, value: Optional[str] = "") -> Text: + self.status = value + if not value: + value = "" + return value