Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

fix: validate chunk type before processing to prevent AttributeError (#9698)

Mckennasora9dd22e141b18
diff --git a/api/apps/sdk/session.py b/api/apps/sdk/session.py
index 8fd26f199d..70d0f708d4 100644
--- a/api/apps/sdk/session.py
+++ b/api/apps/sdk/session.py
@@ -562,6 +562,9 @@ def list_agent_session(tenant_id, agent_id):
"chunks" in conv["reference"][chunk_num]):
chunks = conv["reference"][chunk_num]["chunks"]
for chunk in chunks:
+ # Ensure chunk is a dictionary before calling get method
+ if not isinstance(chunk, dict):
+ continue
new_chunk = {
"id": chunk.get("chunk_id", chunk.get("id")),
"content": chunk.get("content_with_weight", chunk.get("content")),