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.

refactor(models): remove four unread legacy db.session wrappers (#41964)

Eddy ZHANG9e0763e1894b
diff --git a/api/models/model.py b/api/models/model.py
index a9e0acd1f40..dbdb0a00859 100644
--- a/api/models/model.py
+++ b/api/models/model.py
@@ -467,10 +467,6 @@ class App(Base):
else:
return ""
- @property
- def site(self) -> Site | None:
- return self.site_with_session(session=db.session())
-
def site_with_session(self, *, session: Session) -> Site | None:
return session.scalar(select(Site).where(Site.app_id == self.id))
@@ -693,10 +689,6 @@ class App(Base):
return deleted_tools
- @property
- def tags(self) -> Sequence[Tag]:
- return self.tags_with_session(session=db.session())
-
def tags_with_session(self, *, session: Session) -> Sequence[Tag]:
tags = session.scalars(
select(Tag)
@@ -794,10 +786,6 @@ class AppModelConfig(TypeBase):
external_data_tools: Mapped[str | None] = mapped_column(LongText, default=None)
file_upload: Mapped[str | None] = mapped_column(LongText, default=None)
- @property
- def app(self) -> App | None:
- return self.app_with_session(session=db.session())
-
def app_with_session(self, *, session: Session) -> App | None:
return session.scalar(select(App).where(App.id == self.app_id))
@@ -1060,10 +1048,6 @@ class TrialApp(TypeBase):
)
trial_limit: Mapped[int] = mapped_column(sa.Integer, nullable=False, default=3)
- @property
- def app(self) -> App | None:
- return self.app_with_session(session=db.session())
-
def app_with_session(self, *, session: Session) -> App | None:
return session.scalar(select(App).where(App.id == self.app_id))