✨ (TextInput.py): Add MultilineInput class to support multiline input for data_template field
♻️ (TextInput.py): Remove unnecessary code for handling Message type input_value in text_response method
This commit is contained in:
parent
bb847db2b8
commit
36da9172e7
1 changed files with 3 additions and 12 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue