mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-01-29 22:56:36 +08:00
### What problem does this PR solve? Fix: key error "content" #12844 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --------- Co-authored-by: Kevin Hu <kevinhu.sh@gmail.com>
This commit is contained in:
@ -62,8 +62,12 @@ class Session(Base):
|
||||
except json.JSONDecodeError:
|
||||
continue # Skip lines that are not valid JSON
|
||||
|
||||
event = json_data.get("event",None)
|
||||
if event and event != "message":
|
||||
continue
|
||||
|
||||
if (
|
||||
(self.__session_type == "agent" and json_data.get("event") == "message_end")
|
||||
(self.__session_type == "agent" and event == "message_end")
|
||||
or (self.__session_type == "chat" and json_data.get("data") is True)
|
||||
):
|
||||
return
|
||||
@ -82,7 +86,7 @@ class Session(Base):
|
||||
def _structure_answer(self, json_data):
|
||||
answer = ""
|
||||
if self.__session_type == "agent":
|
||||
answer = json_data["data"]["content"]
|
||||
answer = json_data["data"]["content"]
|
||||
elif self.__session_type == "chat":
|
||||
answer = json_data["answer"]
|
||||
reference = json_data.get("reference", {})
|
||||
|
||||
Reference in New Issue
Block a user