fix: 打开历史对话时显示历史消息

- renderMessages 函数添加 welcome 显示控制
- 有消息时隐藏欢迎界面,无消息时显示
This commit is contained in:
2026-04-25 23:33:07 +08:00
parent 47a46bd5ea
commit 1e5b20294c

View File

@@ -410,6 +410,11 @@ function clearCurrentChat() {
function renderMessages() { function renderMessages() {
if (!currentConversation) return; if (!currentConversation) return;
// 根据消息数量显示/隐藏欢迎界面
if (welcome) {
welcome.style.display = currentConversation.messages.length > 0 ? 'none' : 'block';
}
messagesDiv.innerHTML = currentConversation.messages.map((msg, index) => { messagesDiv.innerHTML = currentConversation.messages.map((msg, index) => {
const isUser = msg.role === 'user'; const isUser = msg.role === 'user';
const avatar = isUser ? '👤' : '🤖'; const avatar = isUser ? '👤' : '🤖';