Private
Public Access
1
0

TUI view management and input handling cleanup

This commit is contained in:
2024-09-16 15:40:04 +00:00
parent 24b5cdbbf6
commit 463ca9ef40
7 changed files with 169 additions and 154 deletions

View File

@@ -74,7 +74,7 @@ const (
)
type Model struct {
shared.Shared
*shared.ViewState
shared.Sections
// App state
@@ -108,10 +108,14 @@ type Model struct {
elapsed time.Duration
}
func Chat(app *model.AppModel, shared shared.Shared) Model {
func (m Model) Initialized() bool {
return m.ViewState.Initialized
}
func Chat(app *model.AppModel, shared shared.ViewState) shared.ViewModel {
m := Model{
App: app,
Shared: shared,
ViewState: &shared,
state: idle,
persistence: true,
@@ -169,6 +173,7 @@ func Chat(app *model.AppModel, shared shared.Shared) Model {
}
func (m Model) Init() tea.Cmd {
m.ViewState.Initialized = true
return tea.Batch(
m.waitForResponseChunk(),
)