Class SimpleAiChatMessage

java.lang.Object
io.jmix.aichat.data.SimpleAiChatMessage
All Implemented Interfaces:
AiChatMessage, Serializable

public class SimpleAiChatMessage extends Object implements AiChatMessage
Built-in mutable AiChatMessage used by AiChat when the application does not supply its own message type.
See Also:
  • Field Details

  • Constructor Details

    • SimpleAiChatMessage

      public SimpleAiChatMessage(AiMessageRole role, String content)
      Creates a message.
      Parameters:
      role - the sender role, not null
      content - the text content, not null
    • SimpleAiChatMessage

      public SimpleAiChatMessage(AiMessageRole role, String content, List<FileRef> attachments)
      Creates a message with attachments.
      Parameters:
      role - the sender role, not null
      content - the text content, not null
      attachments - the file attachments, not null
  • Method Details

    • getRole

      public AiMessageRole getRole()
      Description copied from interface: AiChatMessage
      The role of the message sender.
      Specified by:
      getRole in interface AiChatMessage
      Returns:
      the role, never null
    • setRole

      public void setRole(AiMessageRole role)
      Sets the sender role.
      Parameters:
      role - the sender role, not null
    • getContent

      public String getContent()
      Description copied from interface: AiChatMessage
      The text content of the message.
      Specified by:
      getContent in interface AiChatMessage
      Returns:
      the text content of the message, never null
    • setContent

      public void setContent(String content)
      Sets the text content.
      Parameters:
      content - the text content, not null
    • getAttachments

      public List<FileRef> getAttachments()
      Description copied from interface: AiChatMessage
      The files attached to this message, as references into Jmix file storage. An application backs this with an @ElementCollection List<FileRef>, a child-entity collection, or a computed getter — AiChat only reads the list.
      Specified by:
      getAttachments in interface AiChatMessage
      Returns:
      the attachments, never null (empty by default)
    • setAttachments

      public void setAttachments(List<FileRef> attachments)
      Sets the file attachments, replacing any current ones.
      Parameters:
      attachments - the attachments to set, not null
    • getTime

      public @Nullable Instant getTime()
      Description copied from interface: AiChatMessage
      Optional creation timestamp.
      Specified by:
      getTime in interface AiChatMessage
      Returns:
      the timestamp, or null if none
    • setTime

      public void setTime(@Nullable Instant time)
      Sets the optional creation timestamp.
      Parameters:
      time - the timestamp, or null