From 3985236224045e14644284f6df990ac47d324bc0 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Sun, 3 Mar 2024 19:03:41 -0300 Subject: [PATCH] Fix should_run_vertex method to remove vertex_id from vertices_to_run list --- src/backend/langflow/api/v1/chat.py | 1 + src/backend/langflow/graph/graph/base.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/backend/langflow/api/v1/chat.py b/src/backend/langflow/api/v1/chat.py index 63f9e329f..fa39a4d4a 100644 --- a/src/backend/langflow/api/v1/chat.py +++ b/src/backend/langflow/api/v1/chat.py @@ -128,6 +128,7 @@ async def build_vertex( next_vertices_ids = [ v for v in next_vertices_ids if graph.should_run_vertex(v) ] + result_data_response = ResultDataResponse(**result_dict.model_dump()) except Exception as exc: diff --git a/src/backend/langflow/graph/graph/base.py b/src/backend/langflow/graph/graph/base.py index 35298f3ea..aeb03e093 100644 --- a/src/backend/langflow/graph/graph/base.py +++ b/src/backend/langflow/graph/graph/base.py @@ -787,7 +787,10 @@ class Graph: def should_run_vertex(self, vertex_id: str) -> bool: """Returns whether a component should be run.""" - return vertex_id in self.vertices_to_run + should_run = vertex_id in self.vertices_to_run + if should_run: + self.vertices_to_run.remove(vertex_id) + return should_run def sort_interface_components_first( self, vertices_layers: List[List[str]]