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:
@@ -70,7 +70,6 @@ def register_routes(app):
|
||||
if category == 'outfits':
|
||||
wardrobe = entity.data.get('wardrobe', {})
|
||||
outfit_triggers = entity.data.get('lora', {}).get('lora_triggers', '')
|
||||
tags = entity.data.get('tags', [])
|
||||
wardrobe_parts = [v for v in wardrobe.values() if isinstance(v, str) and v]
|
||||
char_parts = []
|
||||
face_parts = []
|
||||
@@ -83,7 +82,7 @@ def register_routes(app):
|
||||
face_parts = [v for v in [identity.get('head'),
|
||||
defaults.get('expression')] if v]
|
||||
hand_parts = [v for v in [wardrobe.get('hands')] if v]
|
||||
main_parts = ([outfit_triggers] if outfit_triggers else []) + char_parts + wardrobe_parts + tags
|
||||
main_parts = ([outfit_triggers] if outfit_triggers else []) + char_parts + wardrobe_parts
|
||||
return {
|
||||
'main': _dedup_tags(', '.join(p for p in main_parts if p)),
|
||||
'face': _dedup_tags(', '.join(face_parts)),
|
||||
@@ -93,7 +92,6 @@ def register_routes(app):
|
||||
if category == 'actions':
|
||||
action_data = entity.data.get('action', {})
|
||||
action_triggers = entity.data.get('lora', {}).get('lora_triggers', '')
|
||||
tags = entity.data.get('tags', [])
|
||||
from utils import _BODY_GROUP_KEYS
|
||||
pose_parts = [action_data.get(k, '') for k in _BODY_GROUP_KEYS if action_data.get(k)]
|
||||
expr_parts = [action_data.get('head', '')] if action_data.get('head') else []
|
||||
@@ -104,7 +102,7 @@ def register_routes(app):
|
||||
identity = character.data.get('identity', {})
|
||||
char_parts = [v for v in [identity.get('base'), identity.get('head')] if v]
|
||||
face_parts = [v for v in [identity.get('head')] + expr_parts if v]
|
||||
main_parts = ([action_triggers] if action_triggers else []) + char_parts + pose_parts + tags
|
||||
main_parts = ([action_triggers] if action_triggers else []) + char_parts + pose_parts
|
||||
return {
|
||||
'main': _dedup_tags(', '.join(p for p in main_parts if p)),
|
||||
'face': _dedup_tags(', '.join(face_parts)),
|
||||
@@ -113,20 +111,19 @@ def register_routes(app):
|
||||
|
||||
# styles / scenes / detailers
|
||||
entity_triggers = entity.data.get('lora', {}).get('lora_triggers', '')
|
||||
tags = entity.data.get('tags', [])
|
||||
|
||||
if category == 'styles':
|
||||
sdata = entity.data.get('style', {})
|
||||
artist = f"by {sdata['artist_name']}" if sdata.get('artist_name') else ''
|
||||
style_tags = sdata.get('artistic_style', '')
|
||||
entity_parts = [p for p in [entity_triggers, artist, style_tags] + tags if p]
|
||||
entity_parts = [p for p in [entity_triggers, artist, style_tags] if p]
|
||||
elif category == 'scenes':
|
||||
sdata = entity.data.get('scene', {})
|
||||
scene_parts = [v for v in sdata.values() if isinstance(v, str) and v]
|
||||
entity_parts = [p for p in [entity_triggers] + scene_parts + tags if p]
|
||||
entity_parts = [p for p in [entity_triggers] + scene_parts if p]
|
||||
else: # detailers
|
||||
det_prompt = entity.data.get('prompt', '')
|
||||
entity_parts = [p for p in [entity_triggers, det_prompt] + tags if p]
|
||||
entity_parts = [p for p in [entity_triggers, det_prompt] if p]
|
||||
|
||||
char_data_no_lora = _get_character_data_without_lora(character)
|
||||
base = build_prompt(char_data_no_lora, [], character.default_fields) if char_data_no_lora else {'main': '', 'face': '', 'hand': '', 'feet': ''}
|
||||
|
||||
Reference in New Issue
Block a user