diff --git a/pitch-deck/components/ui/ChatInterface.tsx b/pitch-deck/components/ui/ChatInterface.tsx index fe29cd8..93a4eb9 100644 --- a/pitch-deck/components/ui/ChatInterface.tsx +++ b/pitch-deck/components/ui/ChatInterface.tsx @@ -48,16 +48,16 @@ export default function ChatInterface({ lang }: ChatInterfaceProps) { const reader = res.body!.getReader() const decoder = new TextDecoder() let content = '' + let firstChunk = true while (true) { const { done, value } = await reader.read() if (done) break - const chunk = decoder.decode(value, { stream: true }) - content += chunk + content += decoder.decode(value, { stream: true }) - if (isWaiting || content.length === chunk.length) { - // First chunk arrived — replace waiting indicator with real content + if (firstChunk) { + firstChunk = false setIsWaiting(false) setMessages(prev => [...prev, { role: 'assistant', content }]) } else {