diff options
Diffstat (limited to 'internal/client/client.go')
| -rw-r--r-- | internal/client/client.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/internal/client/client.go b/internal/client/client.go index b091343..2dc432c 100644 --- a/internal/client/client.go +++ b/internal/client/client.go @@ -83,7 +83,7 @@ func initialModel() model { } func (m model) Init() tea.Cmd { - return textarea.Blink + return tea.Batch(textarea.Blink, api.GetMessages) } func (m model) View() string { @@ -158,6 +158,16 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { return m, nil } + case api.AppendMessage: + m.messages = append(m.messages, msg.Content) + + m.viewport.SetContent(strings.Join(m.messages, "\n")) + m.viewport.GotoBottom() + + var cmd tea.Cmd + m.viewport, cmd = m.viewport.Update(msg) + return m, cmd + case cursor.BlinkMsg: var cmd tea.Cmd m.textarea, cmd = m.textarea.Update(msg) |
