PraisonAIUI supports rich inline message elements for displaying images, PDFs, videos, audio, files, and code blocks within chat messages.
Display images with thumbnail and click-to-zoom functionality.
Properties:
url
name
alt
display
width
height
Display PDF documents with inline viewer or link to open in new tab.
"inline"
"side"
"page"
Display videos with native HTML5 video player.
controls
autoplay
loop
Display audio with native HTML5 audio player.
Display downloadable files with file type icons and size information.
size
mime_type
Display syntax-highlighted code blocks with copy functionality.
content
language
All elements support three display modes:
inline
side
page
For advanced use cases, you can use the low-level element API:
The new element system maintains backward compatibility with existing message properties:
message.images
message.files
message.elements
This ensures existing code continues to work while providing a migration path to the new standardized element system.
When an agent or tool creates an image during a chat run, the UI receives message_element events over WebSocket/SSE and renders them inline. This uses the same element dict shape as above but is driven by the RunEvent protocol, not only Message.send().
message_element
Message.send()
See Image Preview in Chat for the full architecture: detection (media_utils), provider bridge, persistence, and swappable backends.
media_utils