fix: respect user scroll-up in thinking section
Only auto-scroll the live thinking panel while the user is near the bottom, so manual scroll-up is preserved during streaming.
This commit is contained in:
parent
7dedc51d9f
commit
6d756215a2
1 changed files with 5 additions and 2 deletions
|
|
@ -1564,9 +1564,12 @@ import { wireArrowUpRecall, getLastUserMessageFromChatHistory } from './composer
|
||||||
.replace(/<channel\|>/gi, '');
|
.replace(/<channel\|>/gi, '');
|
||||||
thinkText = thinkText.replace(/^\s*Thinking(?:\s+Process)?:\s*/i, '');
|
thinkText = thinkText.replace(/^\s*Thinking(?:\s+Process)?:\s*/i, '');
|
||||||
_liveThinkInner.innerHTML = markdownModule.mdToHtml(thinkText);
|
_liveThinkInner.innerHTML = markdownModule.mdToHtml(thinkText);
|
||||||
// Keep thinking box scrolled to bottom
|
// Keep thinking box scrolled to bottom, but let user scroll up
|
||||||
var thinkBox = _liveThinkInner.closest('.thinking-content');
|
var thinkBox = _liveThinkInner.closest('.thinking-content');
|
||||||
if (thinkBox) thinkBox.scrollTop = thinkBox.scrollHeight;
|
if (thinkBox) {
|
||||||
|
var nearBottom = thinkBox.scrollHeight - thinkBox.clientHeight - thinkBox.scrollTop < 80;
|
||||||
|
if (nearBottom) thinkBox.scrollTop = thinkBox.scrollHeight;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
uiModule.scrollHistory();
|
uiModule.scrollHistory();
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue