meerkat.interactive.app.src.lib.component.core.Chat
meerkat.interactive.app.src.lib.component.core.Chat¶
- class Chat(*, df: meerkat.dataframe.DataFrame, img_chatbot: str = 'http://placekitten.com/200/300', img_user: str = 'http://placekitten.com/200/300', on_send: Optional[meerkat.interactive.endpoint.Endpoint[meerkat.interactive.app.src.lib.component.core.chat.OnSendChat]] = None, **kwargs)[source]¶
A chat component.
- Parameters
df (DataFrame) – The dataframe to sync with the chat. It must have the following columns: message (str): The message to display. name (str): The name of the sender. time (str): The time the message was sent. sender (str): The sender of the message. Must be either “user” or “chatbot”.
imgChatbot (str) – The image to display for the chatbot, as a URL.
imgUser (str) – The image to display for the user, as a URL.
on_send –
The Endpoint to call when a message is sent. It must have the following signature:
(message: str)
- with
message (str): The message sent by the user.
- __init__(**kwargs)¶
Methods
__init__
(**kwargs)append
(other)construct
([_fields_set])Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data.
copy
(*[, include, exclude, update, deep])Duplicate a model, optionally choose which fields to include, exclude and change.
dict
(*[, include, exclude, by_alias, ...])Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
from_id
(id)from_orm
(obj)get_components
()json
(*[, include, exclude, by_alias, ...])Generate a JSON representation of the model, include and exclude arguments as per dict().
parse_file
(path, *[, content_type, ...])parse_obj
(obj)parse_raw
(b, *[, content_type, encoding, ...])prepend_meerkat_id_prefix
(id)schema
([by_alias, ref_template])schema_json
(*[, by_alias, ref_template])update_forward_refs
(**localns)Try to update ForwardRefs on fields based on this Model, globalns and localns.
validate
(value)Attributes
alias
component_name
event_names
events
frontend
Returns a Pydantic model that can be should be sent to the frontend.
frontend_alias
id
identifiable_group
library
namespace
path
prop_bindings
prop_names
props
slots
slottable
virtual_props
Props, and all events (as_*) as props.
wrapper_import_style
df
img_chatbot
img_user
on_send