Fix gateway translators dropping responses

This commit is contained in:
Cyber MacGeddon 2026-01-06 16:01:39 +00:00
parent 00292940c4
commit 9df4f59b2c
2 changed files with 13 additions and 8 deletions

View file

@ -42,12 +42,17 @@ class PromptResponseTranslator(MessageTranslator):
def from_pulsar(self, obj: PromptResponse) -> Dict[str, Any]:
result = {}
if obj.text:
# Include text field if present (even if empty string)
if obj.text is not None:
result["text"] = obj.text
if obj.object:
# Include object field if present
if obj.object is not None:
result["object"] = obj.object
# Always include end_of_stream flag for streaming support
result["end_of_stream"] = getattr(obj, "end_of_stream", False)
return result
def from_response_with_completion(self, obj: PromptResponse) -> Tuple[Dict[str, Any], bool]:

View file

@ -34,8 +34,8 @@ class DocumentRagResponseTranslator(MessageTranslator):
def from_pulsar(self, obj: DocumentRagResponse) -> Dict[str, Any]:
result = {}
# Include response content (chunk or complete)
if obj.response:
# Include response content (even if empty string)
if obj.response is not None:
result["response"] = obj.response
# Include end_of_stream flag
@ -90,8 +90,8 @@ class GraphRagResponseTranslator(MessageTranslator):
def from_pulsar(self, obj: GraphRagResponse) -> Dict[str, Any]:
result = {}
# Include response content (chunk or complete)
if obj.response:
# Include response content (even if empty string)
if obj.response is not None:
result["response"] = obj.response
# Include end_of_stream flag