forked from Shinonome/dots-hyprland
feat(ai): Add auto-scroll functionality to AI chat
- Add shouldAutoScroll property to track when user wants auto-scrolling - Auto-scroll when user sends a message to see the response - Auto-scroll during streaming when content height changes - Auto-scroll when new messages are added to the conversation - Stop auto-scroll when user manually scrolls up (preserves user intent) - Resume auto-scroll when user scrolls back to bottom 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -209,6 +209,10 @@ Inline w/ backslash and round brackets \\(e^{i\\pi} + 1 = 0\\)
|
|||||||
else {
|
else {
|
||||||
Ai.sendUserMessage(inputText);
|
Ai.sendUserMessage(inputText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Always scroll to bottom when user sends a message
|
||||||
|
messageListView.shouldAutoScroll = true
|
||||||
|
messageListView.positionViewAtEnd()
|
||||||
}
|
}
|
||||||
|
|
||||||
Process {
|
Process {
|
||||||
@@ -316,6 +320,28 @@ Inline w/ backslash and round brackets \\(e^{i\\pi} + 1 = 0\\)
|
|||||||
|
|
||||||
property int lastResponseLength: 0
|
property int lastResponseLength: 0
|
||||||
|
|
||||||
|
// Simple auto-scroll state tracking (proven chat pattern)
|
||||||
|
property bool shouldAutoScroll: true
|
||||||
|
|
||||||
|
// Track when user scrolls - simple and reliable
|
||||||
|
onContentYChanged: {
|
||||||
|
shouldAutoScroll = atYEnd
|
||||||
|
}
|
||||||
|
|
||||||
|
// Auto-scroll when content height changes (during streaming)
|
||||||
|
onContentHeightChanged: {
|
||||||
|
if (shouldAutoScroll) {
|
||||||
|
positionViewAtEnd()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Auto-scroll when new messages are added
|
||||||
|
onCountChanged: {
|
||||||
|
if (shouldAutoScroll) {
|
||||||
|
positionViewAtEnd()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
clip: true
|
clip: true
|
||||||
layer.enabled: true
|
layer.enabled: true
|
||||||
layer.effect: OpacityMask {
|
layer.effect: OpacityMask {
|
||||||
|
|||||||
Reference in New Issue
Block a user