Package io.jmix.aichat.data
Class SimpleAiChatMessage
java.lang.Object
io.jmix.aichat.data.SimpleAiChatMessage
- All Implemented Interfaces:
AiChatMessage,Serializable
Built-in mutable
AiChatMessage used by
AiChat when the application does not supply its own
message type.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected AiMessageRoleprotected @Nullable Instant -
Constructor Summary
ConstructorsConstructorDescriptionSimpleAiChatMessage(AiMessageRole role, String content) Creates a message.SimpleAiChatMessage(AiMessageRole role, String content, List<FileRef> attachments) Creates a message with attachments. -
Method Summary
Modifier and TypeMethodDescriptionThe files attached to this message, as references into Jmix file storage.The text content of the message.getRole()The role of the message sender.@Nullable InstantgetTime()Optional creation timestamp.voidsetAttachments(List<FileRef> attachments) Sets the file attachments, replacing any current ones.voidsetContent(String content) Sets the text content.voidsetRole(AiMessageRole role) Sets the sender role.voidSets the optional creation timestamp.
-
Field Details
-
role
-
-
time
-
attachments
-
-
Constructor Details
-
SimpleAiChatMessage
Creates a message.- Parameters:
role- the sender role, notnullcontent- the text content, notnull
-
SimpleAiChatMessage
Creates a message with attachments.- Parameters:
role- the sender role, notnullcontent- the text content, notnullattachments- the file attachments, notnull
-
-
Method Details
-
getRole
Description copied from interface:AiChatMessageThe role of the message sender.- Specified by:
getRolein interfaceAiChatMessage- Returns:
- the role, never
null
-
setRole
Sets the sender role.- Parameters:
role- the sender role, notnull
-
getContent
Description copied from interface:AiChatMessageThe text content of the message.- Specified by:
getContentin interfaceAiChatMessage- Returns:
- the text content of the message, never
null
-
setContent
Sets the text content.- Parameters:
content- the text content, notnull
-
getAttachments
Description copied from interface:AiChatMessageThe 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 —AiChatonly reads the list.- Specified by:
getAttachmentsin interfaceAiChatMessage- Returns:
- the attachments, never
null(empty by default)
-
setAttachments
Sets the file attachments, replacing any current ones.- Parameters:
attachments- the attachments to set, notnull
-
getTime
Description copied from interface:AiChatMessageOptional creation timestamp.- Specified by:
getTimein interfaceAiChatMessage- Returns:
- the timestamp, or
nullif none
-
setTime
Sets the optional creation timestamp.- Parameters:
time- the timestamp, ornull
-