Skip to content

Commit 45891aa

Browse files
committed
✨ Add autostart option to bobachat chat
1 parent 15e38a4 commit 45891aa

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

pkg/chat/model.go

+12-3
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ type Status struct {
4848

4949
type model struct {
5050
conversationManager geppetto_conversation.Manager
51+
autoStartBackend bool
5152

5253
viewport viewport.Model
5354
scrollToBottom bool
@@ -93,6 +94,12 @@ func WithStatus(status *Status) ModelOption {
9394
}
9495
}
9596

97+
func WithAutoStartBackend(autoStartBackend bool) ModelOption {
98+
return func(m *model) {
99+
m.autoStartBackend = autoStartBackend
100+
}
101+
}
102+
96103
// TODO(manuel, 2024-04-07) Add options to configure filepicker
97104

98105
func InitialModel(manager geppetto_conversation.Manager, backend Backend, options ...ModelOption) model {
@@ -151,9 +158,11 @@ func (m model) Init() tea.Cmd {
151158

152159
m.updateKeyBindings()
153160

154-
cmds = append(cmds, func() tea.Msg {
155-
return StartBackendMsg{}
156-
})
161+
if m.autoStartBackend {
162+
cmds = append(cmds, func() tea.Msg {
163+
return StartBackendMsg{}
164+
})
165+
}
157166

158167
return tea.Batch(cmds...)
159168
}

0 commit comments

Comments
 (0)