From 902703d1457ab0927a6f4ac85e2b6f8bf598e55d Mon Sep 17 00:00:00 2001 From: He Wang Date: Fri, 19 Sep 2025 19:12:18 +0800 Subject: [PATCH] Fix: skip tag query if tag kbs are invalid (#10168) ### What problem does this PR solve? Skip `tag_query` step if `tag_kbs` are empty. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- rag/app/tag.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rag/app/tag.py b/rag/app/tag.py index 179d72e24..de2ce0fa6 100644 --- a/rag/app/tag.py +++ b/rag/app/tag.py @@ -138,6 +138,8 @@ def label_question(question, kbs): else: all_tags = json.loads(all_tags) tag_kbs = KnowledgebaseService.get_by_ids(tag_kb_ids) + if not tag_kbs: + return tags tags = settings.retrievaler.tag_query(question, list(set([kb.tenant_id for kb in tag_kbs])), tag_kb_ids,