Package io.jmix.dynmodelai.repository
Class ConversationRepository
java.lang.Object
io.jmix.dynmodelai.repository.ConversationRepository
Persistence adapter for conversations and their messages.
-
Constructor Summary
ConstructorsConstructorDescriptionConversationRepository(UnconstrainedDataManager dataManager, TimeSource timeSource, Messages messages) -
Method Summary
Modifier and TypeMethodDescriptionvoidappendMessage(UUID conversationId, UUID runId, AgentMessageRole role, String content, String actor) voidappendMessage(UUID conversationId, UUID runId, AgentMessageRole role, String content, String actor, @Nullable RunOutcome outcome) outcomemarks the assistant message that ended a run.appendPublication(UUID conversationId, @Nullable UUID baselineSettingsId, UUID publishedSettingsId, String content, String actor) The parent lock makes repeated callbacks idempotent across application nodes too.voidcheckConversationExists(UUID conversationId) org.springframework.data.domain.Page<AgentConversation> conversationsByLastModifiedDateDesc(org.springframework.data.domain.Pageable pageable) longcountMessages(UUID conversationId) Returns an empty Optional when the Conversation does not exist.org.springframework.data.domain.Page<AgentConversationMessage> messagesByCreatedDateAsc(UUID conversationId, org.springframework.data.domain.Pageable pageable)
-
Constructor Details
-
ConversationRepository
public ConversationRepository(UnconstrainedDataManager dataManager, TimeSource timeSource, Messages messages)
-
-
Method Details
-
create
-
appendMessage
public void appendMessage(UUID conversationId, UUID runId, AgentMessageRole role, String content, String actor) throws NoSuchElementException - Throws:
NoSuchElementException- if the Conversation does not exist
-
appendMessage
public void appendMessage(UUID conversationId, UUID runId, AgentMessageRole role, String content, String actor, @Nullable RunOutcome outcome) throws NoSuchElementException outcomemarks the assistant message that ended a run.- Throws:
NoSuchElementException- if the Conversation does not exist
-
conversationsByLastModifiedDateDesc
public org.springframework.data.domain.Page<AgentConversation> conversationsByLastModifiedDateDesc(org.springframework.data.domain.Pageable pageable) -
locateRun
-
findById
Returns an empty Optional when the Conversation does not exist. -
checkConversationExists
- Throws:
NoSuchElementException- if the Conversation does not exist
-
messagesByCreatedDateAsc
public org.springframework.data.domain.Page<AgentConversationMessage> messagesByCreatedDateAsc(UUID conversationId, org.springframework.data.domain.Pageable pageable) throws NoSuchElementException - Throws:
NoSuchElementException- if the Conversation does not exist
-
countMessages
-
appendPublication
@Transactional public AgentConversationMessage appendPublication(UUID conversationId, @Nullable UUID baselineSettingsId, UUID publishedSettingsId, String content, String actor) The parent lock makes repeated callbacks idempotent across application nodes too.
-