From f85da5e38c197a5eb2cc486ce5364f79eca0b02f Mon Sep 17 00:00:00 2001 From: danieljanata Date: Thu, 15 Jan 2026 05:35:35 +0100 Subject: [PATCH] Delete README.md --- README.md | 579 ------------------------------------------------------ 1 file changed, 579 deletions(-) delete mode 100644 README.md diff --git a/README.md b/README.md deleted file mode 100644 index 07d4f5d..0000000 --- a/README.md +++ /dev/null @@ -1,579 +0,0 @@ -# 🎨 ComfyUI Prompting System - -A comprehensive prompt management system for ComfyUI with database storage, thumbnail management, and advanced features. - -## ✨ Features - -- **πŸ’Ύ Prompt Saver** - Save prompts with metadata (category, tags, rating, notes) -- **πŸ”’ Lock/Unlock Mechanism** - Control when prompts overwrite from database -- **✏️ Smart Text Input** - Automatic change detection (new vs edit) -- **πŸ“š Library Browser** - Browse, search, filter prompts with rich UI -- **πŸ–ΌοΈ Thumbnail Management** - Store up to 3 thumbnails per prompt with lock/unlock -- **πŸ“€ Export/Import** - Export database as JSON, merge with other databases -- **🧹 Auto-Cleanup** - Automatically remove old unrated prompts -- **πŸ” Advanced Search** - Search by text, category, tags, rating -- **πŸ“Š Statistics** - Track usage, ratings, generations -- **🌐 Cross-Platform** - Works on Windows, Linux, macOS - -## πŸ“¦ Installation - -### Method 1: Git Clone (Recommended) - -```bash -cd ComfyUI/custom_nodes -git clone https://github.com/danieljanata/ComfyUI-Prompting-System.git -``` - -### Method 2: Manual Download - -1. Download ZIP from GitHub -2. Extract to `ComfyUI/custom_nodes/ComfyUI-Prompting-System` -3. Restart ComfyUI - -### Requirements - -- ComfyUI (latest version) -- Python 3.8+ -- PIL/Pillow (usually included with ComfyUI) - -## πŸš€ Quick Start - -### Basic Workflow - -1. **Add Smart Text Input node** - - Type your prompt - - Detects if it's a new prompt or edit - -2. **Connect to Prompt Saver node** - - Select category (or create new) - - Add tags (comma-separated) - - Rate the prompt (0-5 stars) - - Add notes (optional) - -3. **Lock/Unlock behavior** - - πŸ”“ **Unlocked**: Loads latest prompt from category - - πŸ”’ **Locked**: Saves current prompt - -4. **Browse saved prompts** - - Add Prompt Library Browser node - - Search, filter, load prompts - - View thumbnails and generation history - -## πŸ“‹ Node Documentation - -### πŸ’Ύ Prompt Saver - -Saves prompts with full metadata and lock/unlock mechanism. - -**Inputs:** -- `text` (STRING) - Prompt text -- `locked` (BOOLEAN) - Lock/unlock toggle -- `category` (DROPDOWN) - Prompt category -- `new_category` (STRING) - Create new category -- `tags` (STRING) - Comma-separated tags -- `rating` (INT 0-5) - Prompt quality rating -- `notes` (STRING) - Additional notes -- `auto_save` (BOOLEAN) - Enable/disable auto-save - -**Outputs:** -- `text` - Processed text -- `category` - Selected category -- `prompt_id` - Database ID of saved prompt - -**Behavior:** - -**Unlocked Mode (πŸ”“):** -- Loads latest prompt from selected category -- Overwrites text input with database content -- Useful for reusing previous prompts - -**Locked Mode (πŸ”’):** -- Saves current text to database -- Detects if new prompt or update (based on similarity) -- Creates new entry if text is significantly different -- Updates existing if minor changes - -**Pulsing Button:** -- The unlock button pulses to remind you it's in overwrite mode -- Lock it when you want to save new content - ---- - -### ✏️ Smart Text Input - -Enhanced text input with automatic change detection. - -**Inputs:** -- `text` (STRING) - Your prompt text -- `similarity_threshold` (FLOAT 0-1) - Threshold for new vs edit detection - -**Outputs:** -- `text` - The input text -- `is_new_prompt` (BOOLEAN) - True if completely new -- `similarity` (FLOAT) - Similarity score with previous text - -**Usage:** -- Type your prompt normally -- Node automatically detects if you're writing something new or editing -- Visual feedback (color change) indicates detection result - ---- - -### πŸ“š Prompt Library Browser - -Interactive browser for managing your prompt library. - -**Inputs:** -- `action` (DROPDOWN) - Action to perform: - - `Browse` - View all prompts - - `Search` - Search with filters - - `Load Prompt` - Load specific prompt by ID - - `Upload Database` - Import and merge database - - `Lock Thumbnail` - Lock a thumbnail slot - - `Unlock Thumbnail` - Unlock a thumbnail slot - -- `search_text` (STRING) - Text to search -- `category_filter` (DROPDOWN) - Filter by category -- `min_rating` (INT 0-5) - Minimum rating filter -- `prompt_id_to_load` (INT) - ID of prompt to load -- `thumbnail_index` (INT 0-2) - Thumbnail slot index -- `database_json` (STRING) - Paste JSON for upload -- `max_results` (INT) - Maximum results to show - -**Outputs:** -- `loaded_text` - Text of loaded prompt -- `loaded_category` - Category of loaded prompt -- `results_json` - Search results as JSON -- `loaded_prompt_id` - ID of loaded prompt - -**Features:** - -**Browsing:** -- View all prompts with metadata -- See thumbnails, ratings, usage count -- Filter by category, tags, rating - -**Searching:** -- Full-text search in prompt content and notes -- Multiple filter combinations -- Sorted by rating and usage - -**Loading:** -- Enter prompt ID to load specific prompt -- Outputs text and category for use in workflow - -**Database Upload:** -- Paste JSON from exported database -- Automatically merges with current database -- Removes duplicates (by hash) -- Keeps higher ratings -- Sums usage counts - ---- - -### πŸ“€ Export Manager - -Export and manage your database. - -**Inputs:** -- `export_action` (DROPDOWN): - - `None` - Show basic statistics - - `Export Database` - Save database to file - - `Show Statistics` - Detailed statistics - - `Cleanup Old Prompts` - Remove old unrated prompts - -- `export_filename` (STRING) - Filename for export - -**Outputs:** -- `info` - Status information and statistics - -**Features:** - -**Export Database:** -- Saves complete database to output folder -- Includes all prompts, thumbnails (base64), metadata -- Single JSON file - easy to share or backup - -**Statistics:** -- Total prompts, categories, tags -- Rated vs unrated breakdown -- Category distribution -- Tag usage -- Database size and location - -**Cleanup:** -- Removes prompts with rating = 0 -- Only if older than threshold (default 30 days) -- Configurable in database settings -- Rated prompts are NEVER deleted - ---- - -## πŸ–ΌοΈ Thumbnail Management - -### How Thumbnails Work - -Each prompt can store up to **3 thumbnails** with a **lock/unlock** system. - -### Automatic Thumbnail Saving - -When you generate images using a prompt: -1. The **last generated image** is automatically saved as a thumbnail -2. If all slots are unlocked, the oldest unlocked slot is replaced -3. If some slots are locked, only unlocked slots are replaced - -### Lock/Unlock Mechanism - -**Unlocked Slot (default):** -- Always gets replaced with the newest generation -- Useful for seeing "current best" output - -**Locked Slot:** -- Preserved permanently until you unlock it -- Useful for keeping reference images - -**Example Workflow:** - -``` -Generation 1: [Unlocked Slot 1] ← New image -Generation 2: [Unlocked Slot 1] ← Replaced - β†’ User clicks lock on Slot 1 -Generation 3: [Locked Slot 1] [Unlocked Slot 2] ← New image -Generation 4: [Locked Slot 1] [Unlocked Slot 2] ← Replaced - β†’ User clicks lock on Slot 2 -Generation 5: [Locked Slot 1] [Locked Slot 2] [Unlocked Slot 3] ← New -``` - -### Locking/Unlocking in UI - -Use **Prompt Library Browser** node: -1. Set action to "Lock Thumbnail" or "Unlock Thumbnail" -2. Enter prompt ID -3. Enter thumbnail index (0, 1, or 2) -4. Execute - ---- - -## πŸ—„οΈ Database Structure - -### Location - -``` -ComfyUI/ -└── user/ - └── default/ - └── workflows/ - └── prompt_database.json -``` - -### Format - -```json -{ - "version": "1.0", - "created": "2026-01-14T10:00:00Z", - "last_updated": "2026-01-14T12:00:00Z", - "settings": { - "auto_cleanup_enabled": true, - "auto_cleanup_days": 30, - "max_thumbnails": 3 - }, - "categories": ["Girl πŸ‘©πŸ»", "Clothing πŸ‘—", "Lighting πŸ’‘"], - "tags": ["blonde", "dress", "outdoor"], - "prompts": [ - { - "id": 1, - "text": "Beautiful woman with platinum blonde hair...", - "category": "Girl πŸ‘©πŸ»", - "tags": ["blonde", "blue-eyes"], - "rating": 5, - "notes": "Best prompt for nordic look", - "created_at": "2026-01-14T10:30:00Z", - "updated_at": "2026-01-14T11:00:00Z", - "used_count": 15, - "hash": "a3f5e8d...", - "thumbnails": [ - { - "data": "data:image/jpeg;base64,...", - "locked": true, - "timestamp": "2026-01-14T10:35:00Z", - "source_image": "ComfyUI_00123.png" - } - ], - "generation_history": [] - } - ] -} -``` - -### Thumbnails - -- Stored as **base64-encoded JPEG** data URIs -- **150x150px** at 70% quality -- Approximately **10-12 KB** each -- Maximum 3 per prompt = ~35 KB per prompt - ---- - -## πŸ”„ Database Merge Logic - -When merging databases (e.g., from backup or another user): - -1. **Deduplication by Hash** - - Prompts with identical text (hash) are considered duplicates - - Only one copy is kept - -2. **Conflict Resolution** - - **Rating**: Higher rating wins - - **Used Count**: Summed (e.g., 20 + 5 = 25) - - **Created Date**: Older date kept (original creation time) - - **Updated Date**: Newer date kept - - **Thumbnails**: Locked thumbnails preserved, newest unlocked added - - **Tags**: Merged (union of both sets) - -3. **Categories and Tags** - - All unique categories are preserved - - All unique tags are preserved - -### Example Merge - -**Database A:** -```json -{ - "id": 1, - "text": "Beautiful woman...", - "hash": "abc123", - "rating": 5, - "used_count": 20 -} -``` - -**Database B:** -```json -{ - "id": 47, - "text": "Beautiful woman...", - "hash": "abc123", - "rating": 3, - "used_count": 5 -} -``` - -**Result:** -```json -{ - "id": 1, - "text": "Beautiful woman...", - "hash": "abc123", - "rating": 5, ← Higher rating - "used_count": 25 ← Summed -} -``` - ---- - -## 🧹 Auto-Cleanup - -### How It Works - -- Removes prompts with **rating = 0** (unrated) -- Only if older than **30 days** (configurable) -- Runs when you use "Cleanup Old Prompts" action -- Can be disabled in settings - -### Why? - -- Prevents database bloat from experimental prompts -- Keeps only prompts you found valuable (rated) -- Encourages rating good prompts to preserve them - -### Protection - -**Prompts are SAFE if:** -- Rating > 0 (any rating keeps it forever) -- Created within cleanup threshold (e.g., last 30 days) - -**Prompts are REMOVED if:** -- Rating = 0 AND -- Created more than threshold days ago - ---- - -## 🎯 Use Cases - -### 1. Iterative Prompt Development - -``` -[Smart Text Input] β†’ [Prompt Saver (Unlocked)] - ↓ - [Generate Image] - ↓ - [View Result] - ↓ - [Lock if good, or edit and try again] -``` - -### 2. Building Prompt Library - -1. Start with Prompt Saver **locked** -2. Write different prompts for each category -3. Rate them as you test (1-5 stars) -4. Best prompts (5 stars) are easy to find later - -### 3. Team Collaboration - -1. Each person exports their database -2. Share JSON files -3. Import into Prompt Library Browser -4. Automatic merge with deduplication -5. Everyone has access to best prompts - -### 4. Backup and Restore - -1. Regularly export database (Export Manager) -2. Save to cloud storage -3. If database corrupted, import from backup -4. No data loss - ---- - -## πŸ”§ Advanced Configuration - -### Changing Auto-Cleanup Settings - -Edit `prompt_database.json` directly: - -```json -"settings": { - "auto_cleanup_enabled": true, - "auto_cleanup_days": 30, - "max_thumbnails": 3 -} -``` - -**Options:** -- `auto_cleanup_enabled`: `true` or `false` -- `auto_cleanup_days`: Number of days (e.g., `30`, `60`, `90`) -- `max_thumbnails`: 1 to 5 (default 3) - -### Custom Categories - -Categories are created automatically when you type them, or you can add to database: - -```json -"categories": [ - "Girl πŸ‘©πŸ»", - "Clothing πŸ‘—", - "Your Custom Category" -] -``` - -### Custom Tags - -Tags are created automatically when you use them. No configuration needed. - ---- - -## πŸ› Troubleshooting - -### Database Not Saving - -**Problem:** Changes not persisting - -**Solutions:** -1. Check file permissions on `ComfyUI/user/default/workflows/` -2. Ensure no other process is locking the file -3. Check console for error messages -4. Try manual export and re-import - -### Thumbnails Not Appearing - -**Problem:** Images not being captured - -**Solutions:** -1. Ensure images are saved (PreviewImage or SaveImage node) -2. Check that workflow completed successfully -3. Verify output directory exists -4. May need to implement automatic image detection (coming soon) - -### Lock Button Not Pulsing - -**Problem:** Visual animation not working - -**Solutions:** -1. Refresh ComfyUI page (Ctrl+F5) -2. Check browser console for JavaScript errors -3. Ensure `web/js/prompt_library_ui.js` is loaded - -### Merge Failed - -**Problem:** Upload database gives error - -**Solutions:** -1. Validate JSON syntax (use JSONLint.com) -2. Ensure it's a valid prompt database (has correct structure) -3. Check for file encoding (must be UTF-8) -4. Try smaller database first to test - ---- - -## 🀝 Contributing - -Contributions welcome! Please: - -1. Fork the repository -2. Create feature branch -3. Test thoroughly -4. Submit pull request with clear description - ---- - -## πŸ“„ License - -MIT License - feel free to use in your projects! - ---- - -## πŸ™ Credits - -Created by **Daniel Janata** with assistance from **Claude (Anthropic)** - -Special thanks to the ComfyUI community! - ---- - -## πŸ“ž Support - -- **Issues**: [GitHub Issues](https://github.com/danieljanata/ComfyUI-Prompting-System/issues) -- **Discussions**: [GitHub Discussions](https://github.com/danieljanata/ComfyUI-Prompting-System/discussions) - ---- - -## πŸ—ΊοΈ Roadmap - -### Planned Features - -- [ ] Automatic image detection from workflow execution -- [ ] Web UI panel for library browser (instead of node) -- [ ] Import/export to CSV format -- [ ] Prompt templates and variables -- [ ] Batch operations (rate multiple, delete multiple) -- [ ] Prompt versioning and history -- [ ] Shared online library (opt-in) -- [ ] AI-powered prompt suggestions -- [ ] Integration with popular checkpoint metadata - ---- - -## πŸ“Š Statistics - -### Development Info - -- **Lines of Code**: ~2500+ -- **Development Time**: 2 hours -- **Languages**: Python 95%, JavaScript 3%, CSS 2% -- **Dependencies**: Minimal (PIL, built-in modules) - ---- - -**Happy Prompting! 🎨**