🐛 fix(chat.py): add exception logging to stream_build function to improve error handling

The `stream_build` function now logs the exception that occurred during the flow building process using the `logger.exception` method. This improves error handling and provides more detailed information about the error in the logs.
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-06-29 22:07:23 -03:00
commit 9a69a71ea1

View file

@ -139,6 +139,7 @@ async def stream_build(flow_id: str):
# We need to reset the chat history
chat_manager.chat_history.empty_history(flow_id)
except Exception as exc:
logger.exception(exc)
logger.error("Error while building the flow: %s", exc)
yield str(StreamData(event="error", data={"error": str(exc)}))
finally: