From c7bd0a755cb75c5838a933fc05d21af6a0c83aad Mon Sep 17 00:00:00 2001 From: Billy Bao Date: Fri, 7 Nov 2025 16:50:58 +0800 Subject: [PATCH] Fix: python api streaming structure (#11105) ### What problem does this PR solve? Fix: python api streaming structure ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- sdk/python/ragflow_sdk/modules/session.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sdk/python/ragflow_sdk/modules/session.py b/sdk/python/ragflow_sdk/modules/session.py index 9a54eb5e4..d9b6193c4 100644 --- a/sdk/python/ragflow_sdk/modules/session.py +++ b/sdk/python/ragflow_sdk/modules/session.py @@ -74,15 +74,15 @@ class Session(Base): json_data = res.json() except ValueError: raise Exception(f"Invalid response {res}") - yield self._structure_answer(json_data) + yield self._structure_answer(json_data["data"]) def _structure_answer(self, json_data): if self.__session_type == "agent": - answer = json_data["data"]["data"]["content"] + answer = json_data["data"]["content"] elif self.__session_type == "chat": - answer =json_data["data"]["answer"] - reference = json_data["data"].get("reference", {}) + answer = json_data["answer"] + reference = json_data.get("reference", {}) temp_dict = { "content": answer, "role": "assistant"