fix(chat): 打字机逐字输出 + 在底部跟随/wheel暂停的滚动方案

撤回 91034eb,回到 fedfd8a 基础上重做:

- 打字机改为真逐字:chunk 默认 1(不随堆积量加速),去掉 gap/6 大步长
- chunk 与 interval 可配置:localStorage 持久化 + window.typingConfig 控制台实时调
- 递归 setTimeout 替代 setInterval,改 interval 实时生效
- 滚动方案改用 userPaused 标志(由 wheel/touchmove 设置,程序滚动不触发这二者):
  maybeAutoScroll 仅在 !userPaused && isNearBottom() 时 scrollBottom
- 在底部自动跟随;用户滚轮向上/触摸上拖立即暂停;滚回底部清暂停恢复跟随
- 去掉 state.autoScroll,按钮显隐改用 isNearBottom 判断
This commit is contained in:
2026-09-02 19:40:47 +08:00
parent fedfd8a659
commit 4f28071d23
2 changed files with 44 additions and 29 deletions
-2
View File
@@ -21,8 +21,6 @@ const state = {
pendingEl: null,
pendingTimer: null,
pendingStart: 0,
// 滚动跟随相关:用户是否在底部附近、是否因手动向上翻阅而暂停自动跟随
autoScroll: true,
streaming: false, // AI 是否正在输出(用于滚动到底部按钮显示加载提示)
};