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;
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.']})
}

View file

@ -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) => {