Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

feat: only stream last chunk if client is connected (#4015)

cthomas761a5ca677e4
diff --git a/letta/server/rest_api/streaming_response.py b/letta/server/rest_api/streaming_response.py
index 4cfe9819a..361facffa 100644
--- a/letta/server/rest_api/streaming_response.py
+++ b/letta/server/rest_api/streaming_response.py
@@ -332,5 +332,5 @@ class StreamingResponseWithStatusCode(StreamingResponse):
)
capture_sentry_exception(exc)
return
- if more_body:
+ if more_body and self._client_connected:
await send({"type": "http.response.body", "body": b"", "more_body": False})