refactor: Improve advanced options in ChatComponent, URLComponent, and MessageHistoryComponent
This commit is contained in:
parent
6cc31da766
commit
49bdbef548
5 changed files with 10 additions and 7 deletions
|
|
@ -23,7 +23,7 @@ class ChatComponent(CustomComponent):
|
|||
"display_name": "Sender Type",
|
||||
"advanced": True,
|
||||
},
|
||||
"sender_name": {"display_name": "Sender Name"},
|
||||
"sender_name": {"display_name": "Sender Name", "advanced": True},
|
||||
"session_id": {
|
||||
"display_name": "Session ID",
|
||||
"info": "If provided, the message will be stored in the memory.",
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class URLComponent(CustomComponent):
|
|||
self,
|
||||
urls: list[str],
|
||||
) -> list[Record]:
|
||||
loader = WebBaseLoader(web_paths=urls)
|
||||
loader = WebBaseLoader(web_paths=[url for url in urls if url])
|
||||
docs = loader.load()
|
||||
records = self.to_records(docs)
|
||||
self.status = records
|
||||
|
|
|
|||
|
|
@ -6,25 +6,27 @@ from langflow.schema import Record
|
|||
|
||||
|
||||
class MessageHistoryComponent(CustomComponent):
|
||||
display_name = "Message History"
|
||||
description = "Retrieves stored chat messages given a specific Session ID."
|
||||
beta: bool = True
|
||||
display_name = "Memory"
|
||||
description = "Retrieves stored chat messages."
|
||||
|
||||
def build_config(self):
|
||||
return {
|
||||
"sender": {
|
||||
"options": ["Machine", "User", "Machine and User"],
|
||||
"display_name": "Sender Type",
|
||||
"advanced": True,
|
||||
},
|
||||
"sender_name": {"display_name": "Sender Name", "advanced": True},
|
||||
"n_messages": {
|
||||
"display_name": "Number of Messages",
|
||||
"info": "Number of messages to retrieve.",
|
||||
"advanced": True,
|
||||
},
|
||||
"session_id": {
|
||||
"display_name": "Session ID",
|
||||
"info": "Session ID of the chat history.",
|
||||
"input_types": ["Text"],
|
||||
"advanced": True,
|
||||
},
|
||||
"order": {
|
||||
"options": ["Ascending", "Descending"],
|
||||
|
|
@ -39,7 +41,7 @@ class MessageHistoryComponent(CustomComponent):
|
|||
sender: Optional[str] = "Machine and User",
|
||||
sender_name: Optional[str] = None,
|
||||
session_id: Optional[str] = None,
|
||||
n_messages: int = 5,
|
||||
n_messages: int = 100,
|
||||
order: Optional[str] = "Descending",
|
||||
) -> List[Record]:
|
||||
order = "DESC" if order == "Descending" else "ASC"
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ class RecordsToTextComponent(CustomComponent):
|
|||
"template": {
|
||||
"display_name": "Template",
|
||||
"info": "The template to use for formatting the records. It can contain the keys {text}, {data} or any other key in the Record.",
|
||||
"multiline": True,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ export default function SelectionMenu({
|
|||
className={`${
|
||||
disable
|
||||
? "flex h-full w-full cursor-not-allowed items-center justify-between text-sm text-muted-foreground"
|
||||
: "flex h-full w-full items-center justify-between text-sm hover:text-indigo-500"
|
||||
: "flex h-full w-full items-center justify-between text-sm"
|
||||
}`}
|
||||
onClick={onClick}
|
||||
disabled={disable}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue