Refactor power component to interface component
This commit is contained in:
parent
652de333db
commit
1934a77ffa
2 changed files with 6 additions and 5 deletions
|
|
@ -17,7 +17,7 @@ if TYPE_CHECKING:
|
||||||
from langflow.graph.graph.base import Graph
|
from langflow.graph.graph.base import Graph
|
||||||
|
|
||||||
|
|
||||||
class PowerComponentTypes(Enum):
|
class InterfaceComponentTypes(Enum):
|
||||||
# ChatInput and ChatOutput are the only ones that are
|
# ChatInput and ChatOutput are the only ones that are
|
||||||
# power components
|
# power components
|
||||||
ChatInput = "ChatInput"
|
ChatInput = "ChatInput"
|
||||||
|
|
@ -55,9 +55,9 @@ class Vertex:
|
||||||
self.parent_is_top_level = False
|
self.parent_is_top_level = False
|
||||||
self.layer = None
|
self.layer = None
|
||||||
try:
|
try:
|
||||||
self.is_power_component = PowerComponentTypes(self.vertex_type)
|
self.is_interface_component = InterfaceComponentTypes(self.vertex_type)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
self.is_power_component = False
|
self.is_interface_component = False
|
||||||
|
|
||||||
# Build a result dict for each edge
|
# Build a result dict for each edge
|
||||||
# like so: {edge.target.id: {edge.target_param: self._built_object}}
|
# like so: {edge.target.id: {edge.target_param: self._built_object}}
|
||||||
|
|
@ -84,7 +84,7 @@ class Vertex:
|
||||||
# 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
|
||||||
# instead of the result dict
|
# instead of the result dict
|
||||||
if self.is_power_component and not isinstance(self._built_object, UnbuiltObject):
|
if self.is_interface_component and not isinstance(self._built_object, UnbuiltObject):
|
||||||
result = self._built_object
|
result = self._built_object
|
||||||
# if it is not a dict or a string and hasattr model_dump then
|
# if it is not a dict or a string and hasattr model_dump then
|
||||||
# return the model_dump
|
# return the model_dump
|
||||||
|
|
@ -508,3 +508,4 @@ class StatefulVertex(Vertex):
|
||||||
class StatelessVertex(Vertex):
|
class StatelessVertex(Vertex):
|
||||||
pass
|
pass
|
||||||
pass
|
pass
|
||||||
|
pass
|
||||||
|
|
|
||||||
|
|
@ -320,7 +320,7 @@ class ChatVertex(StatelessVertex):
|
||||||
return self.artifacts["repr"] or super()._built_object_repr()
|
return self.artifacts["repr"] or super()._built_object_repr()
|
||||||
|
|
||||||
async def _run(self, *args, **kwargs):
|
async def _run(self, *args, **kwargs):
|
||||||
if self.is_power_component:
|
if self.is_interface_component:
|
||||||
if self.vertex_type == "ChatOutput":
|
if self.vertex_type == "ChatOutput":
|
||||||
artifacts = None
|
artifacts = None
|
||||||
sender = self.params.get("sender", None)
|
sender = self.params.get("sender", None)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue