chore: Update chat.py to set cache before closing stream

The code changes in `chat.py` update the `build_vertex_stream` function to set the cache using `chat_service.set_cache` before closing the stream. This ensures that the cache is updated with the latest data before the stream is closed. The commit message follows the established convention of using a prefix to indicate the type of change.
This commit is contained in:
ogabrielluiz 2024-06-18 20:48:08 -03:00
commit 22e3c86df7

View file

@ -341,6 +341,7 @@ async def build_vertex_stream(
yield str(StreamData(event="error", data={"error": exc_message}))
finally:
logger.debug("Closing stream")
await chat_service.set_cache(flow_id_str, graph)
yield str(StreamData(event="close", data={"message": "Stream closed"}))
return StreamingResponse(stream_vertex(), media_type="text/event-stream")