From f6fb5aab78bf81d3930b7c109a9b8da7202a820b Mon Sep 17 00:00:00 2001 From: lkddi Date: Sat, 11 Apr 2026 15:54:25 +0800 Subject: [PATCH] Fix self welcome message rendering --- resources/views/chat/partials/scripts.blade.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/resources/views/chat/partials/scripts.blade.php b/resources/views/chat/partials/scripts.blade.php index be5f244..174d6e0 100644 --- a/resources/views/chat/partials/scripts.blade.php +++ b/resources/views/chat/partials/scripts.blade.php @@ -777,13 +777,20 @@ container2.querySelectorAll('[data-autosave="1"]').forEach(el => el.remove()); } container2.appendChild(div); - if (autoScroll) container2.scrollTop = container2.scrollHeight; + if (autoScroll) { + container2.scrollTop = container2.scrollHeight; + } } else { container.appendChild(div); scrollToBottom(); } } + /** + * 将消息追加函数暴露到全局,供页面首次加载时回填历史消息使用。 + */ + window.appendMessage = appendMessage; + // ── WebSocket 初始化 ───────────────────────────── document.addEventListener('DOMContentLoaded', () => { if (typeof window.initChat === 'function') {