Fix self welcome message rendering

This commit is contained in:
2026-04-11 15:54:25 +08:00
parent 4eba9dfc12
commit f6fb5aab78
@@ -777,13 +777,20 @@
container2.querySelectorAll('[data-autosave="1"]').forEach(el => el.remove()); container2.querySelectorAll('[data-autosave="1"]').forEach(el => el.remove());
} }
container2.appendChild(div); container2.appendChild(div);
if (autoScroll) container2.scrollTop = container2.scrollHeight; if (autoScroll) {
container2.scrollTop = container2.scrollHeight;
}
} else { } else {
container.appendChild(div); container.appendChild(div);
scrollToBottom(); scrollToBottom();
} }
} }
/**
* 将消息追加函数暴露到全局,供页面首次加载时回填历史消息使用。
*/
window.appendMessage = appendMessage;
// ── WebSocket 初始化 ───────────────────────────── // ── WebSocket 初始化 ─────────────────────────────
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
if (typeof window.initChat === 'function') { if (typeof window.initChat === 'function') {