diff --git a/langflow/frontend/src/components/chatComponent/index.tsx b/langflow/frontend/src/components/chatComponent/index.tsx index 00a278037..4cf6dcd82 100644 --- a/langflow/frontend/src/components/chatComponent/index.tsx +++ b/langflow/frontend/src/components/chatComponent/index.tsx @@ -5,7 +5,7 @@ import { PaperAirplaneIcon, XMarkIcon, } from "@heroicons/react/24/outline"; -import { useContext, useEffect, useRef, useState } from "react"; +import { MouseEventHandler, useContext, useEffect, useRef, useState } from "react"; import { sendAll } from "../../controllers/NodesServices"; import { alertContext } from "../../contexts/alertContext"; import { classNames, nodeColors } from "../../utils"; @@ -89,7 +89,7 @@ export default function Chat({ flow, reactFlowInstance }: ChatType) { sendAll({ ...reactFlowInstance.toObject(), message, chatHistory }) .then((r) => { console.log(r.data); - addChatHistory(r.data.result, false,r.data.thought); + addChatHistory(r.data.result, false, r.data.thought); setLockChat(false); }) .catch((error) => { @@ -109,6 +109,10 @@ export default function Chat({ flow, reactFlowInstance }: ChatType) { }); } } + function clearChat() { + setChatHistory([]) + updateFlow({ ..._.cloneDeep(flow), chat: []}); + } return ( <> @@ -137,10 +141,18 @@ export default function Chat({ flow, reactFlowInstance }: ChatType) { /> Chat +