[fix]:[FL-216][ATP模型管理: 去掉版本概念,上传文件直接展示]
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
@@ -1512,7 +1512,20 @@ def list_asset_files(db: Session, *, asset_id: str) -> AtpAssetFileListResponse:
|
||||
storage_mount_code, storage_root_path = _resolve_asset_file_location(db, asset, allow_legacy_release_root=True)
|
||||
mount = _resolve_mount(db, storage_mount_code)
|
||||
driver = _build_driver_or_400(mount)
|
||||
tree = _walk_storage_tree(driver, storage_root_path)
|
||||
try:
|
||||
tree = _walk_storage_tree(driver, storage_root_path)
|
||||
except HTTPException as exc:
|
||||
if exc.status_code != status.HTTP_404_NOT_FOUND:
|
||||
raise
|
||||
fallback_release = db.execute(
|
||||
select(AtpAssetRelease)
|
||||
.options(joinedload(AtpAssetRelease.asset))
|
||||
.where(AtpAssetRelease.asset_id == asset.id)
|
||||
.order_by(AtpAssetRelease.is_active.desc(), AtpAssetRelease.release_no.desc(), AtpAssetRelease.id.desc())
|
||||
).scalars().first()
|
||||
if fallback_release:
|
||||
return list_release_files(db, release_id=fallback_release.id)
|
||||
tree = StorageTree(files=[], directories=[], file_paths=set(), dir_paths=set(), max_depth=0)
|
||||
items = [
|
||||
AtpAssetFileEntry(
|
||||
relative_path=_relative_from_root(storage_root_path, item.path),
|
||||
|
||||
@@ -269,7 +269,7 @@ def test_upload_asset_archive_and_list_asset_files(tmp_path) -> None:
|
||||
)
|
||||
|
||||
assert uploaded.success is True
|
||||
assert uploaded.storage_root_path == f"/atp-library/assets/{asset.id}"
|
||||
assert uploaded.storage_root_path == "/atp-assets/ATP-ASSET-DIRECT-UPLOAD"
|
||||
|
||||
files = atp_asset_service.list_asset_files(session, asset_id=asset.id)
|
||||
assert files.asset_id == asset.id
|
||||
@@ -504,7 +504,7 @@ def test_upload_asset_files_extracts_zip_and_removes_asset_root(tmp_path) -> Non
|
||||
assert (asset_root / "nested" / "config.txt").exists()
|
||||
|
||||
files = atp_asset_service.list_asset_files(session, asset_id=asset.id)
|
||||
assert files.release_id == asset.id
|
||||
assert files.release_id is None
|
||||
assert files.storage_root_path == "/atp-assets/ATP-ASSET-FILES"
|
||||
assert any(entry.relative_path == "work.atp" and not entry.is_dir for entry in files.items)
|
||||
assert any(entry.relative_path == "nested/config.txt" and not entry.is_dir for entry in files.items)
|
||||
|
||||
@@ -925,8 +925,6 @@ export type AtpAssetSummary = {
|
||||
active_release_no: number | null;
|
||||
active_release_id: string | null;
|
||||
active_release_tag: string | null;
|
||||
storage_mount_code: string | null;
|
||||
storage_root_path: string | null;
|
||||
release_count: number;
|
||||
run_count: number;
|
||||
last_run_status: AtpAssetRunStatus | null;
|
||||
|
||||
Reference in New Issue
Block a user