mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-04 19:07:22 +00:00
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)
This commit is contained in:
parent
dd1c8c5779
commit
c7bd0a755c
@ -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"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user