From 40b3a9d6e315441e822fa2eec2765f50c7d1108d Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Tue, 4 Apr 2023 20:53:48 -0300 Subject: [PATCH] fixed verification error --- .../src/components/chatComponent/index.tsx | 41 +++++++++---------- src/frontend/src/utils.ts | 1 - 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/src/frontend/src/components/chatComponent/index.tsx b/src/frontend/src/components/chatComponent/index.tsx index ea7236f40..59cc54b4c 100644 --- a/src/frontend/src/components/chatComponent/index.tsx +++ b/src/frontend/src/components/chatComponent/index.tsx @@ -75,25 +75,24 @@ export default function Chat({ flow, reactFlowInstance }: ChatType) { }, [chatHistory]); function validateNodes() { if ( - reactFlowInstance - .getNodes() - .some( - (n) => - n.data.node && - Object.keys(n.data.node.template).some( - (t: any) => - n.data.node.template[t].required && - n.data.node.template[t].value === "" && - n.data.node.template[t].required && - !reactFlowInstance - .getEdges() - .some( - (e) => - e.sourceHandle.split("|")[1] === t && - e.sourceHandle.split("|")[2] === n.id - ) - ) - ) + reactFlowInstance.getNodes().some( + (n) => + n.data.node && + Object.keys(n.data.node.template).some((t: any) => { + return ( + n.data.node.template[t].required && + (!n.data.node.template[t].value || + n.data.node.template[t].value === "") && + !reactFlowInstance + .getEdges() + .some( + (e) => + e.targetHandle.split("|")[1] === t && + e.targetHandle.split("|")[2] === n.id + ) + ); + }) + ) ) { return false; } @@ -130,10 +129,10 @@ export default function Chat({ flow, reactFlowInstance }: ChatType) { setChatHistory((chatHistory) => { let newChat = chatHistory; - lastMessage= newChat.pop().message; + lastMessage = newChat.pop().message; return newChat; }); - setChatValue(lastMessage) + setChatValue(lastMessage); }); } else { setErrorData({ diff --git a/src/frontend/src/utils.ts b/src/frontend/src/utils.ts index dc59c6640..795f5f058 100644 --- a/src/frontend/src/utils.ts +++ b/src/frontend/src/utils.ts @@ -9,7 +9,6 @@ import { ComputerDesktopIcon, Bars3CenterLeftIcon, GiftIcon, - PaperClipIcon, QuestionMarkCircleIcon, } from "@heroicons/react/24/outline"; import { Connection, Edge, Node, ReactFlowInstance } from "reactflow";