AIUIEngine

interface AIUIEngine

Shows the documents of one renderer in one conversation. The host makes one per renderer and keeps it while it is kept, so an engine can hold each reply's state, and a format whose later replies change an earlier one's UI can follow the conversation.

The host calls it on the main thread.

Functions

Link copied to clipboard
abstract fun content(document: AIUIDocument, messageId: String): @Composable () -> Unit?

The content of a reply's document, or null when it shows nothing of its own, such as a reply that only changed an earlier one's UI, so the reply's text shows.

Link copied to clipboard
open fun receive(document: AIUIDocument, messageId: String)

Takes a reply's document as it arrives or changes, oldest reply first, whether or not the reply is on screen, so a format whose later replies change an earlier one's UI can follow them all. It comes while the conversation composes, before any reply's content is asked for: keep what is on screen in snapshot state so it follows. Nothing by default.

Link copied to clipboard
open fun remove(messageId: String)

Forgets a reply that left the conversation, or whose UI did, such as one that was deleted, so the engine can let go of what it kept for it. Nothing by default.