saving chat for each flow
This commit is contained in:
parent
4e1f1b58bd
commit
6c98a6e474
2 changed files with 6 additions and 3 deletions
|
|
@ -25,11 +25,12 @@ export default function Chat({flow, reactFlowInstance }) {
|
||||||
newChat.push({ message, isSend });
|
newChat.push({ message, isSend });
|
||||||
return newChat;
|
return newChat;
|
||||||
});
|
});
|
||||||
updateFlow({..._.cloneDeep(flow),chat:chatHistory})
|
|
||||||
|
|
||||||
};
|
};
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
// setChatHistory(flow.chat)
|
updateFlow({..._.cloneDeep(flow),chat:chatHistory})
|
||||||
|
},[chatHistory])
|
||||||
|
useEffect(()=>{
|
||||||
|
setChatHistory(flow.chat)
|
||||||
console.log(flow.chat)
|
console.log(flow.chat)
|
||||||
},[flow])
|
},[flow])
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
|
|
|
||||||
|
|
@ -83,12 +83,14 @@ export function TabsProvider({children}){
|
||||||
setTabIndex(flows.length);
|
setTabIndex(flows.length);
|
||||||
}
|
}
|
||||||
function updateFlow(newFlow:flow){
|
function updateFlow(newFlow:flow){
|
||||||
|
console.log(newFlow)
|
||||||
setFlows(prevState=>{
|
setFlows(prevState=>{
|
||||||
const newFlows = [...prevState];
|
const newFlows = [...prevState];
|
||||||
const index = newFlows.findIndex(flow=>flow.id===newFlow.id)
|
const index = newFlows.findIndex(flow=>flow.id===newFlow.id)
|
||||||
if(index!==-1){
|
if(index!==-1){
|
||||||
newFlows[index].data = newFlow.data
|
newFlows[index].data = newFlow.data
|
||||||
newFlows[index].name = newFlow.name
|
newFlows[index].name = newFlow.name
|
||||||
|
newFlows[index].chat = newFlow.chat
|
||||||
}
|
}
|
||||||
return newFlows;
|
return newFlows;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue