Преглед на файлове

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({
-    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),
   });