in 3-ai-native-e2e-sample/backend/agents/literature.py [0:0]
def on_done(self) -> Generator[Dict[str, Any], None, None]:
"""Handle stream completion."""
logger.info("Literature chat stream completed")
if self.current_run_status == RunStatus.FAILED:
return json.dumps({
"type": "error",
"content": "The conversation ended with an error."
})
return json.dumps({"done": True})