Add result attribute to Vertex class

This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-02-20 13:12:49 -03:00
commit aadb4c7d87

View file

@ -14,6 +14,7 @@ from langflow.utils.util import sync_to_async
from loguru import logger from loguru import logger
if TYPE_CHECKING: if TYPE_CHECKING:
from langflow.api.v1.schemas import ResultDict
from langflow.graph.edge.base import ContractEdge from langflow.graph.edge.base import ContractEdge
from langflow.graph.graph.base import Graph from langflow.graph.graph.base import Graph
@ -49,6 +50,7 @@ class Vertex:
self.parent_is_top_level = False self.parent_is_top_level = False
self.layer = None self.layer = None
self.should_run = True self.should_run = True
self.result: Optional["ResultDict"] = None
try: try:
self.is_interface_component = InterfaceComponentTypes(self.vertex_type) self.is_interface_component = InterfaceComponentTypes(self.vertex_type)
except ValueError: except ValueError:
@ -79,6 +81,9 @@ class Vertex:
) )
return edge_results return edge_results
def set_result(self, result: "ResultDict") -> None:
self.result = result
def get_built_result(self): def get_built_result(self):
# If the Vertex.type is a power component # If the Vertex.type is a power component
# then we need to return the built object # then we need to return the built object