TUI view management and input handling cleanup
This commit is contained in:
@@ -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(),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user