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

@@ -619,6 +619,28 @@ class AppService:
self._validate_app_accessible(app, workspace_id)
return app
def get_release_by_version(self, app_id: uuid.UUID, version: int) -> AppRelease:
"""按版本号获取发布快照
Args:
app_id: 应用ID
version: 版本号(整数,按应用内递增)
Returns:
AppRelease: 发布快照
Raises:
BusinessException: 版本不存在或已下线
"""
from app.repositories.app_repository import get_release_by_version
release = get_release_by_version(self.db, app_id, version)
if not release:
raise BusinessException(
f"版本 {version} 不存在或已下线",
BizCode.RELEASE_NOT_FOUND,
)
return release
def create_app(
self,
*,