File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ struct AIChatPanelView: View {
1717
1818 @Bindable var viewModel : AIChatViewModel
1919 private let settingsManager = AppSettingsManager . shared
20+ @State private var isUserScrolledUp = false
2021
2122 private var hasConfiguredProvider : Bool {
2223 settingsManager. ai. providers. contains ( where: { $0. isEnabled } )
@@ -183,6 +184,11 @@ struct AIChatPanelView: View {
183184 }
184185 }
185186
187+ Color . clear
188+ . frame ( height: 1 )
189+ . id ( " bottomAnchor " )
190+ . onAppear { isUserScrolledUp = false }
191+ . onDisappear { isUserScrolledUp = true }
186192 }
187193 . padding ( . horizontal, 8 )
188194 . padding ( . vertical, 8 )
@@ -192,9 +198,12 @@ struct AIChatPanelView: View {
192198 scrollToBottom ( proxy: proxy)
193199 }
194200 . onChange ( of: viewModel. messages. last? . content) {
195- scrollToBottom ( proxy: proxy)
201+ if !isUserScrolledUp {
202+ scrollToBottom ( proxy: proxy)
203+ }
196204 }
197205 . onChange ( of: viewModel. messages. count) {
206+ isUserScrolledUp = false
198207 scrollToBottom ( proxy: proxy)
199208 }
200209 . onChange ( of: viewModel. activeConversationID) {
You can’t perform that action at this time.
0 commit comments