Fix duplicate gem icon during AI streaming response
Skip rendering the empty placeholder assistant message while isLoading is true — the GeminiTypingIndicator already shows the gem icon with bouncing dots. Once tokens arrive and content is non-empty, the message renders normally via GeminiMessage. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
60acbac464
commit
117a8ddb58
@@ -352,13 +352,19 @@ export function GeminiChat() {
|
||||
<div className="max-w-3xl mx-auto px-4 pt-8 pb-4">
|
||||
{/* 对话中也显示工单摘要 */}
|
||||
{ticketSystemConnected && <TicketSummary tickets={tickets} />}
|
||||
{messages.map((msg) => (
|
||||
{messages.map((msg) => {
|
||||
// Hide empty assistant message while streaming — the typing indicator covers it
|
||||
if (msg.role === "assistant" && msg.content === "" && isLoading) {
|
||||
return null;
|
||||
}
|
||||
return (
|
||||
<GeminiMessage
|
||||
key={msg.id}
|
||||
message={msg}
|
||||
onRegenerate={msg.role === "assistant" ? handleRegenerate : undefined}
|
||||
/>
|
||||
))}
|
||||
);
|
||||
})}
|
||||
{isLoading && <GeminiTypingIndicator />}
|
||||
<div ref={messagesEndRef} />
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user