|
|
@@ -171,7 +171,11 @@ func (m *messagesComponent) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|
|
m.showThinkingBlocks = !m.showThinkingBlocks
|
|
|
m.app.State.ShowThinkingBlocks = &m.showThinkingBlocks
|
|
|
return m, tea.Batch(m.renderView(), m.app.SaveState())
|
|
|
- case app.SessionLoadedMsg, app.SessionClearedMsg:
|
|
|
+ case app.SessionLoadedMsg:
|
|
|
+ m.tail = true
|
|
|
+ m.loading = true
|
|
|
+ return m, m.renderView()
|
|
|
+ case app.SessionClearedMsg:
|
|
|
m.cache.Clear()
|
|
|
m.tail = true
|
|
|
m.loading = true
|
|
|
@@ -183,6 +187,21 @@ func (m *messagesComponent) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|
|
return m, m.renderView()
|
|
|
}
|
|
|
case app.SessionSelectedMsg:
|
|
|
+ currentParent := m.app.Session.ParentID
|
|
|
+ if currentParent == "" {
|
|
|
+ currentParent = m.app.Session.ID
|
|
|
+ }
|
|
|
+
|
|
|
+ targetParent := msg.ParentID
|
|
|
+ if targetParent == "" {
|
|
|
+ targetParent = msg.ID
|
|
|
+ }
|
|
|
+
|
|
|
+ // Clear cache only if switching between different session families
|
|
|
+ if currentParent != targetParent {
|
|
|
+ m.cache.Clear()
|
|
|
+ }
|
|
|
+
|
|
|
m.viewport.GotoBottom()
|
|
|
case app.MessageRevertedMsg:
|
|
|
if msg.Session.ID == m.app.Session.ID {
|