mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-03-10 15:50:02 +00:00
Add ingest_existing_file() to services/ingest.py as a public wrapper for registering on-disk files (stat, BLAKE3 hash, MIME detection, path-based tag derivation). After each prompt execution in the main loop, iterate history_result['outputs'] and register files with type 'output' as assets. Runs while the asset seeder is paused, gated behind asset_seeder.is_disabled(). Stores prompt_id in user_metadata for provenance tracking. Ingest uses a two-phase approach: insert a stub record (hash=NULL) first for instant visibility, then defer hashing to the background seeder enrich phase to avoid blocking the prompt worker thread. When multiple enrich scans are enqueued while the seeder is busy, roots are now unioned and compute_hashes uses sticky-true (OR) logic so no queued work is silently dropped. Extract _reset_to_idle helper in the asset seeder to deduplicate the state reset pattern shared by _run_scan and mark_missing_outside_prefixes. Separate history parsing from output file registration: move generic file registration logic into register_output_files() in app/assets/services/ingest.py, keeping only the ComfyUI history format parsing (_collect_output_absolute_paths) in main.py.
92 lines
2.1 KiB
Python
92 lines
2.1 KiB
Python
from app.assets.services.asset_management import (
|
|
asset_exists,
|
|
delete_asset_reference,
|
|
get_asset_by_hash,
|
|
get_asset_detail,
|
|
list_assets_page,
|
|
resolve_asset_for_download,
|
|
set_asset_preview,
|
|
update_asset_metadata,
|
|
)
|
|
from app.assets.services.bulk_ingest import (
|
|
BulkInsertResult,
|
|
batch_insert_seed_assets,
|
|
cleanup_unreferenced_assets,
|
|
)
|
|
from app.assets.services.file_utils import (
|
|
get_mtime_ns,
|
|
get_size_and_mtime_ns,
|
|
list_files_recursively,
|
|
verify_file_unchanged,
|
|
)
|
|
from app.assets.services.ingest import (
|
|
DependencyMissingError,
|
|
HashMismatchError,
|
|
create_from_hash,
|
|
ingest_existing_file,
|
|
register_output_files,
|
|
upload_from_temp_path,
|
|
)
|
|
from app.assets.database.queries import (
|
|
AddTagsResult,
|
|
RemoveTagsResult,
|
|
)
|
|
from app.assets.services.schemas import (
|
|
AssetData,
|
|
AssetDetailResult,
|
|
AssetSummaryData,
|
|
DownloadResolutionResult,
|
|
IngestResult,
|
|
ListAssetsResult,
|
|
ReferenceData,
|
|
RegisterAssetResult,
|
|
TagUsage,
|
|
UploadResult,
|
|
UserMetadata,
|
|
)
|
|
from app.assets.services.tagging import (
|
|
apply_tags,
|
|
list_tags,
|
|
remove_tags,
|
|
)
|
|
|
|
__all__ = [
|
|
"AddTagsResult",
|
|
"AssetData",
|
|
"AssetDetailResult",
|
|
"AssetSummaryData",
|
|
"ReferenceData",
|
|
"BulkInsertResult",
|
|
"DependencyMissingError",
|
|
"DownloadResolutionResult",
|
|
"HashMismatchError",
|
|
"IngestResult",
|
|
"ListAssetsResult",
|
|
"RegisterAssetResult",
|
|
"RemoveTagsResult",
|
|
"TagUsage",
|
|
"UploadResult",
|
|
"UserMetadata",
|
|
"apply_tags",
|
|
"asset_exists",
|
|
"batch_insert_seed_assets",
|
|
"create_from_hash",
|
|
"delete_asset_reference",
|
|
"get_asset_by_hash",
|
|
"get_asset_detail",
|
|
"ingest_existing_file",
|
|
"register_output_files",
|
|
"get_mtime_ns",
|
|
"get_size_and_mtime_ns",
|
|
"list_assets_page",
|
|
"list_files_recursively",
|
|
"list_tags",
|
|
"cleanup_unreferenced_assets",
|
|
"remove_tags",
|
|
"resolve_asset_for_download",
|
|
"set_asset_preview",
|
|
"update_asset_metadata",
|
|
"upload_from_temp_path",
|
|
"verify_file_unchanged",
|
|
]
|