Component Interfaces
The orchestrator’s builder accepts both standard Vaadin components and custom implementations of the AI interfaces. This allows you to swap in custom UI components without changing the orchestrator wiring.
AI Input
AIInput defines the contract for text input components. It has a single method:
-
addSubmitListener(SerializableConsumer<String>)— registers a listener that receives the submitted text.
The builder accepts either a MessageInput directly or any AIInput implementation.
AI Message List
AIMessageList defines the contract for displaying messages. Key methods:
-
addMessage(String text, String userName, List<AIAttachment> attachments)— creates and adds a message, returning anAIMessagehandle. -
addAttachmentClickListener(AttachmentClickCallback)— registers a handler for attachment click events. -
showTypingIndicator(String userName)/hideTypingIndicator(String userName)— show and hide an indication that the given participant is working on a response. The orchestrator calls the first when a turn starts and adds the assistant message only when the first part of the response arrives, so an implementation that wants to show progress before that overrides it. The second is called before the assistant message is added, and when a turn ends without a response. Both aredefaultno-ops, so a custom implementation that doesn’t override them keeps working.
The builder accepts either a MessageList directly or any AIMessageList implementation. With a MessageList, the orchestrator adds and removes only its own entry among the list’s typing users. When the application has bound the typing users to a signal, they can’t be set, and the orchestrator leaves the indicator to the application.
AI Message
AIMessage represents a single message. It is returned by AIMessageList.addMessage() and supports:
-
getText()/setText(String)— read or replace the message text. -
appendText(String)— append a token during streaming. The orchestrator calls this as tokens arrive from the LLM. -
getTime()/setTime(Instant)— message timestamp. -
getUserName()— the sender display name.
AI File Receiver
AIFileReceiver defines the contract for file upload components. It has a single method:
-
takeAttachments()— returns all pending attachments and clears the internal state. The orchestrator calls this when the user submits a message.
The builder accepts UploadManager, Upload, or any AIFileReceiver implementation.
The orchestrator installs its own in-memory upload handler on UploadManager or Upload. The component must not have an upload handler already set.