Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: app_count of dataset is error when apps was deleted (#4810)

DomKing38a470a87337
diff --git a/api/models/dataset.py b/api/models/dataset.py
index ba791e6d231..7f98bbde153 100644
--- a/api/models/dataset.py
+++ b/api/models/dataset.py
@@ -76,7 +76,8 @@ class Dataset(db.Model):
@property
def app_count(self):
- return db.session.query(func.count(AppDatasetJoin.id)).filter(AppDatasetJoin.dataset_id == self.id).scalar()
+ return db.session.query(func.count(AppDatasetJoin.id)).filter(AppDatasetJoin.dataset_id == self.id,
+ App.id == AppDatasetJoin.app_id).scalar()
@property
def document_count(self):