-
Notifications
You must be signed in to change notification settings - Fork 218
docs: add ai component docs and update ai quickstart #5213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
02951a2
a90df07
f4eaaa4
fe8c5e3
44d782a
6a70726
3722525
50e6e51
0da2d90
1ba496a
a646024
360851d
a5dc8c1
38ae41e
1c92e25
b817717
d141e6d
f966157
80744d2
a632f77
ed9e78c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| --- | ||
| title: Component Interfaces | ||
| description: AI interface contracts for input, message list, message, and file receiver components used by the AIOrchestrator. | ||
|
Check failure on line 3 in articles/flow/ai-support/component-interfaces.adoc
|
||
| meta-description: Learn about AIInput, AIMessageList, AIMessage, and AIFileReceiver interfaces that define contracts for UI components used by the Vaadin AIOrchestrator. | ||
|
Check failure on line 4 in articles/flow/ai-support/component-interfaces.adoc
|
||
| order: 10 | ||
| --- | ||
|
|
||
|
|
||
| = Component Interfaces | ||
|
|
||
| ifdef::flow[] | ||
|
|
||
| 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 | ||
|
|
||
| [classname]`AIInput` defines the contract for text input components. It has a single method: | ||
|
|
||
| * [methodname]`addSubmitListener(SerializableConsumer<String>)` -- registers a listener that receives the submitted text. | ||
|
|
||
| The builder accepts either a <<{articles}/components/message-input#,[classname]`MessageInput`>> directly or any [classname]`AIInput` implementation. | ||
|
|
||
|
|
||
| == AI Message List | ||
|
|
||
| [classname]`AIMessageList` defines the contract for displaying messages. Key methods: | ||
|
|
||
| * [methodname]`addMessage(String text, String userName, List<AIAttachment> attachments)` -- creates and adds a message, returning an [classname]`AIMessage` handle. | ||
| * [methodname]`addAttachmentClickListener(AttachmentClickCallback)` -- registers a handler for attachment click events. | ||
|
|
||
| The builder accepts either a <<{articles}/components/message-list#,[classname]`MessageList`>> directly or any [classname]`AIMessageList` implementation. | ||
|
|
||
| == AI Message | ||
|
|
||
| [classname]`AIMessage` represents a single message. It is returned by [methodname]`AIMessageList.addMessage()` and supports: | ||
|
|
||
| * [methodname]`getText()` / [methodname]`setText(String)` -- read or replace the message text. | ||
| * [methodname]`appendText(String)` -- append a token during streaming. The orchestrator calls this as tokens arrive from the LLM. | ||
| * [methodname]`getTime()` / [methodname]`setTime(Instant)` -- message timestamp. | ||
| * [methodname]`getUserName()` -- the sender display name. | ||
|
|
||
|
|
||
| == AI File Receiver | ||
|
|
||
| [classname]`AIFileReceiver` defines the contract for file upload components. It has a single method: | ||
|
|
||
| * [methodname]`takeAttachments()` -- returns all pending attachments and clears the internal state. The orchestrator calls this when the user submits a message. | ||
|
|
||
| The builder accepts <<{articles}/components/upload#,[classname]`UploadManager`>>, <<{articles}/components/upload#,[classname]`Upload`>>, or any [classname]`AIFileReceiver` implementation. | ||
|
|
||
| The orchestrator installs its own in-memory upload handler on <<{articles}/components/upload#,[classname]`UploadManager`>> or <<{articles}/components/upload#,[classname]`Upload`>>. The component must not have an upload handler already set. | ||
|
|
||
| endif::flow[] | ||
Uh oh!
There was an error while loading. Please reload this page.