Fixes State management and first implementation of vertex inactivation (#1805)
* Refactor RoutingVertex class in types.py to include a new step in the steps list * Refactor Graph class to update run_manager.run_predecessors when activating vertices * Refactor ShouldRunNextComponent class in ShouldRunNext.py to improve error handling and readability * Refactor error handling in get_lifespan function in main.py and fix mismatch between models and database in DatabaseService class in service.py * Fix vertex inactivation * Fix inactivation of vertices and update buildUtils * Refactor ShouldRunNextComponent class to improve error handling and readability * Refactor langflow.graph.vertex.types imports in base.py * Fix nullable constraint in langflow migration script * Fix condition check in ShouldRunNextComponent class * Refactor build_graph_maps function in base.py to accept optional parameters for edges and vertices * Apply grayscale effect to ring-muted-foreground in applies.css * Apply grayscale effect to ring-muted-foreground in applies.css
This commit is contained in:
parent
ee6aa0c6dd
commit
95813de618
13 changed files with 106 additions and 68 deletions
|
|
@ -478,8 +478,13 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
|
|||
// const nextVertices will be the zip of vertexBuildData.next_vertices_ids and
|
||||
// vertexBuildData.top_level_vertices
|
||||
// the VertexLayerElementType as {id: next_vertices_id, layer: top_level_vertex}
|
||||
|
||||
// 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)
|
||||
);
|
||||
const nextVertices: VertexLayerElementType[] = zip(
|
||||
vertexBuildData.next_vertices_ids,
|
||||
next_vertices_ids,
|
||||
vertexBuildData.top_level_vertices
|
||||
).map(([id, reference]) => ({ id: id!, reference }));
|
||||
|
||||
|
|
@ -489,7 +494,7 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
|
|||
];
|
||||
const newIds = [
|
||||
...get().verticesBuild!.verticesIds,
|
||||
...vertexBuildData.next_vertices_ids,
|
||||
...next_vertices_ids,
|
||||
];
|
||||
get().updateVerticesBuild({
|
||||
verticesIds: newIds,
|
||||
|
|
@ -598,7 +603,10 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
|
|||
set({
|
||||
verticesBuild: {
|
||||
...verticesBuild,
|
||||
// remove the vertices from the list of vertices ids
|
||||
// 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)
|
||||
),
|
||||
},
|
||||
|
|
|
|||
|
|
@ -323,7 +323,7 @@
|
|||
muted-foreground is too strong, maybe use a lighter shade of it?
|
||||
|
||||
*/
|
||||
@apply border-none ring ring-muted-foreground;
|
||||
@apply border-none ring grayscale;
|
||||
}
|
||||
.built-invalid-status {
|
||||
@apply border-none ring ring-[#FF9090];
|
||||
|
|
|
|||
|
|
@ -166,14 +166,26 @@ export async function buildVertices({
|
|||
!useFlowStore
|
||||
.getState()
|
||||
.verticesBuild?.verticesIds.includes(element.id) &&
|
||||
!useFlowStore
|
||||
.getState()
|
||||
.verticesBuild?.verticesIds.includes(element.reference ?? "") &&
|
||||
onBuildUpdate
|
||||
) {
|
||||
// If it is, skip building and set the state to inactive
|
||||
onBuildUpdate(
|
||||
getInactiveVertexData(element.id),
|
||||
BuildStatus.INACTIVE,
|
||||
runId
|
||||
);
|
||||
if (element.id) {
|
||||
onBuildUpdate(
|
||||
getInactiveVertexData(element.id),
|
||||
BuildStatus.INACTIVE,
|
||||
runId
|
||||
);
|
||||
}
|
||||
if (element.reference) {
|
||||
onBuildUpdate(
|
||||
getInactiveVertexData(element.reference),
|
||||
BuildStatus.INACTIVE,
|
||||
runId
|
||||
);
|
||||
}
|
||||
buildResults.push(false);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue