From 58769f587f72b8354aad32037a44f786b419e494 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 22 Feb 2024 18:28:27 -0300 Subject: [PATCH] Rename stop_vertex to component --- src/backend/langflow/api/v1/chat.py | 6 +++--- src/backend/langflow/graph/graph/base.py | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/backend/langflow/api/v1/chat.py b/src/backend/langflow/api/v1/chat.py index bd2068d56..fd59f0126 100644 --- a/src/backend/langflow/api/v1/chat.py +++ b/src/backend/langflow/api/v1/chat.py @@ -85,7 +85,7 @@ async def try_running_celery_task(vertex, user_id): @router.get("/build/{flow_id}/vertices", response_model=VerticesOrderResponse) async def get_vertices( flow_id: str, - stop_vertex_id: Optional[str] = None, + stop_component_id: Optional[str] = None, chat_service: "ChatService" = Depends(get_chat_service), session=Depends(get_session), ): @@ -96,9 +96,9 @@ async def get_vertices( if cache := chat_service.get_cache(flow_id): graph: Graph = cache.get("result") graph = build_and_cache_graph(flow_id, session, chat_service, graph) - if stop_vertex_id: + if stop_component_id: try: - vertices = graph.sort_vertices(stop_vertex_id) + vertices = graph.sort_vertices(stop_component_id) except Exception as exc: logger.error(exc) vertices = graph.sort_vertices() diff --git a/src/backend/langflow/graph/graph/base.py b/src/backend/langflow/graph/graph/base.py index ba625bba3..4078bac89 100644 --- a/src/backend/langflow/graph/graph/base.py +++ b/src/backend/langflow/graph/graph/base.py @@ -520,11 +520,11 @@ class Graph: return vertices_layers - def sort_vertices(self, stop_vertex_id: Optional[str] = None) -> List[List[str]]: + def sort_vertices(self, stop_component_id: Optional[str] = None) -> List[List[str]]: """Sorts the vertices in the graph.""" - if stop_vertex_id: - self.stop_vertex = stop_vertex_id - vertices = self.sort_up_to_vertex(stop_vertex_id) + if stop_component_id: + self.stop_vertex = stop_component_id + vertices = self.sort_up_to_vertex(stop_component_id) else: vertices = self.vertices vertices_layers = self.layered_topological_sort(vertices)