fix: 打开历史对话时显示历史消息
- renderMessages 函数添加 welcome 显示控制 - 有消息时隐藏欢迎界面,无消息时显示
This commit is contained in:
@@ -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 ? '👤' : '🤖';
|
||||||
|
|||||||
Reference in New Issue
Block a user