File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
embabel-chat-store/src/main/kotlin/com/embabel/chat/store/adapter Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,31 @@ class StoredConversationFactory @JvmOverloads constructor(
8181 return createInternal(id, user = null , agent = null )
8282 }
8383
84+ /* *
85+ * Load an existing conversation from storage.
86+ *
87+ * If the session exists, returns a [StoredConversation] that will load
88+ * messages from the repository. The session owner becomes the default user
89+ * for message attribution.
90+ *
91+ * @param id the conversation/session ID to load
92+ * @return the conversation if found, null otherwise
93+ */
94+ override fun load (id : String ): Conversation ? {
95+ return repository.findBySessionId(id).orElse(null )?.let { session ->
96+ StoredConversation (
97+ id = id,
98+ repository = repository,
99+ eventPublisher = eventPublisher,
100+ user = session.owner,
101+ agent = null ,
102+ title = session.session.title,
103+ titleGenerator = titleGenerator,
104+ scope = scope
105+ )
106+ }
107+ }
108+
84109 /* *
85110 * Create a conversation for a 1-1 chat between a user and an agent.
86111 *
You can’t perform that action at this time.
0 commit comments