MCPcopy
hub / github.com/docker/docker-agent / initSessionComponents

Method initSessionComponents

pkg/tui/tui.go:568–581  ·  view source on GitHub ↗

initSessionComponents creates a new chat page, session state, and editor for the given app and stores them in the per-session maps under tabID. The active convenience pointers (m.chatPage, m.sessionState, m.editor) are also updated.

(tabID string, a *app.App, sess *session.Session)

Source from the content-addressed store, hash-verified

566// the given app and stores them in the per-session maps under tabID. The active
567// convenience pointers (m.chatPage, m.sessionState, m.editor) are also updated.
568func (m *appModel) initSessionComponents(tabID string, a *app.App, sess *session.Session) {
569 ss := service.NewSessionState(sess)
570 cp := chat.New(m.ctx(), a, ss, m.chatPageOpts()...)
571 ed := editor.New(m.history, m.editorOpts()...)
572
573 m.chatPages[tabID] = cp
574 m.sessionStates[tabID] = ss
575 m.editors[tabID] = ed
576
577 m.application = a
578 m.sessionState = ss
579 m.chatPage = cp
580 m.editor = ed
581}
582
583// initAndFocusComponents returns a batch of commands that initializes and focuses
584// the active chat page and editor, then resizes everything.

Callers 5

handleBranchFromEditMethod · 0.95
handleLoadSessionMethod · 0.95
replaceActiveSessionMethod · 0.95
handleClearSessionMethod · 0.95
handleSwitchTabMethod · 0.95

Calls 5

chatPageOptsMethod · 0.95
editorOptsMethod · 0.95
NewSessionStateFunction · 0.92
NewFunction · 0.92
NewFunction · 0.92

Tested by

no test coverage detected