🐛 fix(chat.py): yield error message when an exception occurs during stream_build
🔧 chore(base.py): fix typo in docstring
The fix in chat.py ensures that an error message is yielded when an exception occurs during stream_build. This helps to provide more information to the client-side when an error occurs. The typo in base.py's docstring is fixed to improve readability.
This commit is contained in:
parent
ef5623e1b3
commit
a23121aa54
2 changed files with 5 additions and 3 deletions
|
|
@ -107,8 +107,9 @@ async def stream_build(flow_id: str):
|
|||
yield f"data: {response}\n\n"
|
||||
|
||||
chat_manager.set_cache(flow_id, graph.build())
|
||||
except Exception:
|
||||
logger.error("Error while building the flow")
|
||||
except Exception as exc:
|
||||
logger.error("Error while building the flow: %s", exc)
|
||||
yield f"data: {json.dumps({'error': str(exc)})}\n\n"
|
||||
finally:
|
||||
yield f"data: {final_response}\n\n"
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ from langflow.graph.vertex.types import (
|
|||
)
|
||||
from langflow.interface.tools.constants import FILE_TOOLS
|
||||
from langflow.utils import payload
|
||||
from langflow.utils.logger import logger
|
||||
|
||||
|
||||
class Graph:
|
||||
|
|
@ -30,7 +31,7 @@ class Graph:
|
|||
Creates a graph from a payload.
|
||||
|
||||
Args:
|
||||
payload (Dict): The payload to create the graph from.
|
||||
payload (Dict): The payload to create the graph from.˜`
|
||||
|
||||
Returns:
|
||||
Graph: The created graph.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue