fix: RAG开启时AI回复后loading动画不消失的问题

根因:appendSystemMessage() 在 assistant placeholder 之后插入了一个无 .message class 的 div,
导致 CSS 选择器 .message.assistant:last-child 无法命中 placeholder(它不再是 :last-child)。
updateLastAssistantMessage() 返回 null,loading 动画永远不会被移除。

修复:将 3 处 :last-child 改为 :last-of-type,使选择器基于元素类型(div)而非精确的最后一个子节点匹配。
This commit is contained in:
Metona
2026-04-05 00:22:24 +08:00
parent 8d4ab5c98c
commit f3589ae057
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -511,7 +511,7 @@ ${ragContext}
console.error('[InputArea] 流式聊天错误:', err);
if (err.name === 'AbortError') {
const placeholder = document.querySelector('#messagesContainer .message.assistant:last-child');
const placeholder = document.querySelector('#messagesContainer .message.assistant:last-of-type');
const loadingDots = placeholder?.querySelector('.loading-dots');
const loadingText = placeholder?.querySelector('.loading-text');
if (loadingDots) loadingDots.remove();
@@ -547,7 +547,7 @@ ${ragContext}
return;
}
const placeholder = document.querySelector('#messagesContainer .message.assistant:last-child');
const placeholder = document.querySelector('#messagesContainer .message.assistant:last-of-type');
const loadingDots = placeholder?.querySelector('.loading-dots');
const loadingText = placeholder?.querySelector('.loading-text');
if (loadingDots) loadingDots.remove();