From 6014297e07878df997b905411e2c06be288c4766 Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Mon, 27 Feb 2023 21:05:12 -0300 Subject: [PATCH] save and upload working fine --- space_flow/src/components/chatComponent/index.tsx | 3 ++- space_flow/src/contexts/tabsContext.tsx | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) 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) => {