fixed message
This commit is contained in:
parent
431b8f1bd3
commit
84921b419f
1 changed files with 1 additions and 4 deletions
|
|
@ -18,13 +18,11 @@ 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'});
|
||||||
|
|
@ -80,7 +78,7 @@ export default function Chat({ reactFlowInstance }) {
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div className="w-full text-end">
|
<div className="w-full text-end">
|
||||||
<div style={{color: nodeColors['chat']}} className="text-start inline-block rounded-xl p-3 overflow-hidden w-fit max-w-[280px] px-5 text-sm text-white font-normal rounded-tr-none">
|
<div style={{backgroundColor: nodeColors['chat']}} className="text-start inline-block rounded-xl p-3 overflow-hidden w-fit max-w-[280px] px-5 text-sm text-white font-normal rounded-tr-none">
|
||||||
{c.message}
|
{c.message}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -111,7 +109,6 @@ export default function Chat({ reactFlowInstance }) {
|
||||||
setChatValue("");
|
setChatValue("");
|
||||||
addChatHistory(message, true);
|
addChatHistory(message, true);
|
||||||
sendAll({...reactFlowInstance.toObject(),message}).then((r) => {addChatHistory(r.data.result, false);});
|
sendAll({...reactFlowInstance.toObject(),message}).then((r) => {addChatHistory(r.data.result, 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