Explorar o código

fix: Playground sendMessage onSuccess now renders bot reply

The sendMessage mutation's onSuccess only called setIsTyping(false),
silently discarding Ellie's reply. Now adds the bot message to the
chat list and updates the Execution Path with the response source
(flow/knowledge/llm).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Tony T hai 5 días
pai
achega
154d2b569a
Modificáronse 1 ficheiros con 14 adicións e 1 borrados
  1. 14 1
      client/src/pages/Playground.tsx

+ 14 - 1
client/src/pages/Playground.tsx

@@ -61,7 +61,20 @@ export default function Playground() {
   );
 
   const sendMessage = trpc.chat.sendMessage.useMutation({
-    onSuccess: () => setIsTyping(false),
+    onSuccess: (data) => {
+      setIsTyping(false);
+      if (data.reply) {
+        setFlowPath(prev => [...prev, data.source ?? data.status ?? "reply"]);
+        setMessages(prev => [...prev, {
+          id: Date.now(),
+          sender: "bot",
+          content: data.reply as string,
+          timestamp: new Date().toISOString(),
+          flowStep: data.source === "flow" ? "Flow: matched" : data.source === "knowledge" ? "KB: matched" : `LLM: ${data.status}`,
+        }]);
+        setShowGreeting(false);
+      }
+    },
     onError: () => setIsTyping(false),
   });