chat class
A control that provides the user interface for chatting.
Methods¶
__init__() ¶
__init__(
messages=None,
users=None,
sender_id="taipy",
with_input=True,
on_action=None,
page_size=50,
height=None,
show_sender=False,
mode="markdown",
max_file_size=0.8 * 1024 * 1024,
allow_send_images=False,
active=True,
id=None,
properties=None,
class_name=None,
hover_text=None,
) -> None
Create a new chat element.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
messages
|
dynamic(list[str])
|
The list of messages. Each item of this list must consist of a list of three strings: a message identifier, a message content, and a user identifier. |
None
|
users
|
dynamic(list[Union[str, Icon]])
|
The list of users. See the section on List of Values for more details. |
None
|
sender_id
|
str
|
The user identifier, as indicated in the users list, associated with all messages sent from the input. |
taipy
|
with_input
|
dynamic(bool)
|
If False, the input field is not rendered. |
True
|
on_action
|
Union[str, Callable]
|
A function or the name of a function that is triggered when the user enters a new message.
|
None
|
page_size
|
int
|
The number of messages retrieved from the application and sent to the frontend. Larger values imply more potential latency. |
50
|
height
|
Union[str, int, float]
|
The maximum height of the chat control, in CSS units. |
None
|
show_sender
|
bool
|
If True, the sender avatar and name are displayed. |
False
|
mode
|
str
|
Define the way the messages are processed when they are displayed:
|
markdown
|
max_file_size
|
int
|
The maximum allowable file size, in bytes, for files uploaded to a chat message. |
0.8 * 1024 * 1024
|
allow_send_images
|
bool
|
If True, the "Upload image" button is visible. |
False
|
active
|
dynamic(bool)
|
Indicates if this element is active. |
True
|
id
|
str
|
The identifier assigned to the rendered HTML component. |
None
|
properties
|
dict[str, Any]
|
A dictionary of additional properties that can be set to the element. |
None
|
class_name
|
dynamic(str)
|
A space-separated list of CSS class names to be applied to the generated HTML element. |
None
|
hover_text
|
dynamic(str)
|
The text that is displayed when the user hovers over the element. |
None
|