Enum Class AiMessageRole

java.lang.Object
java.lang.Enum<AiMessageRole>
io.jmix.aichat.entity.AiMessageRole
All Implemented Interfaces:
EnumClass<String>, Serializable, Comparable<AiMessageRole>, Constable

public enum AiMessageRole extends Enum<AiMessageRole> implements EnumClass<String>
The role of a message in the AiChatMessage contract: who authored the conversation turn. An EnumClass over String, so an application entity declares its attribute as this type while the database column stays a string holding getId() — the standard Jmix enum-attribute shape, which Studio generates.

Distinct from MessageRole, which is the rendering discriminator of AiMessageListItem: this one says who wrote the message, that one says how the message list draws it. AiChat projects this role onto that one.

  • Enum Constant Details

    • USER

      public static final AiMessageRole USER
      A message authored by the end user.
    • ASSISTANT

      public static final AiMessageRole ASSISTANT
      A message authored by the assistant (the model).
  • Method Details

    • values

      public static AiMessageRole[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static AiMessageRole valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • fromId

      public static @Nullable AiMessageRole fromId(@Nullable String id)
      Returns the role stored under the given id.
      Parameters:
      id - the stored id, or null
      Returns:
      the matching role, or null if the id is null or unknown
    • getId

      public String getId()
      Specified by:
      getId in interface EnumClass<String>