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.
This commit is contained in:
parent
13ef60c4e3
commit
a81e81b0fc
1 changed files with 7 additions and 9 deletions
|
|
@ -1,7 +1,8 @@
|
|||
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 Input, Output
|
||||
from langflow.template import Output
|
||||
|
||||
|
||||
class ChatInput(ChatComponent):
|
||||
|
|
@ -10,25 +11,23 @@ class ChatInput(ChatComponent):
|
|||
icon = "ChatInput"
|
||||
|
||||
inputs = [
|
||||
Input(
|
||||
StrInput(
|
||||
name="input_value",
|
||||
type=str,
|
||||
display_name="Text",
|
||||
multiline=True,
|
||||
input_types=[],
|
||||
info="Message to be passed as input.",
|
||||
),
|
||||
Input(
|
||||
DropdownInput(
|
||||
name="sender",
|
||||
type=str,
|
||||
display_name="Sender Type",
|
||||
options=["Machine", "User"],
|
||||
value="User",
|
||||
info="Type of sender.",
|
||||
advanced=True,
|
||||
),
|
||||
Input(name="sender_name", type=str, display_name="Sender Name", info="Name of the sender.", value="User"),
|
||||
Input(
|
||||
StrInput(name="sender_name", type=str, display_name="Sender Name", info="Name of the sender.", value="User"),
|
||||
StrInput(
|
||||
name="session_id", type=str, display_name="Session ID", info="Session ID for the message.", advanced=True
|
||||
),
|
||||
]
|
||||
|
|
@ -40,8 +39,7 @@ class ChatInput(ChatComponent):
|
|||
def text_response(self) -> Text:
|
||||
result = self.input_value
|
||||
if self.session_id:
|
||||
message = self.message_response()
|
||||
self.store_message(message)
|
||||
self.message_response()
|
||||
self.status = result
|
||||
return result
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue