From f1e2bbb69c26a3f563a01b597c1535e0db20dcad Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 29 Jun 2023 10:54:27 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(chat.py):=20change=20BuildSt?= =?UTF-8?q?atus.IN=5FPROGRESS=20to=20BuildStatus.STARTED=20for=20better=20?= =?UTF-8?q?clarity=20=F0=9F=90=9B=20fix(chat.py):=20fix=20incorrect=20key?= =?UTF-8?q?=20used=20to=20retrieve=20graph=5Fdata=20from=20flow=5Fdata=5Fs?= =?UTF-8?q?tore=20The=20BuildStatus.IN=5FPROGRESS=20constant=20is=20change?= =?UTF-8?q?d=20to=20BuildStatus.STARTED=20to=20provide=20a=20more=20accura?= =?UTF-8?q?te=20representation=20of=20the=20flow=20status.=20Additionally,?= =?UTF-8?q?=20the=20incorrect=20key=20"data"=20is=20replaced=20with=20"gra?= =?UTF-8?q?ph=5Fdata"=20when=20retrieving=20the=20graph=20data=20from=20th?= =?UTF-8?q?e=20flow=5Fdata=5Fstore=20dictionary.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/api/v1/chat.py | 5 +++-- src/backend/langflow/api/v1/schemas.py | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/backend/langflow/api/v1/chat.py b/src/backend/langflow/api/v1/chat.py index fd0232189..25be65dbb 100644 --- a/src/backend/langflow/api/v1/chat.py +++ b/src/backend/langflow/api/v1/chat.py @@ -47,7 +47,7 @@ async def init_build(graph_data: dict, flow_id: str): logger.debug(f"Deleted flow {flow_id} from cache") flow_data_store[flow_id] = { "graph_data": graph_data, - "status": BuildStatus.IN_PROGRESS, + "status": BuildStatus.STARTED, } return InitResponse(flowId=flow_id) @@ -91,7 +91,7 @@ async def stream_build(flow_id: str): yield str(StreamData(event="error", data={"error": error_message})) return - graph_data = flow_data_store[flow_id].get("data") + graph_data = flow_data_store[flow_id].get("graph_data") if not graph_data: error_message = "No data provided" @@ -109,6 +109,7 @@ async def stream_build(flow_id: str): return number_of_nodes = len(graph.nodes) + flow_data_store[flow_id]["status"] = BuildStatus.IN_PROGRESS for i, vertex in enumerate(graph.generator_build(), 1): try: log_dict = { diff --git a/src/backend/langflow/api/v1/schemas.py b/src/backend/langflow/api/v1/schemas.py index 2cf62a504..f5f1f9ccf 100644 --- a/src/backend/langflow/api/v1/schemas.py +++ b/src/backend/langflow/api/v1/schemas.py @@ -11,6 +11,7 @@ class BuildStatus(Enum): SUCCESS = "success" FAILURE = "failure" + STARTED = "started" IN_PROGRESS = "in_progress"