Class ContainerAiChatItems<T extends AiChatMessage>

java.lang.Object
io.jmix.aichat.data.AbstractAiChatItems<T>
io.jmix.aichat.data.ContainerAiChatItems<T>
Type Parameters:
T - the application's message type
All Implemented Interfaces:
AiChatItems<T>, ContainerDataUnit<T>, DataUnit, EntityDataUnit, Serializable

public class ContainerAiChatItems<T extends AiChatMessage> extends AbstractAiChatItems<T> implements ContainerDataUnit<T>
AiChatItems implementation over a Jmix CollectionContainer: the container is the source of truth, and generated messages are appended to it, so the chat takes part in the view's ordinary load and save cycle.

Whether a message is tracked by a DataContext is decided by the AiChatMessageFactory that creates it; this unit only stores instances and never saves anything.

Messages are rendered in container order, so the loader must sort them chronologically ascending — on the entity's own persistent timestamp attribute, not on the derived AiChatMessage.getTime() property. This unit neither sorts nor validates; AiChat warns once per binding when the order it reads here is not ascending. A timestamp stamped per entity at prePersist does not order two messages saved in one commit, so a loader batching a turn needs a deterministic tiebreaker.

See Also: