From 9acb6fef36160094addf7d78e8a35dcd1cc3e794 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Mon, 31 Jul 2023 10:26:27 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=20feat(custom=5Fcomponent.py):=20a?= =?UTF-8?q?dd=20methods=20to=20retrieve=20flow=20by=20name=20and=20flow=20?= =?UTF-8?q?by=20id=20for=20CustomComponent=20=F0=9F=90=9B=20fix(custom=5Fc?= =?UTF-8?q?omponent.py):=20fix=20indentation=20issue=20in=20CustomComponen?= =?UTF-8?q?t=20class?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../langflow/interface/custom/custom_component.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/backend/langflow/interface/custom/custom_component.py b/src/backend/langflow/interface/custom/custom_component.py index d71aa729c..bb3bafb08 100644 --- a/src/backend/langflow/interface/custom/custom_component.py +++ b/src/backend/langflow/interface/custom/custom_component.py @@ -158,5 +158,15 @@ class CustomComponent(Component, extra=Extra.allow): flows = session.query(Flow).all() return flows + def get_flow(self, flow_name: str) -> Flow: + with session_getter() as session: + flow = session.query(Flow).filter(Flow.name == flow_name).first() + return flow + + def get_flow_by_id(self, flow_id: str) -> Flow: + with session_getter() as session: + flow = session.query(Flow).filter(Flow.id == flow_id).first() + return flow + def build(self): raise NotImplementedError