Class ThinkingStatusPublisher
- All Implemented Interfaces:
Serializable
AiMessageList: the ordered account of
what the assistant is doing, rendered above the thinking indicator while a
generation is in progress.
The feed is append-only. A caller appends with start(String),
changes a status only through the handle that returned, drops one with
remove(io.jmix.aichat.component.messagelist.ThinkingStatusItem), and wipes the feed with clear(); there is no bulk
setter and no way to reorder or replace an entry.
Threading. Statuses are normally published from a background thread
(a tool callback). Every method here mutates the server-side feed
synchronously and then schedules the client push itself — callers do not wrap
anything in UI.access. With no UI attached the model still updates and
the push is skipped; the list's attach-time re-push delivers the accumulated
feed. Reaching the browser from a background thread additionally requires
@Push (or polling) to be configured.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List<ThinkingStatusItem> protected AiMessageListprotected longMonotonic id source. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Drops every status, detaching every handle.getItems()The statuses of the current generation, in insertion order.protected voidCalled by an item that mutated itself, to push the feed to the client.protected tools.jackson.databind.node.ArrayNodeSerializes the feed under this publisher's lock, so a concurrent mutation cannot be observed half-written.voidremove(ThinkingStatusItem item) Drops one status from the feed, detaching its handle.Appends a new in-flight status and returns the handle to it.
-
Field Details
-
list
-
items
-
nextId
protected long nextIdMonotonic id source. Never reset — including byclear()— so an id cannot be reused while a client row still carries the old one.
-
-
Constructor Details
-
ThinkingStatusPublisher
-
-
Method Details
-
start
Appends a new in-flight status and returns the handle to it.- Parameters:
text- what the status is doing, notnulland not blank- Returns:
- the handle, to be completed through
ThinkingStatusItem.complete()
-
remove
Drops one status from the feed, detaching its handle. A no-op if the item is not in the feed.- Parameters:
item- the status to drop, notnull
-
getItems
The statuses of the current generation, in insertion order. An immutable snapshot rather than a live view: the feed is mutated from background threads, and a view would fail the caller's iteration.- Returns:
- an immutable snapshot of the feed
-
clear
public void clear()Drops every status, detaching every handle. -
itemChanged
protected void itemChanged()Called by an item that mutated itself, to push the feed to the client. -
itemsJson
protected tools.jackson.databind.node.ArrayNode itemsJson()Serializes the feed under this publisher's lock, so a concurrent mutation cannot be observed half-written.
-