From 2a1c6e76a52fffaf7805968ee8382c7c0c3fe717 Mon Sep 17 00:00:00 2001 From: Rodrigo Date: Wed, 12 Jun 2024 17:52:12 -0300 Subject: [PATCH] refactor: Update ChatInput inputs to use specific input classes Update the inputs of the ChatInput class in ChatInput.py to use specific input classes such as StrInput and DropdownInput. This change improves the organization and separation of concerns in the codebase, making it easier to understand and maintain. --- .../langflow/components/inputs/ChatInput.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/backend/base/langflow/components/inputs/ChatInput.py b/src/backend/base/langflow/components/inputs/ChatInput.py index 344d868b9..459d7b70b 100644 --- a/src/backend/base/langflow/components/inputs/ChatInput.py +++ b/src/backend/base/langflow/components/inputs/ChatInput.py @@ -1,5 +1,4 @@ from langflow.base.io.chat import ChatComponent -from langflow.field_typing import Text from langflow.inputs import DropdownInput, StrInput from langflow.schema.message import Message from langflow.template import Output @@ -26,23 +25,22 @@ class ChatInput(ChatComponent): info="Type of sender.", advanced=True, ), - StrInput(name="sender_name", type=str, display_name="Sender Name", info="Name of the sender.", value="User"), + StrInput( + name="sender_name", + type=str, + display_name="Sender Name", + info="Name of the sender.", + value="User", + advanced=True, + ), StrInput( name="session_id", type=str, display_name="Session ID", info="Session ID for the message.", advanced=True ), ] outputs = [ - Output(display_name="Text", name="text", method="text_response"), Output(display_name="Message", name="message", method="message_response"), ] - def text_response(self) -> Text: - result = self.input_value - if self.session_id: - self.message_response() - self.status = result - return result - def message_response(self) -> Message: message = Message( text=self.input_value,