fix: the assistant no longer drags the view to the end while an answer streams
All checks were successful
Forgejo Docker Build / Root app tests (push) Successful in 52s
Forgejo Docker Build / Build Docker image (push) Successful in 18s
Forgejo Docker Build / End-to-end (browser) (push) Successful in 5s

The reader can start at the top of a long answer and scroll at their own
pace; the per-token and on-completion jumps to the bottom are gone, which
also stops a finger on the screen fighting the auto-scroll.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dv6sqaY6Vq3ChZHMem3cnU
This commit is contained in:
Daniel 2026-09-14 04:26:38 +02:00
parent 684a8920e9
commit 8142dd4ab1

View file

@ -545,8 +545,11 @@ import {
// assistant is still working — drawing a figure, completing a cut-off
// reply. It now sits above the partial answer until the answer is done.
showStreamStatus(bubble, streamStatus);
var wrap = document.getElementById('assistant-messages');
if (wrap) wrap.scrollTop = wrap.scrollHeight;
// The view stays where the reader left it while the answer streams in.
// It used to be dragged to the bottom on every render, so the reader
// could not start at the top of a long answer, and a finger on the
// screen fought the auto-scroll. The answer grows below the fold; the
// reader scrolls into it at their own pace.
}
function handleEvent(type, data) {
@ -950,8 +953,8 @@ import {
'<button type="button" data-assistant-msg-regenerate title="Regenerate"><i class="fas fa-rotate-right"></i></button>';
row.appendChild(actions);
}
var wrap = document.getElementById('assistant-messages');
if (wrap) wrap.scrollTop = wrap.scrollHeight;
// No jump to the end when the answer completes either: the reader may be
// partway through it.
messages.push({ role: 'assistant', content: content, sources: sources || [] });
row.dataset.messageIndex = String(messages.length - 1);
updateConversationBudget();