From b308183f0d201d6f44e7c94f144d22e0c80f3a72 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Tue, 20 Feb 2024 10:47:44 -0300 Subject: [PATCH] Fix vertex sorting issue in Graph class --- src/backend/langflow/graph/graph/base.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/backend/langflow/graph/graph/base.py b/src/backend/langflow/graph/graph/base.py index a4e78f02c..719f8be01 100644 --- a/src/backend/langflow/graph/graph/base.py +++ b/src/backend/langflow/graph/graph/base.py @@ -94,6 +94,7 @@ class Graph: or vertex.__repr__() != other.get_vertex(vertex.id).__repr__() ): vertex.data = other.get_vertex(vertex.id).data + vertex.params = {} vertex._build_params() vertex.graph = self vertex._built = False @@ -461,11 +462,12 @@ class Graph: # we just need to check if the vertex id contains ChatInput or ChatOutput # and sort the layers accordingly # InterfaceComponentTypes is an enum + # check all values of the enum and sort the layers for layer in vertices: layer.sort( key=lambda x: any( - InterfaceComponentTypes.CHAT_INPUT.value in x, - InterfaceComponentTypes.CHAT_OUTPUT.value in x, + comp_type.value in x + for comp_type in InterfaceComponentTypes.__members__.values() ) ) return self.sort_chat_inputs_first(vertices)