debug messages
This commit is contained in:
parent
c0e053ce18
commit
431b8f1bd3
1 changed files with 3 additions and 1 deletions
|
|
@ -18,11 +18,13 @@ export default function Chat({ reactFlowInstance }) {
|
||||||
const [chatHistory, setChatHistory] = useState([]);
|
const [chatHistory, setChatHistory] = useState([]);
|
||||||
const {setErrorData} = useContext(alertContext);
|
const {setErrorData} = useContext(alertContext);
|
||||||
const addChatHistory = (message, isSend) => {
|
const addChatHistory = (message, isSend) => {
|
||||||
|
console.log(message);
|
||||||
setChatHistory((old) => {
|
setChatHistory((old) => {
|
||||||
let newChat = _.cloneDeep(old);
|
let newChat = _.cloneDeep(old);
|
||||||
newChat.push({ message, isSend });
|
newChat.push({ message, isSend });
|
||||||
return newChat;
|
return newChat;
|
||||||
});
|
});
|
||||||
|
console.log(chatHistory);
|
||||||
};
|
};
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
ref.current.scrollIntoView({behavior: 'smooth'});
|
ref.current.scrollIntoView({behavior: 'smooth'});
|
||||||
|
|
@ -108,7 +110,7 @@ export default function Chat({ reactFlowInstance }) {
|
||||||
let message = chatValue;
|
let message = chatValue;
|
||||||
setChatValue("");
|
setChatValue("");
|
||||||
addChatHistory(message, true);
|
addChatHistory(message, true);
|
||||||
sendAll({...reactFlowInstance.toObject(),message}).then((r) => {console.log(r.data.result); addChatHistory(r.data.result, false);});
|
sendAll({...reactFlowInstance.toObject(),message}).then((r) => {addChatHistory(r.data.result, false);});
|
||||||
addChatHistory('teste', false);
|
addChatHistory('teste', false);
|
||||||
} else {
|
} else {
|
||||||
setErrorData({title: 'Error sending message', list:['Chat nodes are missing.']})
|
setErrorData({title: 'Error sending message', list:['Chat nodes are missing.']})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue