feat(chat_manager.py): add empty_history method to ChatHistory class

fix(chat_manager.py): empty chat history for a client when an exception is raised
fix(GenericNode): fix useEffect dependencies to avoid unnecessary re-renders
This commit is contained in:
Gabriel Almeida 2023-04-28 20:31:53 -03:00
commit c3dffa3508
2 changed files with 13 additions and 8 deletions

View file

@ -29,6 +29,13 @@ export default function GenericNode({
const [isGreenOutline, setIsGreenOutline] = useState(false);
const [isRedOutline, setIsRedOutline] = useState(false);
const { reactFlowInstance } = useContext(typesContext);
const [params, setParams] = useState([]);
useEffect(() => {
if (reactFlowInstance) {
setParams(Object.values(reactFlowInstance.toObject()));
}
}, [reactFlowInstance]);
const debouncedValidateNode = useDebouncedCallback(async () => {
// Check if the validationStatus is "success"
@ -60,14 +67,7 @@ export default function GenericNode({
useEffect(() => {
validateNode();
}, [
validateNode,
// Use the result of ...reactFlowInstance.toObject()
// to determine if the node has changed
// turn into an array of nodes and edges
// and compare the length of the array
...Object.values(reactFlowInstance.toObject()),
]);
}, [validateNode, params]);
useEffect(() => {
if (validationStatus === "success") {