Add semantic tagging, search, favourite/NSFW filtering, and LLM job queue
Replaces old list-format tags (which duplicated prompt content) with structured dict tags per category (origin_series, outfit_type, participants, style_type, scene_type, etc.). Tags are now purely organizational metadata — removed from the prompt pipeline entirely. Adds is_favourite and is_nsfw columns to all 8 resource models. Favourite is DB-only (user preference); NSFW is mirrored in JSON tags for rescan persistence. All library pages get filter controls and favourites-first sorting. Introduces a parallel LLM job queue (_enqueue_task + _llm_queue_worker) for background tag regeneration, with the same status polling UI as ComfyUI jobs. Fixes call_llm() to use has_request_context() fallback for background threads. Adds global search (/search) across resources and gallery images, with navbar search bar. Adds gallery image sidecar JSON for per-image favourite/NSFW metadata. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
17
models.py
17
models.py
@@ -13,6 +13,9 @@ class Character(db.Model):
|
||||
image_path = db.Column(db.String(255), nullable=True)
|
||||
active_outfit = db.Column(db.String(100), default='default')
|
||||
|
||||
is_favourite = db.Column(db.Boolean, default=False)
|
||||
is_nsfw = db.Column(db.Boolean, default=False)
|
||||
|
||||
# NEW: Outfit assignment support (Phase 4)
|
||||
assigned_outfit_ids = db.Column(db.JSON, default=list) # List of outfit_ids from Outfit table
|
||||
default_outfit_id = db.Column(db.String(100), default='default') # 'default' or specific outfit_id
|
||||
@@ -161,6 +164,8 @@ class Look(db.Model):
|
||||
data = db.Column(db.JSON, nullable=False)
|
||||
default_fields = db.Column(db.JSON, nullable=True)
|
||||
image_path = db.Column(db.String(255), nullable=True)
|
||||
is_favourite = db.Column(db.Boolean, default=False)
|
||||
is_nsfw = db.Column(db.Boolean, default=False)
|
||||
|
||||
def get_linked_characters(self):
|
||||
"""Get all characters linked to this look."""
|
||||
@@ -192,6 +197,8 @@ class Outfit(db.Model):
|
||||
data = db.Column(db.JSON, nullable=False)
|
||||
default_fields = db.Column(db.JSON, nullable=True)
|
||||
image_path = db.Column(db.String(255), nullable=True)
|
||||
is_favourite = db.Column(db.Boolean, default=False)
|
||||
is_nsfw = db.Column(db.Boolean, default=False)
|
||||
|
||||
def __repr__(self):
|
||||
return f'<Outfit {self.outfit_id}>'
|
||||
@@ -205,6 +212,8 @@ class Action(db.Model):
|
||||
data = db.Column(db.JSON, nullable=False)
|
||||
default_fields = db.Column(db.JSON, nullable=True)
|
||||
image_path = db.Column(db.String(255), nullable=True)
|
||||
is_favourite = db.Column(db.Boolean, default=False)
|
||||
is_nsfw = db.Column(db.Boolean, default=False)
|
||||
|
||||
def __repr__(self):
|
||||
return f'<Action {self.action_id}>'
|
||||
@@ -218,6 +227,8 @@ class Style(db.Model):
|
||||
data = db.Column(db.JSON, nullable=False)
|
||||
default_fields = db.Column(db.JSON, nullable=True)
|
||||
image_path = db.Column(db.String(255), nullable=True)
|
||||
is_favourite = db.Column(db.Boolean, default=False)
|
||||
is_nsfw = db.Column(db.Boolean, default=False)
|
||||
|
||||
def __repr__(self):
|
||||
return f'<Style {self.style_id}>'
|
||||
@@ -231,6 +242,8 @@ class Scene(db.Model):
|
||||
data = db.Column(db.JSON, nullable=False)
|
||||
default_fields = db.Column(db.JSON, nullable=True)
|
||||
image_path = db.Column(db.String(255), nullable=True)
|
||||
is_favourite = db.Column(db.Boolean, default=False)
|
||||
is_nsfw = db.Column(db.Boolean, default=False)
|
||||
|
||||
def __repr__(self):
|
||||
return f'<Scene {self.scene_id}>'
|
||||
@@ -244,6 +257,8 @@ class Detailer(db.Model):
|
||||
data = db.Column(db.JSON, nullable=False)
|
||||
default_fields = db.Column(db.JSON, nullable=True)
|
||||
image_path = db.Column(db.String(255), nullable=True)
|
||||
is_favourite = db.Column(db.Boolean, default=False)
|
||||
is_nsfw = db.Column(db.Boolean, default=False)
|
||||
|
||||
def __repr__(self):
|
||||
return f'<Detailer {self.detailer_id}>'
|
||||
@@ -256,6 +271,8 @@ class Checkpoint(db.Model):
|
||||
checkpoint_path = db.Column(db.String(255), nullable=False) # e.g. "Illustrious/model.safetensors"
|
||||
data = db.Column(db.JSON, nullable=True)
|
||||
image_path = db.Column(db.String(255), nullable=True)
|
||||
is_favourite = db.Column(db.Boolean, default=False)
|
||||
is_nsfw = db.Column(db.Boolean, default=False)
|
||||
|
||||
def __repr__(self):
|
||||
return f'<Checkpoint {self.checkpoint_id}>'
|
||||
|
||||
Reference in New Issue
Block a user