chat_ui
chat_ui(id,
*,
=None,
messages='Enter a message...',
placeholder='min(680px, 100%)',
width='auto',
height=True,
fill=None,
icon_assistant**kwargs,
)
UI container for a chat component (Shiny Core).
This function is for locating a :class:~shiny.ui.Chat
instance in a Shiny Core app. If you are using Shiny Express, use the :method:~shiny.ui.Chat.ui
method instead.
Parameters
Name | Type | Description | Default |
---|---|---|---|
id | str | A unique identifier for the chat UI. | required |
messages | Optional[Sequence[TagChild | ChatMessageDict]] | A sequence of messages to display in the chat. A given message can be one of the following: * A string, which is interpreted as markdown and rendered to HTML on the client. * To prevent interpreting as markdown, mark the string as :class:~shiny.ui.HTML . * A UI element (specifically, a :class:~shiny.ui.TagChild ). * This includes :class:~shiny.ui.TagList , which take UI elements (including strings) as children. In this case, strings are still interpreted as markdown as long as they’re not inside HTML. * A dictionary with content and role keys. The content key can contain a content as described above, and the role key can be “assistant” or “user”. NOTE: content may include specially formatted input suggestion links (see :method:~shiny.ui.Chat.append_message for more info). |
None |
placeholder | str | Placeholder text for the chat input. | 'Enter a message...' |
width | CssUnit | The width of the chat container. | 'min(680px, 100%)' |
height | CssUnit | The height of the chat container. | 'auto' |
fill | bool | Whether the chat should vertically take available space inside a fillable container. | True |
icon_assistant | HTML | Tag | TagList | None | The icon to use for the assistant chat messages. Can be a HTML or a tag in the form of :class:~htmltools.HTML or :class:~htmltools.Tag . If None , a default robot icon is used. |
None |
kwargs | TagAttrValue | Additional attributes for the chat container element. | {} |