fix: the assistant no longer drags the view to the end while an answer streams
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:
parent
684a8920e9
commit
8142dd4ab1
1 changed files with 7 additions and 4 deletions
|
|
@ -545,8 +545,11 @@ import {
|
||||||
// assistant is still working — drawing a figure, completing a cut-off
|
// assistant is still working — drawing a figure, completing a cut-off
|
||||||
// reply. It now sits above the partial answer until the answer is done.
|
// reply. It now sits above the partial answer until the answer is done.
|
||||||
showStreamStatus(bubble, streamStatus);
|
showStreamStatus(bubble, streamStatus);
|
||||||
var wrap = document.getElementById('assistant-messages');
|
// The view stays where the reader left it while the answer streams in.
|
||||||
if (wrap) wrap.scrollTop = wrap.scrollHeight;
|
// 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) {
|
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>';
|
'<button type="button" data-assistant-msg-regenerate title="Regenerate"><i class="fas fa-rotate-right"></i></button>';
|
||||||
row.appendChild(actions);
|
row.appendChild(actions);
|
||||||
}
|
}
|
||||||
var wrap = document.getElementById('assistant-messages');
|
// No jump to the end when the answer completes either: the reader may be
|
||||||
if (wrap) wrap.scrollTop = wrap.scrollHeight;
|
// partway through it.
|
||||||
messages.push({ role: 'assistant', content: content, sources: sources || [] });
|
messages.push({ role: 'assistant', content: content, sources: sources || [] });
|
||||||
row.dataset.messageIndex = String(messages.length - 1);
|
row.dataset.messageIndex = String(messages.length - 1);
|
||||||
updateConversationBudget();
|
updateConversationBudget();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue