From e559cebcdcacd0fed7a40246d9c9570898c91e58 Mon Sep 17 00:00:00 2001 From: Kevin Hu Date: Wed, 20 Nov 2024 11:19:36 +0800 Subject: [PATCH] fix: keyerror issue (#3512) ### What problem does this PR solve? #3511 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- api/apps/sdk/session.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/apps/sdk/session.py b/api/apps/sdk/session.py index e6380607b1..42cc14d2f8 100644 --- a/api/apps/sdk/session.py +++ b/api/apps/sdk/session.py @@ -165,11 +165,11 @@ def fillin_conv(ans): "document_id": chunk["doc_id"], "document_name": chunk["docnm_kwd"], "dataset_id": chunk["kb_id"], - "image_id": chunk["img_id"], + "image_id": chunk.get("img_id", ""), "similarity": chunk["similarity"], "vector_similarity": chunk["vector_similarity"], "term_similarity": chunk["term_similarity"], - "positions": chunk["positions"], + "positions": chunk.get("positions", []), } chunk_list.append(new_chunk) reference["chunks"] = chunk_list