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:
parent
decb741e13
commit
22e3c86df7
1 changed files with 1 additions and 0 deletions
|
|
@ -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")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue