Преглед изворни кода

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 пре 5 дана
родитељ
комит
154d2b569a
1 измењених фајлова са 14 додато и 1 уклоњено
  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({
   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),
     onError: () => setIsTyping(false),
   });
   });