feat(chat): 打字机输出/智能滚动跟随/切会话清空/回到底部按钮

- AI 流式输出改打字机效果:逐字推进+末尾闪烁光标,结束补足 markdown 渲染
- 智能滚动跟随:贴近底部自动滚;用户向上滚(wheel/touchmove)立即暂停,回底部恢复
- 切会话先清空旧内容并显示加载中,避免短暂展示上一会话内容
- 右下角「回到底部」按钮:上翻历史时出现;AI 输出中叠加加载转圈(模拟 deepseek)
This commit is contained in:
2026-09-02 19:20:58 +08:00
parent a370f5d7bb
commit fedfd8a659
4 changed files with 173 additions and 6 deletions
+25
View File
@@ -480,3 +480,28 @@ body {
display: block; max-width: 240px; max-height: 240px;
border-radius: 6px; margin-top: 6px; cursor: zoom-in;
}
/* 右下角「回到底部」按钮:上翻历史时出现;AI 输出中显示加载转圈 */
.scroll-bottom-btn {
position: absolute; right: 14px; bottom: 72px;
width: 38px; height: 38px; border-radius: 50%;
border: none; cursor: pointer; padding: 0;
display: flex; align-items: center; justify-content: center;
background: #fff; box-shadow: 0 2px 8px rgba(30,40,90,0.18);
z-index: 70; opacity: 0.95;
}
.scroll-bottom-btn:active { opacity: 1; }
.scroll-bottom-btn svg { width: 20px; height: 20px; fill: none; stroke: #556; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* 加载转圈:AI 正在输出 */
.scroll-bottom-btn .sb-spinner { animation: sb-spin 0.8s linear infinite; }
.scroll-bottom-btn .sb-spinner circle { stroke: #dde; stroke-width: 2.5; fill: none; }
.scroll-bottom-btn .sb-spinner path { stroke: #3964FE; stroke-width: 2.5; stroke-linecap: round; fill: none; }
@keyframes sb-spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
/* 打字机光标:AI 流式输出中,气泡末尾闪烁竖条 */
.msg-bubble.typing::after {
content: ''; display: inline-block; width: 2px; height: 1em;
background: #556; margin-left: 2px; vertical-align: text-bottom;
animation: tw-cursor 1s steps(1) infinite;
}
@keyframes tw-cursor { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }