correct mismatched kb doc number (#826)

### What problem does this PR solve?

#620

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
KevinHuSh
2024-05-17 17:27:39 +08:00
committed by GitHub
parent f6a599461f
commit a1586e0af9
3 changed files with 15 additions and 0 deletions

View File

@ -265,3 +265,9 @@ class DocumentService(CommonService):
except Exception as e:
stat_logger.error("fetch task exception:" + str(e))
@classmethod
@DB.connection_context()
def get_kb_doc_count(cls, kb_id):
return len(cls.model.select(cls.model.id).where(
cls.model.kb_id == kb_id).dicts())