From 71c5d836477c278dffd4f043c2b4d10f9c26310c Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 22 Feb 2024 10:40:39 -0300 Subject: [PATCH] Fix exception handling in build_vertex function --- src/backend/langflow/api/v1/chat.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/backend/langflow/api/v1/chat.py b/src/backend/langflow/api/v1/chat.py index ada9a4fa7..81d132aa4 100644 --- a/src/backend/langflow/api/v1/chat.py +++ b/src/backend/langflow/api/v1/chat.py @@ -10,6 +10,9 @@ from fastapi import ( WebSocketException, status, ) +from loguru import logger +from sqlmodel import Session + from langflow.api.utils import build_and_cache_graph, format_elapsed_time from langflow.api.v1.schemas import ( ResultData, @@ -24,8 +27,6 @@ from langflow.services.auth.utils import ( from langflow.services.chat.service import ChatService from langflow.services.deps import get_chat_service, get_session from langflow.services.monitor.utils import log_vertex_build -from loguru import logger -from sqlmodel import Session router = APIRouter(tags=["Chat"]) @@ -172,7 +173,7 @@ async def build_vertex( raise ValueError(f"No result found for vertex {vertex_id}") chat_service.set_cache(flow_id, graph) except Exception as exc: - params = repr(exc) + params = str(exc) valid = False result_dict = ResultData(results={}) artifacts = {}