From e27473886131aae2ad414c84a554656ddf92c1a7 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 27 Mar 2024 16:06:21 -0300 Subject: [PATCH] Return additional vertices to run --- src/backend/base/langflow/api/v1/chat.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/backend/base/langflow/api/v1/chat.py b/src/backend/base/langflow/api/v1/chat.py index 613a2fc51..46ad91c59 100644 --- a/src/backend/base/langflow/api/v1/chat.py +++ b/src/backend/base/langflow/api/v1/chat.py @@ -7,7 +7,12 @@ from fastapi import APIRouter, BackgroundTasks, Body, Depends, HTTPException from fastapi.responses import StreamingResponse from loguru import logger -from langflow.api.utils import build_and_cache_graph, format_elapsed_time, format_exception_message +from langflow.api.utils import ( + build_and_cache_graph, + format_elapsed_time, + format_exception_message, + get_top_level_vertices, +) from langflow.api.v1.schemas import ( InputValueRequest, ResultDataResponse, @@ -93,7 +98,8 @@ async def get_vertices( # and return the same structure but only with the ids run_id = uuid.uuid4() graph.set_run_id(run_id) - return VerticesOrderResponse(ids=first_layer, run_id=run_id, vertices_to_run=list(graph.vertices_to_run)) + vertices_to_run = list(graph.vertices_to_run) + get_top_level_vertices(graph, graph.vertices_to_run) + return VerticesOrderResponse(ids=first_layer, run_id=run_id, vertices_to_run=vertices_to_run) except Exception as exc: logger.error(f"Error checking build status: {exc}")