Add more nodes for agents, loaders

This commit is contained in:
Henry
2023-04-10 13:56:44 +01:00
parent 05c86ff9c5
commit 58e06718d1
57 changed files with 1584 additions and 89 deletions
-1
View File
@@ -8,7 +8,6 @@ export const SET_LAYOUT = '@customization/SET_LAYOUT '
export const SET_DARKMODE = '@customization/SET_DARKMODE'
// action - canvas reducer
export const REMOVE_EDGE = '@canvas/REMOVE_EDGE'
export const SET_DIRTY = '@canvas/SET_DIRTY'
export const REMOVE_DIRTY = '@canvas/REMOVE_DIRTY'
export const SET_CHATFLOW = '@canvas/SET_CHATFLOW'
@@ -4,7 +4,8 @@ import PropTypes from 'prop-types'
const initialValue = {
reactFlowInstance: null,
setReactFlowInstance: () => {},
deleteNode: () => {}
deleteNode: () => {},
deleteEdge: () => {}
}
export const flowContext = createContext(initialValue)
@@ -17,12 +18,17 @@ export const ReactFlowContext = ({ children }) => {
reactFlowInstance.setEdges(reactFlowInstance.getEdges().filter((ns) => ns.source !== id && ns.target !== id))
}
const deleteEdge = (id) => {
reactFlowInstance.setEdges(reactFlowInstance.getEdges().filter((edge) => edge.id !== id))
}
return (
<flowContext.Provider
value={{
reactFlowInstance,
setReactFlowInstance,
deleteNode
deleteNode,
deleteEdge
}}
>
{children}
@@ -2,7 +2,6 @@
import * as actionTypes from '../actions'
export const initialState = {
removeEdgeId: '',
isDirty: false,
chatflow: null
}
@@ -11,11 +10,6 @@ export const initialState = {
const canvasReducer = (state = initialState, action) => {
switch (action.type) {
case actionTypes.REMOVE_EDGE:
return {
...state,
removeEdgeId: action.edgeId
}
case actionTypes.SET_DIRTY:
return {
...state,