Fix everything, add tg-get-document-content

This commit is contained in:
Cyber MacGeddon 2026-03-09 13:32:00 +00:00
parent e02b834b22
commit 1e9e3d0cd5
5 changed files with 98 additions and 11 deletions

View file

@ -173,14 +173,5 @@ class LibraryResponseTranslator(MessageTranslator):
return result
def from_response_with_completion(self, obj: LibrarianResponse) -> Tuple[Dict[str, Any], bool]:
"""Returns (response_dict, is_final)
For chunked streaming responses (total_chunks > 0), completion is
determined by whether we've reached the final chunk.
For non-streaming responses (total_chunks = 0), always final.
"""
if obj.total_chunks > 0:
is_final = (obj.chunk_index >= obj.total_chunks - 1)
else:
is_final = True
return self.from_pulsar(obj), is_final
"""Returns (response_dict, is_final)"""
return self.from_pulsar(obj), obj.is_final

View file

@ -212,6 +212,11 @@ class LibrarianResponse:
# list-uploads response
upload_sessions: list[UploadSession] = field(default_factory=list)
# Protocol flag: True if this is the final response for a request.
# Default True since most operations are single request/response.
# Only stream-document sets False for intermediate chunks.
is_final: bool = True
# FIXME: Is this right? Using persistence on librarian so that
# message chunking works