Package io.jmix.aichat.data
Class ListAiChatItems<T extends AiChatMessage>
java.lang.Object
io.jmix.aichat.data.AbstractAiChatItems<T>
io.jmix.aichat.data.ListAiChatItems<T>
- Type Parameters:
T- the application's message type
- All Implemented Interfaces:
AiChatItems<T>,DataUnit,Serializable
In-memory
AiChatItems implementation. This is the default source of
an unbound AiChat, so a chat that was never given items can still
generate into memory.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.jmix.aichat.data.AiChatItems
AiChatItems.ItemsChangeEvent<T extends AiChatMessage>, AiChatItems.ItemsChangeTypeNested classes/interfaces inherited from interface io.jmix.flowui.data.DataUnit
DataUnit.StateChangeEvent -
Field Summary
FieldsFields inherited from class io.jmix.aichat.data.AbstractAiChatItems
eventBus -
Constructor Summary
ConstructorsConstructorDescriptionCreates an empty in-memory unit.ListAiChatItems(Collection<T> items) Creates a unit over a copy of the given messages, so mutations work even when the argument is immutable. -
Method Summary
Methods inherited from class io.jmix.aichat.data.AbstractAiChatItems
addItemsChangeListener, addStateChangeListener, fireItemsChangeEvent, getEventBus, getState
-
Field Details
-
items
-
-
Constructor Details
-
ListAiChatItems
public ListAiChatItems()Creates an empty in-memory unit. -
ListAiChatItems
Creates a unit over a copy of the given messages, so mutations work even when the argument is immutable.- Parameters:
items- the initial messages
-
-
Method Details
-
getItems
Description copied from interface:AiChatItemsReturns the messages in render order. The returned list is not modifiable; useAiChatItems.addItem(AiChatMessage)andAiChatItems.removeItem(AiChatMessage)instead.- Returns:
- the messages in render order
-
addItem
Description copied from interface:AiChatItemsAppends a message to the end of the conversation. Implementations must fire anAiChatItems.ItemsChangeEventof typeAiChatItems.ItemsChangeType.ADD—AiChatre-renders on that notification alone, so a silent mutation leaves the message unrendered.- Parameters:
item- the message to append
-
removeItem
Description copied from interface:AiChatItemsRemoves a message from the conversation. Does nothing when the message is not present. Implementations must fire anAiChatItems.ItemsChangeEventof typeAiChatItems.ItemsChangeType.REMOVEfor an actual removal —AiChatre-renders on that notification alone, so a silent mutation leaves the message rendered.- Parameters:
item- the message to remove
-