Merge branch 'dev' of https://github.com/logspace-ai/langflow into chatgpt

This commit is contained in:
Gabriel Almeida 2023-04-04 21:49:40 -03:00
commit 9c62adb8a6
2 changed files with 20 additions and 22 deletions

View file

@ -75,25 +75,24 @@ export default function Chat({ flow, reactFlowInstance }: ChatType) {
}, [chatHistory]); }, [chatHistory]);
function validateNodes() { function validateNodes() {
if ( if (
reactFlowInstance reactFlowInstance.getNodes().some(
.getNodes() (n) =>
.some( n.data.node &&
(n) => Object.keys(n.data.node.template).some((t: any) => {
n.data.node && return (
Object.keys(n.data.node.template).some( n.data.node.template[t].required &&
(t: any) => (!n.data.node.template[t].value ||
n.data.node.template[t].required && n.data.node.template[t].value === "") &&
n.data.node.template[t].value === "" && !reactFlowInstance
n.data.node.template[t].required && .getEdges()
!reactFlowInstance .some(
.getEdges() (e) =>
.some( e.targetHandle.split("|")[1] === t &&
(e) => e.targetHandle.split("|")[2] === n.id
e.sourceHandle.split("|")[1] === t && )
e.sourceHandle.split("|")[2] === n.id );
) })
) )
)
) { ) {
return false; return false;
} }
@ -130,10 +129,10 @@ export default function Chat({ flow, reactFlowInstance }: ChatType) {
setChatHistory((chatHistory) => { setChatHistory((chatHistory) => {
let newChat = chatHistory; let newChat = chatHistory;
lastMessage= newChat.pop().message; lastMessage = newChat.pop().message;
return newChat; return newChat;
}); });
setChatValue(lastMessage) setChatValue(lastMessage);
}); });
} else { } else {
setErrorData({ setErrorData({

View file

@ -9,7 +9,6 @@ import {
ComputerDesktopIcon, ComputerDesktopIcon,
Bars3CenterLeftIcon, Bars3CenterLeftIcon,
GiftIcon, GiftIcon,
PaperClipIcon,
QuestionMarkCircleIcon, QuestionMarkCircleIcon,
} from "@heroicons/react/24/outline"; } from "@heroicons/react/24/outline";
import { Connection, Edge, Node, ReactFlowInstance } from "reactflow"; import { Connection, Edge, Node, ReactFlowInstance } from "reactflow";