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)
| 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. |
| 568 | func (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. |
no test coverage detected