-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[86] Improve Chat Scrolling #87
Conversation
…n a response is generating, showing a scroll to bottom button, 'sticking' scroll to bottom if user has explicitly scrolled down
@@ -69,12 +69,46 @@ public struct TypingIndicator: View { | |||
} | |||
} | |||
|
|||
struct ScrollState { | |||
static let BottomScrollThreshold = 120.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This threshold is the magic sauce but should perhaps be generalized / scale by text size?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good idea!
Make the "body" font size a constant
.manrope(.medium, size: 14) |
OLMoE.swift/Views/ContentView.swift
Outdated
func respond() { | ||
isGenerating = true | ||
Task { | ||
let originalInput = input | ||
input = "" // Clear the input after sending | ||
await bot.respond(to: originalInput) | ||
scrollToBottom = true | ||
//scrollToBottom = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove commented code?
OLMoE.swift/Views/ChatView.swift
Outdated
let isAtBottom = !needsScroll || offsetDelta < ScrollState.BottomScrollThreshold | ||
self.isAtBottom = isAtBottom | ||
|
||
//print("UPDATE: Bottom? \(isAtBottom) : delta: \(offsetDelta), on scroll - offset: \(Int(scrollOffset)), scrollHeight: \(Int(scrollViewHeight)), contentHeight: \(Int(contentHeight))") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove commented code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried it on my personal device. Looks good.
I made a couple comments that shouldn't prevent merging.
Task : #86
Currently the behavior is that whenever text is generating, it forces the scroll of the chat window, preventing a user from scrolling up while text is generating. However, allowing the user to scroll is common behavior of most AI chat interfaces. This allows a user to scroll independent of text being generated.
TODO - verify this feels good a device.
(updated style based on Ian's quick feedback)
ai2-chat-scrolling-1.mov