Tweaks/cleanups to conversation management in tui
- Pass around message/conversation values instead of pointers where it makes more sense, and store values instead of pointers in the globally (within the TUI) shared `App` (pointers provide no utility here). - Split conversation persistence into separate conversation/message saving stages
This commit is contained in:
@@ -71,7 +71,7 @@ func (m *Model) renderMessageHeading(i int, message *conversation.Message) strin
|
||||
prefix = " "
|
||||
}
|
||||
|
||||
if i == 0 && len(m.App.Conversation.RootMessages) > 1 && m.App.Conversation.SelectedRootID != nil {
|
||||
if i == 0 && m.App.Conversation.SelectedRootID != nil && len(m.App.Conversation.RootMessages) > 1 {
|
||||
selectedRootIndex := 0
|
||||
for j, reply := range m.App.Conversation.RootMessages {
|
||||
if reply.ID == *m.App.Conversation.SelectedRootID {
|
||||
@@ -261,7 +261,7 @@ func (m *Model) Content(width, height int) string {
|
||||
func (m *Model) Header(width int) string {
|
||||
titleStyle := lipgloss.NewStyle().Bold(true)
|
||||
var title string
|
||||
if m.App.Conversation != nil && m.App.Conversation.Title != "" {
|
||||
if m.App.Conversation.Title != "" {
|
||||
title = m.App.Conversation.Title
|
||||
} else {
|
||||
title = "Untitled"
|
||||
|
||||
Reference in New Issue
Block a user