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)
This commit is contained in:
He Wang
2025-09-19 19:12:18 +08:00
committed by GitHub
parent 7ccca2143c
commit 902703d145

View File

@ -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,