Refactor: Simplify Vertex Queue Initialization by Removing is_input_vertex Dependency (#6155)

* 📝 (vertex_types.py): improve default value assignment logic based on edge type for ComponentVertex class

* [autofix.ci] apply automated fixes

* 📝 (schema.py): remove TextInput from INPUT_COMPONENTS list as it is no longer used
♻️ (vertex_types.py): refactor default_value assignment logic for ComponentVertex class to improve readability and maintainability

*  (schema.py): introduce new TextInput component to the list of INPUT_COMPONENTS for the graph schema

* 📝 (vertex_types.py): improve default value assignment logic based on edge type for ComponentVertex class

* [autofix.ci] apply automated fixes

* 🐛 (utils.py): fix layered topological sort to prevent TextInput from being incorrectly placed at the start

* ♻️ (vertex_types.py): Remove unnecessary comment about getting default value based on edge type to improve code readability and maintainability.

* 🐛 (vertex_types.py): simplify default value assignment logic for cycle edges

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
This commit is contained in:
Cristhian Zanforlin Lousa 2025-02-06 16:08:41 -03:00 committed by GitHub
commit fdad49764a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -457,7 +457,7 @@ def layered_topological_sort(
predecessor_map: dict[str, list[str]],
start_id: str | None = None,
cycle_vertices: set[str] | None = None,
is_input_vertex: Callable[[str], bool] | None = None,
is_input_vertex: Callable[[str], bool] | None = None, # noqa: ARG001
*,
is_cyclic: bool = False,
) -> list[list[str]]:
@ -503,7 +503,9 @@ def layered_topological_sort(
queue = deque(
vertex_id
for vertex_id in vertices_ids
if in_degree_map[vertex_id] == 0 or (is_input_vertex and is_input_vertex(vertex_id))
if in_degree_map[vertex_id] == 0
# We checked if it is input but that caused the TextInput to be at the start
# or (is_input_vertex and is_input_vertex(vertex_id))
)
layers: list[list[str]] = []