From d20efe4bba5d2e390f78e53de373f14533da4090 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Fri, 21 Jun 2024 21:59:23 -0300 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20(utils.py):=20add=20initialization?= =?UTF-8?q?=20of=20run=20and=20cache=20setting=20for=20the=20graph=20to=20?= =?UTF-8?q?improve=20performance=20and=20functionality?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/base/langflow/api/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/backend/base/langflow/api/utils.py b/src/backend/base/langflow/api/utils.py index 9aa145aa0..99d4d3681 100644 --- a/src/backend/base/langflow/api/utils.py +++ b/src/backend/base/langflow/api/utils.py @@ -211,7 +211,7 @@ async def build_graph_from_db(flow_id: str, session: Session, chat_service: "Cha flow: Optional[Flow] = session.get(Flow, flow_id) if not flow or not flow.data: raise ValueError("Invalid flow ID") - graph = Graph.from_payload(flow.data, flow_id, flow_name=flow.name, user_id=flow.user_id) + graph = Graph.from_payload(flow.data, flow_id, flow_name=flow.name, user_id=str(flow.user_id)) for vertex_id in graph._has_session_id_vertices: vertex = graph.get_vertex(vertex_id) if vertex is None: @@ -222,6 +222,7 @@ async def build_graph_from_db(flow_id: str, session: Session, chat_service: "Cha run_id = uuid.uuid4() graph.set_run_id(run_id) graph.set_run_name() + await graph.initialize_run() await chat_service.set_cache(flow_id, graph) return graph