Class AiChatMessageDataService
java.lang.Object
io.jmix.aitoolsflowuidata.service.impl.AiChatMessageDataService
- All Implemented Interfaces:
AiChatMessageService
Default
AiChatMessageService backed by persisted AiChatMessageEntity entities,
mapped to and from the AiChatMessage model.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CurrentUserSubstitutionprotected UnconstrainedDataManagerprotected AiChatMessageConverter -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckOwner(AiConversationEntity conversation) createMessage(AiConversation conversation, AiChatMessageType type, String message) Creates a new message of the given type in the conversation.protected Stringprotected @Nullable AiConversationEntityloadAiConversation(@Nullable UUID conversationId) @Nullable AiChatMessageloadLatestMessage(AiConversation conversation, @Nullable AiChatMessageType type) Loads the most recent message of the conversation, optionally restricted to a type.loadMessages(AiConversation conversation) Loads all messages of the conversation, oldest first.
-
Field Details
-
dataManager
-
messageConverter
-
currentUserSubstitution
-
-
Constructor Details
-
AiChatMessageDataService
public AiChatMessageDataService()
-
-
Method Details
-
createMessage
public AiChatMessage createMessage(AiConversation conversation, AiChatMessageType type, String message) Description copied from interface:AiChatMessageServiceCreates a new message of the given type in the conversation.- Specified by:
createMessagein interfaceAiChatMessageService- Parameters:
conversation- conversation the message belongs totype- message typemessage- message text- Returns:
- the created message
-
loadLatestMessage
public @Nullable AiChatMessage loadLatestMessage(AiConversation conversation, @Nullable AiChatMessageType type) Description copied from interface:AiChatMessageServiceLoads the most recent message of the conversation, optionally restricted to a type.- Specified by:
loadLatestMessagein interfaceAiChatMessageService- Parameters:
conversation- conversation whose latest message is loadedtype- message type to match, ornullfor any type- Returns:
- the latest matching message, or
nullif there is none
-
loadMessages
Description copied from interface:AiChatMessageServiceLoads all messages of the conversation, oldest first.- Specified by:
loadMessagesin interfaceAiChatMessageService- Parameters:
conversation- conversation whose messages are loaded- Returns:
- the conversation's messages, oldest first; empty if there are none
-
checkOwner
-
currentUsername
-
loadAiConversation
-