Class ThinkingStatusItem

java.lang.Object
io.jmix.aichat.component.messagelist.ThinkingStatusItem
All Implemented Interfaces:
Serializable

public class ThinkingStatusItem extends Object implements Serializable
One reported unit of work shown in the thinking region of an AiMessageList while the assistant is working — typically a tool call.

Instances come from ThinkingStatusPublisher.start(String), which returns the handle its caller keeps for the lifetime of the work:

 ThinkingStatusItem item = chat.getThinkingStatusPublisher().start("Searching customers by name");
 List<Customer> found = repository.searchByName(name);
 item.complete("found " + found.size());
 

An item is mutable while in flight and frozen once completed: after complete(), both update(java.lang.String) and a second completion throw IllegalStateException. An item that has been dropped from its feed (by ThinkingStatusPublisher.remove(io.jmix.aichat.component.messagelist.ThinkingStatusItem) or ThinkingStatusPublisher.clear()) is detached, and its mutators become silent no-ops instead — a turn ending underneath a still-running background thread is not a caller error.

See Also:
  • Field Details

    • id

      protected String id
    • text

      protected String text
    • detail

      protected @Nullable String detail
    • completed

      protected boolean completed
    • owner

      protected @Nullable ThinkingStatusPublisher owner
      The owning feed, or null once this item has been detached from it. Deliberately not transient: the publisher's own list already keeps this item reachable, so marking it transient would buy nothing and would silently detach every in-flight handle across session passivation.
  • Constructor Details

    • ThinkingStatusItem

      protected ThinkingStatusItem(String id, String text)
  • Method Details

    • getId

      public String getId()
      Returns:
      the identity the client keys its rendered row by; unique within the feed
    • getText

      public String getText()
      Returns:
      the text describing what this status is doing
    • update

      public void update(String text)
      Re-states what this status is currently doing, e.g. "Reading document 1 of 5" becoming "Reading document 3 of 5". A no-op on a detached item.
      Parameters:
      text - the new text, not null and not blank
      Throws:
      IllegalStateException - if this item has already been completed
    • getDetail

      public @Nullable String getDetail()
      Returns:
      the short result of a completed status, or null if there is none
    • isCompleted

      public boolean isCompleted()
      Whether this status has finished. An explicit flag: a status completed with nothing to report is completed all the same.
      Returns:
      whether this status has finished
    • complete

      public void complete()
      Completes this status with nothing to report. A no-op on a detached item.
      Throws:
      IllegalStateException - if this item has already been completed
    • complete

      public void complete(@Nullable String detail)
      Completes this status. A no-op on a detached item.
      Parameters:
      detail - a short result of the finished work, or null
      Throws:
      IllegalStateException - if this item has already been completed
    • checkNotCompleted

      protected void checkNotCompleted()