From da239bb7e13cb3ef0d8b6527f8a4d0c5ff2321e1 Mon Sep 17 00:00:00 2001 From: Vito Sansevero Date: Tue, 9 Dec 2025 09:29:34 -0800 Subject: [PATCH 1/5] feat(api): exclude protected prompts from pruning --- py/api.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/py/api.py b/py/api.py index 2df1515..e0e10f7 100644 --- a/py/api.py +++ b/py/api.py @@ -3205,15 +3205,19 @@ class PromptManagerAPI: } # Prune orphaned prompts (prompts with no linked images) + # Note: Prompts with the __protected__ tag are excluded from orphan cleanup + # This allows users to add prompts manually without images that won't be deleted if 'prune_orphaned_prompts' in operations: try: with self.db.model.get_connection() as conn: # Find prompts that have no images linked to them + # Exclude prompts with the __protected__ tag cursor = conn.execute(""" - SELECT p.id - FROM prompts p - LEFT JOIN generated_images gi ON p.id = gi.prompt_id + SELECT p.id + FROM prompts p + LEFT JOIN generated_images gi ON p.id = gi.prompt_id WHERE gi.prompt_id IS NULL + AND (p.tags IS NULL OR p.tags NOT LIKE '%"__protected__"%') """) orphaned_prompts = cursor.fetchall() orphaned_count = len(orphaned_prompts) @@ -3231,7 +3235,7 @@ class PromptManagerAPI: results['prune_orphaned_prompts'] = { 'success': True, 'removed_count': removed_count, - 'message': f'Removed {removed_count} orphaned prompts (prompts with no linked images)' + 'message': f'Removed {removed_count} orphaned prompts (prompts with no linked images, excluding protected prompts)' } except Exception as e: results['prune_orphaned_prompts'] = { From 8abeeaa9536155578a560837091aa4eb678a11a2 Mon Sep 17 00:00:00 2001 From: Vito Sansevero Date: Tue, 9 Dec 2025 09:29:47 -0800 Subject: [PATCH 2/5] feat(web): Add prompt creation feature in admin panel --- web/admin.html | 296 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 294 insertions(+), 2 deletions(-) diff --git a/web/admin.html b/web/admin.html index dc199a2..59fe9a6 100644 --- a/web/admin.html +++ b/web/admin.html @@ -204,11 +204,15 @@ class="px-4 py-2 bg-indigo-600 hover:bg-indigo-700 disabled:bg-gray-600 disabled:cursor-not-allowed text-white text-sm font-medium rounded-lg transition-colors"> 🏷️ Add Tags - - + @@ -823,6 +827,101 @@ + + + @@ -780,6 +784,101 @@ No sentences, no commentary, no captions. Only tags. Keep length short but descr + + +