Class ActorNameResolver

java.lang.Object
io.jmix.aitoolsflowui.view.chat.support.ActorNameResolver

@Component("aitls_ActorNameResolver") public class ActorNameResolver extends Object
Resolves a human-readable actor name for a user-authored AiChatMessage.

For messages authored by the currently logged-in user, returns the user's instance name (preferred) or, failing that, the username. For messages authored by someone else (admin viewing another user's conversation), returns the raw createdBy string. Falls back to a configurable default if both sources are blank.

The add-on does not assume a particular User class, so unlike the CRM equivalent this resolver relies on MetadataTools.getInstanceName(java.lang.Object) to render whichever User entity the consumer application uses.

  • Field Details

  • Constructor Details

    • ActorNameResolver

      public ActorNameResolver()
  • Method Details

    • resolve

      public String resolve(@Nullable AiChatMessage message, String defaultActorName)
      Resolves the display name of the actor that authored the given message.
      Parameters:
      message - message whose author is resolved
      defaultActorName - name to fall back to when the author cannot be determined
      Returns:
      the resolved actor name