From 36da9172e7e705a7681114ec86c09430b2530128 Mon Sep 17 00:00:00 2001 From: ogabrielluiz Date: Thu, 13 Jun 2024 00:06:51 -0300 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20(TextInput.py):=20Add=20MultilineIn?= =?UTF-8?q?put=20class=20to=20support=20multiline=20input=20for=20data=5Ft?= =?UTF-8?q?emplate=20field?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ♻️ (TextInput.py): Remove unnecessary code for handling Message type input_value in text_response method --- .../base/langflow/components/inputs/TextInput.py | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/backend/base/langflow/components/inputs/TextInput.py b/src/backend/base/langflow/components/inputs/TextInput.py index 9db7f0481..0c759c4e1 100644 --- a/src/backend/base/langflow/components/inputs/TextInput.py +++ b/src/backend/base/langflow/components/inputs/TextInput.py @@ -1,8 +1,7 @@ from langflow.base.io.text import TextComponent from langflow.field_typing import Text -from langflow.inputs import StrInput +from langflow.inputs import MultilineInput, StrInput from langflow.template import Output -from langflow.schema.message import Message class TextInput(TextComponent): @@ -13,15 +12,12 @@ class TextInput(TextComponent): inputs = [ StrInput( name="input_value", - type=str, display_name="Text", info="Text to be passed as input.", - input_types=["Text", "Message"], ), - StrInput( + MultilineInput( name="data_template", display_name="Data Template", - multiline=True, info="Template to convert Data to Text. If left empty, it will be dynamically set to the Data's text key.", advanced=True, value="{text}", @@ -32,9 +28,4 @@ class TextInput(TextComponent): ] def text_response(self) -> Text: - if isinstance(self.input_value, Message): - text = self.input_value.text - else: - text = self.input_value - - return self.build(input_value=text, data_template=self.data_template) + return self.build(input_value=self.input_value, data_template=self.data_template)