From d5958e2134de74141c166a7a49c44375929cf9a9 Mon Sep 17 00:00:00 2001 From: thibaud-lclr Date: Thu, 16 Apr 2026 08:30:41 +0200 Subject: [PATCH] feat: show loader in streaming agent bubble --- src/components/projects/ProjectLiveAgent.tsx | 40 +++++++++++++++----- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/src/components/projects/ProjectLiveAgent.tsx b/src/components/projects/ProjectLiveAgent.tsx index ec469c3..f4f41af 100644 --- a/src/components/projects/ProjectLiveAgent.tsx +++ b/src/components/projects/ProjectLiveAgent.tsx @@ -30,6 +30,35 @@ interface LiveStreamStatusPayload { error?: string | null; } +function StreamingAgentBubble({ content }: { content: string }) { + return ( +
+
+ agent +
+
{content || "Réponse en cours..."}
+
+
+
+ ); +} + export default function ProjectLiveAgent() { const { projectId } = useParams<{ projectId: string }>(); const [agents, setAgents] = useState([]); @@ -128,7 +157,7 @@ export default function ProjectLiveAgent() { return next; }); - if (payload.message.sender === "agent") { + if (payload.message.sender === "agent" && payload.message.content.trim() !== "") { setStreamingAgentResponse(null); } }), @@ -338,14 +367,7 @@ export default function ProjectLiveAgent() { ))} {streamingAgentResponse !== null && ( -
-
- agent -
-
- {streamingAgentResponse || "En train de repondre..."} -
-
+ )} {messages.length === 0 && streamingAgentResponse === null && (
Pas encore de message.