diff --git a/src/frontend/src/stores/flowStore.ts b/src/frontend/src/stores/flowStore.ts index bc9e03e8f..86646d15c 100644 --- a/src/frontend/src/stores/flowStore.ts +++ b/src/frontend/src/stores/flowStore.ts @@ -74,7 +74,7 @@ const useFlowStore = create((set, get) => ({ updateFlowPool: ( nodeId: string, data: VertexBuildTypeAPI | ChatOutputType | ChatInputType, - buildId?: string + buildId?: string, ) => { let newFlowPool = cloneDeep({ ...get().flowPool }); if (!newFlowPool[nodeId]) { @@ -90,7 +90,7 @@ const useFlowStore = create((set, get) => ({ } //update data results else { - newFlowPool[nodeId][index].data.message = data as + newFlowPool[nodeId][index].data.messages[0] = data as | ChatOutputType | ChatInputType; } @@ -167,7 +167,7 @@ const useFlowStore = create((set, get) => ({ flowsManager.autoSaveCurrentFlow( newChange, newEdges, - get().reactFlowInstance?.getViewport() ?? { x: 0, y: 0, zoom: 1 } + get().reactFlowInstance?.getViewport() ?? { x: 0, y: 0, zoom: 1 }, ); } }, @@ -183,7 +183,7 @@ const useFlowStore = create((set, get) => ({ flowsManager.autoSaveCurrentFlow( get().nodes, newChange, - get().reactFlowInstance?.getViewport() ?? { x: 0, y: 0, zoom: 1 } + get().reactFlowInstance?.getViewport() ?? { x: 0, y: 0, zoom: 1 }, ); } }, @@ -201,7 +201,7 @@ const useFlowStore = create((set, get) => ({ return newChange; } return node; - }) + }), ); }, getNode: (id: string) => { @@ -212,8 +212,8 @@ const useFlowStore = create((set, get) => ({ get().nodes.filter((node) => typeof nodeId === "string" ? node.id !== nodeId - : !nodeId.includes(node.id) - ) + : !nodeId.includes(node.id), + ), ); }, deleteEdge: (edgeId) => { @@ -221,8 +221,8 @@ const useFlowStore = create((set, get) => ({ get().edges.filter((edge) => typeof edgeId === "string" ? edge.id !== edgeId - : !edgeId.includes(edge.id) - ) + : !edgeId.includes(edge.id), + ), ); }, paste: (selection, position) => { @@ -288,7 +288,7 @@ const useFlowStore = create((set, get) => ({ let source = idsMap[edge.source]; let target = idsMap[edge.target]; const sourceHandleObject: sourceHandleType = scapeJSONParse( - edge.sourceHandle! + edge.sourceHandle!, ); let sourceHandle = scapedJSONStringfy({ ...sourceHandleObject, @@ -298,7 +298,7 @@ const useFlowStore = create((set, get) => ({ edge.data.sourceHandle = sourceHandleObject; const targetHandleObject: targetHandleType = scapeJSONParse( - edge.targetHandle! + edge.targetHandle!, ); let targetHandle = scapedJSONStringfy({ ...targetHandleObject, @@ -319,7 +319,7 @@ const useFlowStore = create((set, get) => ({ className: "stroke-gray-900 ", selected: false, }, - newEdges.map((edge) => ({ ...edge, selected: false })) + newEdges.map((edge) => ({ ...edge, selected: false })), ); }); get().setEdges(newEdges); @@ -338,10 +338,10 @@ const useFlowStore = create((set, get) => ({ }); const newNodes = get().nodes.filter( - (node) => !nodesIdsSelected.includes(node.id) + (node) => !nodesIdsSelected.includes(node.id), ); const newEdges = get().edges.filter( - (edge) => !edgesIdsSelected.includes(edge.id) + (edge) => !edgesIdsSelected.includes(edge.id), ); set({ nodes: newNodes, edges: newEdges }); @@ -399,7 +399,7 @@ const useFlowStore = create((set, get) => ({ style: { stroke: "#555" }, className: "stroke-foreground stroke-connection", }, - oldEdges + oldEdges, ); return newEdges; @@ -409,7 +409,7 @@ const useFlowStore = create((set, get) => ({ .autoSaveCurrentFlow( get().nodes, newEdges, - get().reactFlowInstance?.getViewport() ?? { x: 0, y: 0, zoom: 1 } + get().reactFlowInstance?.getViewport() ?? { x: 0, y: 0, zoom: 1 }, ); }, unselectAll: () => { @@ -444,7 +444,7 @@ const useFlowStore = create((set, get) => ({ function validateSubgraph(nodes: string[]) { const errorsObjs = validateNodes( get().nodes.filter((node) => nodes.includes(node.id)), - get().edges + get().edges, ); const errors = errorsObjs.map((obj) => obj.errors).flat(); @@ -463,13 +463,13 @@ const useFlowStore = create((set, get) => ({ function handleBuildUpdate( vertexBuildData: VertexBuildTypeAPI, status: BuildStatus, - runId: string + runId: string, ) { if (vertexBuildData && vertexBuildData.inactivated_vertices) { get().removeFromVerticesBuild(vertexBuildData.inactivated_vertices); get().updateBuildStatus( vertexBuildData.inactivated_vertices, - BuildStatus.INACTIVE + BuildStatus.INACTIVE, ); } @@ -485,14 +485,14 @@ const useFlowStore = create((set, get) => ({ // next_vertices_ids should be next_vertices_ids without the inactivated vertices const next_vertices_ids = vertexBuildData.next_vertices_ids.filter( - (id) => !vertexBuildData.inactivated_vertices?.includes(id) + (id) => !vertexBuildData.inactivated_vertices?.includes(id), ); const top_level_vertices = vertexBuildData.top_level_vertices.filter( - (vertex) => !vertexBuildData.inactivated_vertices?.includes(vertex) + (vertex) => !vertexBuildData.inactivated_vertices?.includes(vertex), ); const nextVertices: VertexLayerElementType[] = zip( next_vertices_ids, - top_level_vertices + top_level_vertices, ).map(([id, reference]) => ({ id: id!, reference })); const newLayers = [ @@ -514,7 +514,7 @@ const useFlowStore = create((set, get) => ({ get().addDataToFlowPool( { ...vertexBuildData, run_id: runId }, - vertexBuildData.id + vertexBuildData.id, ); useFlowStore.getState().updateBuildStatus([vertexBuildData.id], status); @@ -523,7 +523,7 @@ const useFlowStore = create((set, get) => ({ const newFlowBuildStatus = { ...get().flowBuildStatus }; // filter out the vertices that are not status const verticesToUpdate = verticesIds?.filter( - (id) => newFlowBuildStatus[id]?.status !== BuildStatus.BUILT + (id) => newFlowBuildStatus[id]?.status !== BuildStatus.BUILT, ); if (verticesToUpdate) { @@ -593,7 +593,7 @@ const useFlowStore = create((set, get) => ({ verticesLayers: VertexLayerElementType[][]; runId: string; verticesToRun: string[]; - } | null + } | null, ) => { set({ verticesBuild: vertices }); }, @@ -618,7 +618,7 @@ const useFlowStore = create((set, get) => ({ // that are going to be built verticesIds: get().verticesBuild!.verticesIds.filter( // keep the vertices that are not in the list of vertices to remove - (vertex) => !vertices.includes(vertex) + (vertex) => !vertices.includes(vertex), ), }, });