fix: hide typing indicator once assistant message appears during streaming

The "two diamond" bug was caused by GeminiTypingIndicator (which has its
own gem icon) rendering simultaneously with GeminiMessage (also has a gem
icon) once the first token arrived. Now the typing indicator only shows
while isLoading is true AND no assistant message exists yet (last message
is not role "assistant").

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
gongzhiyong
2026-04-08 17:43:58 +08:00
co-authored by Claude Sonnet 4.6
parent c2e14c48a0
commit b9465f4c5a
+3 -1
View File
@@ -367,7 +367,9 @@ export function GeminiChat() {
/>
);
})}
{isLoading && <GeminiTypingIndicator />}
{isLoading && messages.length > 0 && messages[messages.length - 1].role !== "assistant" && (
<GeminiTypingIndicator />
)}
<div ref={messagesEndRef} />
</div>
)}