Mixins

Mixins for Message classes.

class streamlit_rich_message_history.mixins.MessageBuilderMixin[source]

Bases: object

Mixin containing convenience methods for adding specific types of components to a message.

add(content, **kwargs)[source]

Add a component to the message with automatic type detection.

add_code(code, language='python', **kwargs)[source]

Add a code block component to the message.

add_custom(content, component_type, **kwargs)[source]

Add a custom component to the message.

add_dataframe(df, **kwargs)[source]

Add a pandas DataFrame component to the message.

add_dict(items, **kwargs)[source]

Add a dict component to the message.

add_error(error_text, **kwargs)[source]

Add an error component to the message.

add_html(html_content, **kwargs)[source]

Add an HTML component to the message.

add_json(data, **kwargs)[source]

Add a JSON component to the message.

add_list(items, **kwargs)[source]

Add a list component to the message.

add_matplotlib_figure(fig, **kwargs)[source]

Add a matplotlib figure component to the message.

add_metric(value, label=None, **kwargs)[source]

Add a metric component to the message.

add_number(number, **kwargs)[source]

Add a number component to the message.

add_plotly_figure(fig, **kwargs)[source]

Add a plotly figure component to the message.

add_series(series, **kwargs)[source]

Add a pandas Series component to the message.

add_table(data, **kwargs)[source]

Add a table component to the message.

add_text(text, **kwargs)[source]

Add a text component to the message.

add_tuple(items, **kwargs)[source]

Add a tuple component to the message.

components: List[MessageComponent]