Package ai.mindconnect.adminui.ui.page
Class ChatPage
java.lang.Object
ai.mindconnect.adminui.ui.AdminPage
ai.mindconnect.adminui.ui.page.ChatPage
The agent-session chat page. Composes three components into a
tabbed section:
MessageListComponent— the scrollable conversation (Chat tab), where almost all incremental updates land.ChatFormComponent— the input form below the conversation (also Chat tab).SessionInfoComponent— the Info tab with read-only session metadata.
Each page instance binds one session's domain model (session, agent, history, memory) and exposes:
render()— the full page, returned on GET /sessions/{id}.- One
UiPatchmethod per lifecycle event of a chat turn — these are the only surface theSessionUiControllerneeds to talk to during streaming, so the controller stays focused on orchestration.
The page is a short-lived value object: build it from the latest model at the start of each request, derive whatever patch / page is needed, throw it away. No fields beyond the components and their model; no caches.
-
Constructor Summary
ConstructorsConstructorDescriptionChatPage(ai.mindconnect.agent.domain.AgentSession session, ai.mindconnect.agent.domain.AgentDefinition agent, List<ai.mindconnect.message.domain.Message> history, ai.mindconnect.agent.memory.domain.WorkingMemory memory) ChatPage(ai.mindconnect.agent.domain.AgentSession session, ai.mindconnect.agent.domain.AgentDefinition agent, List<ai.mindconnect.message.domain.Message> history, ai.mindconnect.agent.memory.domain.WorkingMemory memory, boolean streaming) ChatPage(ai.mindconnect.agent.domain.AgentSession session, ai.mindconnect.agent.domain.AgentDefinition agent, List<ai.mindconnect.message.domain.Message> history, ai.mindconnect.agent.memory.domain.WorkingMemory memory, boolean streaming, MessageListComponent.SubAgentTreeProvider subAgentTree) -
Method Summary
Modifier and TypeMethodDescriptionai.mindconnect.ui.model.UiPatchappendApprovalCard(ai.mindconnect.ui.model.UiList.Item card) APPEND a live approval card pushed by a suspended (sub-)turn.static ai.mindconnect.ui.model.UiUploadattachZone(UUID sessionId) The attach drop-zone — lives in the dialog the chat form's "+" button opens (see SessionUiController#attachDialog), not on the page itself.ai.mindconnect.ui.model.UiPatchAfter a non-streamingPOST /chat: refresh the conversation (and its token-bar title) and reset the input form so the user can type a follow-up.ai.mindconnect.ui.model.UiPatchHeader-only refresh — used after a message deletion so the token-bar in the title catches up without redoing the form.ai.mindconnect.ui.model.UiPagerender()Render the full page (initial GET, after navigation).ai.mindconnect.ui.model.UiPatchTurn completed successfully.ai.mindconnect.ui.model.UiPatchStreaming failed before completion.ai.mindconnect.ui.model.UiPatchstreamError(String message) Failure with a face: error bubble into the chat, form back to Send.ai.mindconnect.ui.model.UiPatchstreamFirstToken(String pendingId, String thinkingId) First bot token arrived.ai.mindconnect.ui.model.UiPatchai.mindconnect.ui.model.UiPatchstreamStart(String userText, String thinkingId) ai.mindconnect.ui.model.UiPatchstreamSubAgentDone(ai.mindconnect.ui.model.UiNode statusNode, String stackId, ai.mindconnect.ui.model.UiNode answerNode) Completes a sub-agent card without disturbing its nested child tree: REPLACE the in-body status line in place, then APPEND the final-answer markdown into the card's body stack.ai.mindconnect.ui.model.UiPatchAPPEND a freshly-started task card (tool / sub-agent) to the list.ai.mindconnect.ui.model.UiPatchstreamTaskStartInto(String childListId, TaskCardComponent card) APPEND a freshly-started task card into a sub-agent's nested child list (childListId) rather than the top-level conversation — this is what builds the sub-agent tree live.ai.mindconnect.ui.model.UiPatchREPLACE a task card in place — used for done / failed transitions.ai.mindconnect.ui.model.UiPatchstreamToken(String pendingId, String cumulativeText) Every subsequent token: grow the bot-pending body to the cumulative text.withActiveStreams(List<ai.mindconnect.ui.model.UiPage.ActiveStream> streams) Lets the controller hand the chat-page the streams the SPA should try to re-attach to (typically a single entry for this very session's chat turn).withAttachments(ai.mindconnect.ui.model.UiNode attachments) withBubbledApprovals(List<ai.mindconnect.ui.model.UiList.Item> cards) The open sub-agent approval cards of this (root) session — built by the controller from the ToolApprovalStore, rendered by the message list after the history.
-
Constructor Details
-
ChatPage
public ChatPage(ai.mindconnect.agent.domain.AgentSession session, ai.mindconnect.agent.domain.AgentDefinition agent, List<ai.mindconnect.message.domain.Message> history, ai.mindconnect.agent.memory.domain.WorkingMemory memory) -
ChatPage
public ChatPage(ai.mindconnect.agent.domain.AgentSession session, ai.mindconnect.agent.domain.AgentDefinition agent, List<ai.mindconnect.message.domain.Message> history, ai.mindconnect.agent.memory.domain.WorkingMemory memory, boolean streaming) -
ChatPage
public ChatPage(ai.mindconnect.agent.domain.AgentSession session, ai.mindconnect.agent.domain.AgentDefinition agent, List<ai.mindconnect.message.domain.Message> history, ai.mindconnect.agent.memory.domain.WorkingMemory memory, boolean streaming, MessageListComponent.SubAgentTreeProvider subAgentTree) - Parameters:
streaming- whether the agent is currently mid-turn. When true, the chat form is rendered in Stop-button mode so a navigate-back during a live turn doesn't show a Send button the user can accidentally fire.subAgentTree- supplies the nested sub-agent card trees for historic rendering (rebuilt from persisted child sessions);MessageListComponent.SubAgentTreeProvider.NONEfor a flat fallback.
-
-
Method Details
-
withActiveStreams
Lets the controller hand the chat-page the streams the SPA should try to re-attach to (typically a single entry for this very session's chat turn). Returnsthisfor fluent chaining. -
withAttachments
-
withBubbledApprovals
The open sub-agent approval cards of this (root) session — built by the controller from the ToolApprovalStore, rendered by the message list after the history. Returnsthisfor fluent chaining. -
attachZone
The attach drop-zone — lives in the dialog the chat form's "+" button opens (see SessionUiController#attachDialog), not on the page itself. Files land in the session's vector store via the ingestion workflow, and vector_search activates for the session. -
render
public ai.mindconnect.ui.model.UiPage render()Description copied from class:AdminPageRender the full page (initial GET, after navigation). -
chatTurnComplete
public ai.mindconnect.ui.model.UiPatch chatTurnComplete()After a non-streamingPOST /chat: refresh the conversation (and its token-bar title) and reset the input form so the user can type a follow-up. -
headerOnly
public ai.mindconnect.ui.model.UiPatch headerOnly()Header-only refresh — used after a message deletion so the token-bar in the title catches up without redoing the form. -
appendApprovalCard
public ai.mindconnect.ui.model.UiPatch appendApprovalCard(ai.mindconnect.ui.model.UiList.Item card) APPEND a live approval card pushed by a suspended (sub-)turn. -
streamResume
public ai.mindconnect.ui.model.UiPatch streamResume() -
streamStart
-
streamFirstToken
First bot token arrived. Drop the thinking indicator and append the streaming-reply placeholder. Subsequent tokens grow the placeholder viastreamToken(String, String). -
streamToken
Every subsequent token: grow the bot-pending body to the cumulative text. -
streamTaskStart
APPEND a freshly-started task card (tool / sub-agent) to the list. -
streamTaskStartInto
public ai.mindconnect.ui.model.UiPatch streamTaskStartInto(String childListId, TaskCardComponent card) APPEND a freshly-started task card into a sub-agent's nested child list (childListId) rather than the top-level conversation — this is what builds the sub-agent tree live. -
streamTaskUpdate
REPLACE a task card in place — used for done / failed transitions. -
streamSubAgentDone
public ai.mindconnect.ui.model.UiPatch streamSubAgentDone(ai.mindconnect.ui.model.UiNode statusNode, String stackId, ai.mindconnect.ui.model.UiNode answerNode) Completes a sub-agent card without disturbing its nested child tree: REPLACE the in-body status line in place, then APPEND the final-answer markdown into the card's body stack. A wholesale card REPLACE would morph the nested child list back to empty and wipe the already-streamed children, so the two targeted ops are used instead. -
streamDone
public ai.mindconnect.ui.model.UiPatch streamDone()Turn completed successfully. Reset the form back to its idle variant and refresh the whole conversation so the streamed bot-pending placeholder + live task cards get swapped for the persisted assistant message and its historic task cards. -
streamError
public ai.mindconnect.ui.model.UiPatch streamError()Streaming failed before completion. Only restore the form to idle — the live partial state stays visible (the user gets a separate error banner via the SSE 'error' event), and the next page load will rebuild from persisted history. -
streamError
Failure with a face: error bubble into the chat, form back to Send.
-