mirror of
https://github.com/langgenius/dify.git
synced 2026-03-26 08:40:14 +08:00
Merge AssetDownloadItem, AssetInlineItem into SandboxDownloadItem with optional 'content' field. All consumers now follow a clean pipeline: get items → accessor.resolve_items() → AppAssetService.to_download_items() → download Key changes: - SandboxDownloadItem gains content: bytes | None (entities.py) - ZipSandbox.download_items() handles both inline (base64 heredoc) and remote (curl) via a single pipeline — no structural branching - AssetDownloadService.build_download_script() takes unified list - CachedContentAccessor.resolve_items() batch-enriches items from DB (extension-agnostic, no 'if md' checks needed) - AppAssetService.to_download_items() converts AssetItem → SandboxDownloadItem - DraftAppAssetsInitializer, package_and_upload, export_bundle simplified - file_upload/node.py switched to SandboxDownloadItem - Deleted AssetDownloadItem and AssetInlineItem classes
21 lines
587 B
Python
21 lines
587 B
Python
from dataclasses import dataclass, field
|
|
|
|
|
|
@dataclass
|
|
class AssetItem:
|
|
"""A single asset file produced by the build pipeline.
|
|
|
|
When *content* is set the payload is available in-process and can be
|
|
written directly into a ZIP or uploaded to a sandbox VM without an
|
|
extra S3 round-trip. When *content* is ``None`` the caller should
|
|
fetch the bytes from *storage_key* (the traditional presigned-URL
|
|
path).
|
|
"""
|
|
|
|
asset_id: str
|
|
path: str
|
|
file_name: str
|
|
extension: str
|
|
storage_key: str
|
|
content: bytes | None = field(default=None, repr=False)
|