diff --git a/space_flow/src/components/chatComponent/index.tsx b/space_flow/src/components/chatComponent/index.tsx index 60ed864d6..6a31d6560 100644 --- a/space_flow/src/components/chatComponent/index.tsx +++ b/space_flow/src/components/chatComponent/index.tsx @@ -61,7 +61,8 @@ export default function Chat({flow, reactFlowInstance }) { let message = chatValue; setChatValue(""); addChatHistory(message, true); - sendAll({...reactFlowInstance.toObject(),message}).then((r) => {addChatHistory(r.data.result, false);}); + console.log({...reactFlowInstance.toObject(),message,chatHistory}) + sendAll({...reactFlowInstance.toObject(),message,chatHistory}).then((r) => {addChatHistory(r.data.result, false);}); } else { setErrorData({title: 'Error sending message', list:['Chat nodes are missing.']}) } diff --git a/space_flow/src/contexts/tabsContext.tsx b/space_flow/src/contexts/tabsContext.tsx index 56df51bfe..789dffb11 100644 --- a/space_flow/src/contexts/tabsContext.tsx +++ b/space_flow/src/contexts/tabsContext.tsx @@ -1,4 +1,5 @@ import { createContext, useEffect, useState, useRef } from "react"; +import { example } from "../data_assets/example"; type flow = { name: string; @@ -108,13 +109,13 @@ export function TabsProvider({ children }) { return newFlows; }); } - function addFlow(flowData?: flow) { - const data = flowData?.data ? flowData : null; + function addFlow(flow?: flow) { + const data = flow?.data ? flow.data : null; let newFlow: flow = { - name: flowData ? flowData.name : "flow" + id, + name: flow ? flow.name : "flow" + id, id: id.toString(), data, - chat: flowData ? flowData.chat : [], + chat: flow ? flow.chat : [], }; setId((old) => old + 1); setFlows((prevState) => {