From 22e3c86df7d562b591cc27a9672c2831c6bb3d46 Mon Sep 17 00:00:00 2001 From: ogabrielluiz Date: Tue, 18 Jun 2024 20:48:08 -0300 Subject: [PATCH] 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. --- src/backend/base/langflow/api/v1/chat.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/backend/base/langflow/api/v1/chat.py b/src/backend/base/langflow/api/v1/chat.py index 2d7522834..ecaf1cc4a 100644 --- a/src/backend/base/langflow/api/v1/chat.py +++ b/src/backend/base/langflow/api/v1/chat.py @@ -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")