🐛 fix(base.py): fix validation logic in _validate_nodes method to handle case when there is only one node in the graph

This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-07-21 08:56:34 -03:00
commit 9811b97908

View file

@ -133,8 +133,8 @@ class CustomComponent(Component):
def load_flow(self, flow_id: UUID = None):
from langflow.processing.process import build_sorted_vertices_with_caching
with get_session() as session:
data_graph = flow.data if (flow := session.get(Flow, flow_id)) else None
session = next(get_session())
data_graph = flow.data if (flow := session.get(Flow, flow_id)) else None
if not data_graph:
raise ValueError(f"Flow {flow_id} not found")
return build_sorted_vertices_with_caching(data_graph)