feat(api): Support specifying app version for chat

This commit is contained in:
wxy
2026-04-10 12:10:24 +08:00
parent 412183c359
commit c253968aa8
3 changed files with 50 additions and 36 deletions

View File

@@ -61,3 +61,15 @@ def get_apps_by_id(db: Session, app_id: uuid.UUID) -> App:
"""根据工作空间ID查询应用"""
repo = AppRepository(db)
return repo.get_apps_by_id(app_id)
def get_release_by_version(db: Session, app_id: uuid.UUID, version: int):
"""根据版本号查询发布快照(仅返回激活状态)"""
from app.models.app_release_model import AppRelease
return db.scalars(
select(AppRelease).where(
AppRelease.app_id == app_id,
AppRelease.version == version,
AppRelease.is_active.is_(True),
)
).first()