save and upload working fine

This commit is contained in:
anovazzi1 2023-02-27 21:05:12 -03:00
commit 6014297e07
2 changed files with 7 additions and 5 deletions

View file

@ -61,7 +61,8 @@ export default function Chat({flow, reactFlowInstance }) {
let message = chatValue; let message = chatValue;
setChatValue(""); setChatValue("");
addChatHistory(message, true); 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 { } else {
setErrorData({title: 'Error sending message', list:['Chat nodes are missing.']}) setErrorData({title: 'Error sending message', list:['Chat nodes are missing.']})
} }

View file

@ -1,4 +1,5 @@
import { createContext, useEffect, useState, useRef } from "react"; import { createContext, useEffect, useState, useRef } from "react";
import { example } from "../data_assets/example";
type flow = { type flow = {
name: string; name: string;
@ -108,13 +109,13 @@ export function TabsProvider({ children }) {
return newFlows; return newFlows;
}); });
} }
function addFlow(flowData?: flow) { function addFlow(flow?: flow) {
const data = flowData?.data ? flowData : null; const data = flow?.data ? flow.data : null;
let newFlow: flow = { let newFlow: flow = {
name: flowData ? flowData.name : "flow" + id, name: flow ? flow.name : "flow" + id,
id: id.toString(), id: id.toString(),
data, data,
chat: flowData ? flowData.chat : [], chat: flow ? flow.chat : [],
}; };
setId((old) => old + 1); setId((old) => old + 1);
setFlows((prevState) => { setFlows((prevState) => {