From ecf217dce8f22514de824065765b52bbffa8eb03 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Tue, 22 Aug 2023 11:37:51 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(chat.py):=20remove=20unneces?= =?UTF-8?q?sary=20try-except=20block=20for=20building=20the=20graph=20and?= =?UTF-8?q?=20handle=20any=20exceptions=20thrown=20by=20Graph.from=5Fpaylo?= =?UTF-8?q?ad()=20method=20=F0=9F=94=A7=20refactor(chat.py):=20improve=20l?= =?UTF-8?q?ogging=20output=20for=20built=20node=20parameters=20in=20stream?= =?UTF-8?q?=5Fbuild()=20method?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/api/v1/chat.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/backend/langflow/api/v1/chat.py b/src/backend/langflow/api/v1/chat.py index 06a2fdda0..e71ddf81f 100644 --- a/src/backend/langflow/api/v1/chat.py +++ b/src/backend/langflow/api/v1/chat.py @@ -104,14 +104,9 @@ async def stream_build(flow_id: str): return logger.debug("Building langchain object") - try: - # Some error could happen when building the graph - graph = Graph.from_payload(graph_data) - except Exception as exc: - logger.exception(exc) - error_message = str(exc) - yield str(StreamData(event="error", data={"error": error_message})) - return + + # Some error could happen when building the graph + graph = Graph.from_payload(graph_data) number_of_nodes = len(graph.nodes) flow_data_store[flow_id]["status"] = BuildStatus.IN_PROGRESS @@ -126,7 +121,9 @@ async def stream_build(flow_id: str): params = vertex._built_object_repr() valid = True logger.debug(f"Building node {str(vertex.vertex_type)}") - logger.debug(f"Output: {params}") + logger.debug( + f"Output: {params[:100]}{'...' if len(params) > 100 else ''}" + ) if vertex.artifacts: # The artifacts will be prompt variables # passed to build_input_keys_response