Update TextInput and ChatOutput build methods

This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-03-29 16:19:41 -03:00
commit 0cf2229ff1
3 changed files with 11 additions and 9 deletions

View file

@ -6,7 +6,11 @@ from langflow.field_typing import Text
class TextInput(TextComponent): class TextInput(TextComponent):
display_name = "Text Input" display_name = "Text Input"
description = "Capture and send text inputs." description = "Capture Text or Record and send text inputs."
def build(self, input_value: Optional[str] = "") -> Text: def build(
return super().build(input_value=input_value) self,
input_value: Optional[str] = "",
record_template: Optional[str] = "{text}",
) -> Text:
return super().build(input_value=input_value, record_template=record_template)

View file

@ -17,6 +17,7 @@ class ChatOutput(ChatComponent):
input_value: Optional[str] = None, input_value: Optional[str] = None,
session_id: Optional[str] = None, session_id: Optional[str] = None,
return_record: Optional[bool] = False, return_record: Optional[bool] = False,
record_template: Optional[str] = "{text}",
) -> Union[Text, Record]: ) -> Union[Text, Record]:
return super().build( return super().build(
sender=sender, sender=sender,
@ -24,4 +25,5 @@ class ChatOutput(ChatComponent):
input_value=input_value, input_value=input_value,
session_id=session_id, session_id=session_id,
return_record=return_record, return_record=return_record,
record_template=record_template,
) )

View file

@ -8,9 +8,5 @@ class TextOutput(TextComponent):
display_name = "Text Output" display_name = "Text Output"
description = "Used to send a text output." description = "Used to send a text output."
field_config = { def build(self, input_value: Optional[Text] = "", record_template: str = "{text}") -> Text:
"input_value": {"display_name": "Value"}, return super().build(input_value=input_value, record_template=record_template)
}
def build(self, input_value: Optional[Text] = "") -> Text:
return super().build(input_value=input_value)