Skip to content

Commit 7a0e777

Browse files
committed
Remove redundant conversions
Signed-off-by: David Gageot <david.gageot@docker.com>
1 parent 611ef3b commit 7a0e777

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

internal/tui/components/messages/messages.go

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -466,10 +466,10 @@ func (m *model) AddUserMessage(content string) tea.Cmd {
466466
m.views = append(m.views, view)
467467

468468
if wasAtBottom {
469-
return tea.Batch(view.Init(), tea.Cmd(func() tea.Msg {
469+
return tea.Batch(view.Init(), func() tea.Msg {
470470
m.scrollToBottom()
471471
return nil
472-
}))
472+
})
473473
}
474474

475475
return view.Init()
@@ -488,15 +488,17 @@ func (m *model) AddErrorMessage(content string) tea.Cmd {
488488
m.views = append(m.views, view)
489489

490490
if wasAtBottom {
491-
return tea.Batch(view.Init(), tea.Cmd(func() tea.Msg {
491+
return tea.Batch(view.Init(), func() tea.Msg {
492492
m.scrollToBottom()
493493
return nil
494-
}))
494+
})
495495
}
496496
return view.Init()
497497
}
498498

499499
// AddAssistantMessage adds an assistant message to the chat
500+
//
501+
//goland:noinspection ALL
500502
func (m *model) AddAssistantMessage() tea.Cmd {
501503
msg := types.Message{
502504
Type: types.MessageTypeAssistant,
@@ -611,10 +613,10 @@ func (m *model) AppendToLastMessage(agentName, content string) tea.Cmd {
611613
cmds = append(cmds, initCmd)
612614
}
613615
if wasAtBottom {
614-
cmds = append(cmds, tea.Cmd(func() tea.Msg {
616+
cmds = append(cmds, func() tea.Msg {
615617
m.scrollToBottom()
616618
return nil
617-
}))
619+
})
618620
}
619621
return tea.Batch(cmds...)
620622
} else {
@@ -635,10 +637,10 @@ func (m *model) AppendToLastMessage(agentName, content string) tea.Cmd {
635637
cmds = append(cmds, initCmd)
636638
}
637639
if wasAtBottom {
638-
cmds = append(cmds, tea.Cmd(func() tea.Msg {
640+
cmds = append(cmds, func() tea.Msg {
639641
m.scrollToBottom()
640642
return nil
641-
}))
643+
})
642644
}
643645
return tea.Batch(cmds...)
644646
}
@@ -656,10 +658,10 @@ func (m *model) ClearMessages() {
656658

657659
// ScrollToBottom scrolls to the bottom of the chat
658660
func (m *model) ScrollToBottom() tea.Cmd {
659-
return tea.Cmd(func() tea.Msg {
661+
return func() tea.Msg {
660662
m.scrollToBottom()
661663
return nil
662-
})
664+
}
663665
}
664666

665667
func (m *model) createToolCallView(msg *types.Message) tool.Model {

0 commit comments

Comments
 (0)