Enhance agent workflows and tools: unify subscription and download processes, add site querying functionality, and improve error handling in download operations.

This commit is contained in:
jxxghp
2025-11-17 11:39:08 +08:00
parent a5e7483870
commit 043be409d0
9 changed files with 220 additions and 44 deletions

View File

@@ -66,6 +66,12 @@ class Site(Base):
result = await db.execute(select(cls).where(cls.domain == domain))
return result.scalar_one_or_none()
@classmethod
@async_db_query
async def async_get_by_name(cls, db: AsyncSession, name: str):
result = await db.execute(select(cls).where(cls.name == name))
return result.scalar_one_or_none()
@classmethod
@db_query
def get_actives(cls, db: Session):

View File

@@ -85,6 +85,12 @@ class SiteOper(DbOper):
"""
return await Site.async_get_by_domain(self._db, domain)
async def async_get_by_name(self, name: str) -> Site:
"""
异步按名称获取站点
"""
return await Site.async_get_by_name(self._db, name)
def get_domains_by_ids(self, ids: List[int]) -> List[str]:
"""
按ID获取站点域名