mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-04-29 02:41:27 +00:00
Clean up imports, remove section banners, and fix seed endpoint with autoscan disabled
Move inline/lazy imports to top-level now that blake3 is a main dependency and circular-import concerns are resolved. Remove decorative section-header comments in asset_reference queries. Allow the seed API endpoint to temporarily re-enable the seeder when --disable-assets-autoscan is active so manual triggers still work. Add retry-on-409 logic in test helpers and remove try/finally around prompt execution in favour of sequential pause/resume. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -3,7 +3,7 @@ from sqlalchemy import select
|
||||
from sqlalchemy.dialects import sqlite
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from app.assets.database.models import Asset
|
||||
from app.assets.database.models import Asset, AssetReference
|
||||
from app.assets.database.queries.common import calculate_rows_per_statement, iter_chunks
|
||||
|
||||
|
||||
@@ -130,8 +130,6 @@ def reassign_asset_references(
|
||||
|
||||
Used when merging a stub asset into an existing asset with the same hash.
|
||||
"""
|
||||
from app.assets.database.models import AssetReference
|
||||
|
||||
ref = session.get(AssetReference, reference_id)
|
||||
if ref:
|
||||
ref.asset_id = to_asset_id
|
||||
|
||||
@@ -32,11 +32,6 @@ from app.assets.database.queries.common import (
|
||||
from app.assets.helpers import escape_sql_like_string, get_utc_now, normalize_tags
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# Metadata conversion helpers (from former asset_info.py)
|
||||
# =============================================================================
|
||||
|
||||
|
||||
def _check_is_scalar(v):
|
||||
if v is None:
|
||||
return True
|
||||
@@ -84,11 +79,6 @@ def convert_metadata_to_rows(key: str, value) -> list[dict]:
|
||||
return [{"key": key, "ordinal": 0, "val_json": value}]
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# Filter helpers
|
||||
# =============================================================================
|
||||
|
||||
|
||||
def _apply_tag_filters(
|
||||
stmt: sa.sql.Select,
|
||||
include_tags: Sequence[str] | None = None,
|
||||
@@ -168,11 +158,6 @@ def _apply_metadata_filter(
|
||||
return stmt
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# Basic CRUD operations
|
||||
# =============================================================================
|
||||
|
||||
|
||||
def get_reference_by_id(
|
||||
session: Session,
|
||||
reference_id: str,
|
||||
@@ -302,11 +287,6 @@ def update_reference_timestamps(
|
||||
reference.updated_at = now
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# Listing and pagination
|
||||
# =============================================================================
|
||||
|
||||
|
||||
def list_references_page(
|
||||
session: Session,
|
||||
owner_id: str = "",
|
||||
@@ -440,11 +420,6 @@ def fetch_reference_and_asset(
|
||||
return pair[0], pair[1]
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# Timestamp updates
|
||||
# =============================================================================
|
||||
|
||||
|
||||
def update_reference_access_time(
|
||||
session: Session,
|
||||
reference_id: str,
|
||||
@@ -491,11 +466,6 @@ def update_reference_updated_at(
|
||||
)
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# Metadata operations
|
||||
# =============================================================================
|
||||
|
||||
|
||||
def set_reference_metadata(
|
||||
session: Session,
|
||||
reference_id: str,
|
||||
@@ -538,11 +508,6 @@ def set_reference_metadata(
|
||||
session.flush()
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# Delete operations
|
||||
# =============================================================================
|
||||
|
||||
|
||||
def delete_reference_by_id(
|
||||
session: Session,
|
||||
reference_id: str,
|
||||
@@ -576,11 +541,6 @@ def set_reference_preview(
|
||||
session.flush()
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# Cache state operations (from former cache_state.py)
|
||||
# =============================================================================
|
||||
|
||||
|
||||
class CacheStateRow(NamedTuple):
|
||||
"""Row from reference query with cache state data."""
|
||||
|
||||
@@ -867,11 +827,6 @@ def delete_orphaned_seed_asset(session: Session, asset_id: str) -> bool:
|
||||
return False
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# Enrichment operations
|
||||
# =============================================================================
|
||||
|
||||
|
||||
class UnenrichedReferenceRow(NamedTuple):
|
||||
"""Row for references needing enrichment."""
|
||||
|
||||
@@ -968,11 +923,6 @@ def bulk_update_enrichment_level(
|
||||
return result.rowcount
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# Bulk operations
|
||||
# =============================================================================
|
||||
|
||||
|
||||
def bulk_insert_references_ignore_conflicts(
|
||||
session: Session,
|
||||
rows: list[dict],
|
||||
|
||||
Reference in New Issue
Block a user