Refactor Vertex class in base.py

This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-03-02 17:38:36 -03:00
commit 9f2d67f3bc

View file

@ -2,26 +2,13 @@ import ast
import inspect
import types
from enum import Enum
from typing import (
TYPE_CHECKING,
Any,
AsyncIterator,
Callable,
Coroutine,
Dict,
Iterator,
List,
Optional,
)
from typing import (TYPE_CHECKING, Any, AsyncIterator, Callable, Coroutine,
Dict, Iterator, List, Optional)
from loguru import logger
from langflow.graph.schema import (
INPUT_COMPONENTS,
OUTPUT_COMPONENTS,
InterfaceComponentTypes,
ResultData,
)
from langflow.graph.schema import (INPUT_COMPONENTS, OUTPUT_COMPONENTS,
InterfaceComponentTypes, ResultData)
from langflow.graph.utils import UnbuiltObject, UnbuiltResult
from langflow.graph.vertex.utils import generate_result
from langflow.interface.initialize import loading
@ -639,6 +626,10 @@ class Vertex:
if self.pinned and self._built:
return self.get_requester_result(requester)
elif self._built and requester is not None:
# This means that the vertex has already been built
# and we are just getting the result for the requester
return await self.get_requester_result(requester)
self._reset()
if self.is_input and inputs is not None: