UNPKG

perchance-ai-prompt-library

Version:

๐ŸŽจ Complete AI prompt library and generator with advanced CLI, batch processing, analytics, and multi-format export capabilities

528 lines (383 loc) โ€ข 15.6 kB
# ๐ŸŽจ Perchance AI Prompt Library v2.4.0 > **Now with AI Image Generation powered by Pollinations.ai!** [![npm version](https://badge.fury.io/js/perchance-ai-prompt-library.svg)](https://www.npmjs.com/package/perchance-ai-prompt-library) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Node.js Version](https://img.shields.io/badge/node-%3E%3D14.0.0-brightgreen)](https://nodejs.org/) > **The ultimate AI prompt library and generator with advanced CLI, batch processing, Discord bot, web interface, and professional-quality output** ## ๐Ÿ”‘ **Environment Setup** Create a `.env` file in the project root with the following variables: ```env # Required for AI Image Generation POLLINATIONS_TOKEN=your_pollinations_ai_token_here # Optional: Configure logging level (default: 'info') LOG_LEVEL=info # Optional: Configure API port (default: 3000) PORT=3000 # Optional: Database configuration (if using SQLite) DB_PATH=./data/prompts.db ``` > **Note**: The `.env` file is in `.gitignore` by default to prevent committing sensitive information. ## ๐Ÿ—๏ธ **System Components** 1. **Backend API** - Node.js server that handles prompt generation 2. **Web Interface** - React-based frontend for easy interaction 3. **Discord Bot** - Integration for Discord servers 4. **CLI Tool** - Command-line interface for power users ## โœจ **Features** ### ๐Ÿš€ **Core Features** - **๐Ÿ“š Comprehensive Encyclopedia**: 2+ art styles, 3+ subjects categories, 3+ famous artists, 3+ themes - **โšก Advanced CLI**: Professional command-line interface with 600+ lines of optimized code - **๐Ÿ”„ Batch Processing**: Generate 1-100+ prompts with parallel processing (up to 5 threads) - **๐Ÿ“Š Analytics & Metrics**: Detailed usage statistics, popular styles tracking, daily usage patterns - **๐Ÿ’พ Multi-format Export**: JSON, CSV, TXT export for all data and generated prompts - **๐ŸŽฏ Quality Control**: 10-level quality system with professional enhancement terms - **๐Ÿ–ผ๏ธ AI Image Generation**: Generate AI images directly from prompts using Pollinations AI integration - Multiple artistic styles (photorealistic, digital art, anime, etc.) - Advanced generation parameters (steps, guidance scale, seed, etc.) - Web interface with real-time preview - Command-line interface for automation - Caching for improved performance ### ๐Ÿ›  **Advanced Features** - **๐Ÿ” Fuzzy Search**: Intelligent search across styles, artists, subjects, and themes - **โš™๏ธ Configuration Management**: Persistent settings with custom themes and preferences - **๐Ÿ“š History Tracking**: Complete command history with export capabilities - **๐ŸŽญ Mood Variations**: 5 mood types (dramatic, epic, peaceful, vibrant, mysterious) - **๐Ÿ’จ Performance Optimization**: Intelligent caching and progress indicators - **๐ŸŽจ Custom Styling**: Beautiful ASCII banners, colored tables, and professional formatting ## ๐Ÿš€ **Quick Start** ### ๐Ÿ“ฅ Installation ```bash # Install globally npm install -g perchance-ai-prompt-library # Or install locally npm install perchance-ai-prompt-library ``` ### ๐Ÿ–ผ๏ธ AI Image Generation with Pollinations.ai ### Web Interface ```bash # Start the development server npm run dev # Then open http://localhost:3000 in your browser ``` ### CLI Usage ```bash # Generate an image from a prompt npx perchance generate-image -p "A beautiful sunset over mountains" # Generate with specific style and size npx perchance generate-image -p "A cyberpunk city" -s cyberpunk --width 768 --height 512 # List available styles npx perchance generate-image --list-styles ``` ### API Integration ```javascript const { PollinationsService } = require('perchance-ai-prompt-library'); const pollinations = new PollinationsService('your-api-key'); // Generate an image const imageBuffer = await pollinations.generateImage({ prompt: 'A beautiful sunset over mountains, photorealistic style', width: 512, height: 512, steps: 50, guidance_scale: 7.5 }); // Save the image await fs.writeFile('output.png', imageBuffer); ``` For detailed documentation, see [POLLINATIONS-INTEGRATION.md](docs/POLLINATIONS-INTEGRATION.md) ## ๐Ÿšฆ Starting the Application ### ๐Ÿƒโ€โ™‚๏ธ Quick Start (Windows) 1. **Using the Batch File (Recommended)** ```bash # Double-click on start_services.bat # OR run from command line: .\start_services.bat ``` This will start all services in separate command windows. 2. **Manual Start** ```bash # 1. Start the Backend Server node src/api/server.js # 2. In a new terminal, start the Web Interface cd web npm start # 3. (Optional) In another terminal, start the Discord Bot node src/bot/bot.js ``` ### ๐Ÿงน Cleanup To remove temporary and unnecessary files: ```bash .\cleanup.bat ``` ### ๐Ÿ” Accessing the Services - **Web Interface**: http://localhost:3001 - **API Documentation**: http://localhost:3000/api-docs - **API Endpoint**: http://localhost:3000/api ### ๐Ÿ›  Development 1. **Install Dependencies** ```bash npm install cd web npm install cd .. ``` 2. **Environment Variables** - Copy `.env.example` to `.env` and update the values - For Discord bot, update the token in `.env` 3. **Available Scripts** ```bash # Start API server in development mode npm run dev # Start web interface cd web npm start # Run tests npm test ``` npm start ``` 2. **Start the Web Interface** (in a new terminal) ```bash cd web npm install npm run dev # Access the web interface at http://localhost:5173 ``` 3. **Start the Discord Bot** (in a new terminal) ```bash cd discord-bot npm start # Make sure to set up your Discord bot token in .env file ``` 4. **Use the CLI** (in a new terminal) ```bash # From the project root directory node bin/cli.js --help ``` ### ๐Ÿ–ฅ๏ธ Basic CLI Usage ```bash # Generate a single prompt node bin/cli.js generate anime "space warrior" # Generate multiple variations node bin/cli.js generate photorealistic "cyberpunk city" -c 5 -q 10 # Browse available styles node bin/cli.js styles # Batch processing node bin/cli.js batch anime "dragon" -c 20 -p 5 ``` ### ๐Ÿค– Discord Bot Commands ``` /batch <style> <subject> [count] [quality] [mood] ``` ### ๐ŸŒ Web Interface Access the web interface at `http://localhost:5173` after starting the web server. ## ๐Ÿ“– **Complete Documentation** ### **Core Commands** #### ๐ŸŽจ **Generate Command** perchance-prompts generate <style> "<subject>" [options] Options: -c, --count <number> Number of variations (default: 1) -q, --quality <level> Quality level 1-10 (default: 8) -m, --mood <mood> Mood: dramatic|epic|peaceful|vibrant|mysterious -v, --verbose Show detailed metadata --save Save to history --negative Include negative prompt suggestions **Examples:** High-quality single prompt perchance-prompts generate anime "warrior princess" -q 10 -m epic Multiple variations with mood perchance-prompts generate photorealistic "sunset landscape" -c 3 -m peaceful --verbose Save to history with negative prompts perchance-prompts generate "oil painting" "portrait" --save --negative #### โšก **Batch Processing** perchance-prompts batch <style> "<subject>" [options] Options: -c, --count <number> Number of variations (default: 10) -p, --parallel <threads> Parallel threads 1-5 (default: 3) -q, --quality <level> Quality level 1-10 (default: 8) --progress Show detailed progress --export <format> Export: json|txt|csv **Examples:** Large batch with progress tracking perchance-prompts batch anime "mecha robot" -c 50 -p 5 --progress Export batch results perchance-prompts batch photorealistic "nature scene" -c 20 --export csv #### ๐ŸŽจ **Browse Encyclopedia** Browse art styles perchance-prompts styles [-s search] [-e export] [--detailed] Browse subjects perchance-prompts subjects [-c category] [-s search] Browse famous artists perchance-prompts artists [-s search] [--period era] Browse themes perchance-prompts themes [-s search] [--category cat] **Examples:** Search and export styles perchance-prompts styles -s "realistic" --export json Detailed artist information perchance-prompts artists --detailed Filter themes by category perchance-prompts themes --category "action" ### **Analytics & Management** #### ๐Ÿ“Š **Statistics** perchance-prompts stats [--export format] **Features:** - Total generations and commands - Popular styles ranking - Daily usage patterns - Recent activity log - Export capabilities #### โš™๏ธ **Configuration** Show current config perchance-prompts config --show Set configuration perchance-prompts config --set defaultStyle=anime perchance-prompts config --set qualityLevel=9 Reset to defaults perchance-prompts config --reset #### ๐Ÿ“š **History Management** View history perchance-prompts history [-n 20] Clear history perchance-prompts history --clear ## ๐ŸŽฏ **Advanced Usage Examples** ### **Professional Workflow** 1. Configure for optimal settings perchance-prompts config --set qualityLevel=10 perchance-prompts config --set defaultStyle=photorealistic 2. Generate high-quality prompts with analytics perchance-prompts generate anime "cyberpunk samurai" -c 5 -q 10 -m epic --save --verbose 3. Batch process for production perchance-prompts batch photorealistic "architectural photography" -c 100 -p 5 --export csv 4. Review analytics perchance-prompts stats perchance-prompts history -n 10 ### **Professional Photography Mode** Generate AI prompts with professional photography standards including resolutions, camera settings, and technical specifications. #### **Basic Usage** ```bash # Basic photography prompt perchance-prompts generate --photo --custom "A portrait of a warrior" # Specify format (portrait, landscape, square, cinematic, panoramic) perchance-prompts generate --photo --custom "A mountain landscape" --format landscape # Include camera equipment details perchance-prompts generate --photo --custom "A street photography scene" --equipment # Customize the number of professional terms (default: 3) perchance-prompts generate --photo --custom "A product shot of a watch" --terms 5 ``` #### **Advanced Examples** ```bash # Professional portrait with specific settings perchance-prompts generate --photo --custom "A professional headshot" --format portrait --style standard --settings --equipment # Social media post with square format perchance-prompts generate --photo --custom "A delicious looking burger" --format square --style social_media # Print quality landscape perchance-prompts generate --photo --custom "A serene lake at sunrise" --format landscape --style print # Cinematic scene with specific aspect ratio perchance-prompts generate --photo --custom "A futuristic city at night" --format cinematic --settings ``` ### **Creative Exploration** #### **Explore Different Moods** ```bash # Generate peaceful forest scenes perchance-prompts generate "oil painting" "forest scene" -m peaceful -c 3 # Create dramatic space battles perchance-prompts generate "digital art" "space battle" -m dramatic -c 3 # Make vibrant flower gardens perchance-prompts generate "watercolor" "flower garden" -m vibrant -c 3 ``` #### **Random Style Selection** ```bash # Generate with a completely random style perchance-prompts generate --random "mysterious castle" # Randomly select from specific styles perchance-prompts generate --random-from "anime,cyberpunk,watercolor" "portrait" # Use random style with quality and enhancement perchance-prompts generate --random "futuristic city" -q 9 -e ``` #### **Custom Prompts** ```bash # Use a custom prompt without style processing perchance-prompts generate --custom "A detailed steampunk airship flying over a city at sunset, intricate gears, warm lighting" # Save custom prompt to history perchance-prompts generate --custom "Surreal landscape with floating islands and waterfalls" --save ``` #### **Mix Styles with Artists** ```bash # Search for artists perchance-prompts artists -s "van gogh" # Generate in an artist's style with high quality perchance-prompts generate "van gogh style" "starry cityscape" -q 9 ``` ## ๐Ÿ“ **Project Structure** perchance-ai-prompt-library/ โ”œโ”€โ”€ bin/ โ”‚ โ””โ”€โ”€ cli.js # Advanced CLI (600+ lines) โ”œโ”€โ”€ src/ โ”‚ โ”œโ”€โ”€ index.js # Main library โ”‚ โ”œโ”€โ”€ data/ # Encyclopedia JSON files โ”‚ โ”‚ โ”œโ”€โ”€ styles.json # Art styles database โ”‚ โ”‚ โ”œโ”€โ”€ subjects.json # Subject categories โ”‚ โ”‚ โ”œโ”€โ”€ artists.json # Famous artists โ”‚ โ”‚ โ”œโ”€โ”€ themes.json # Thematic elements โ”‚ โ”‚ โ”œโ”€โ”€ negatives.json # Negative prompts โ”‚ โ”‚ โ””โ”€โ”€ recipes.json # Prompt recipes โ”‚ โ””โ”€โ”€ utils/ # Utility functions โ”œโ”€โ”€ tests/ # Test suites โ”œโ”€โ”€ docs/ # Documentation โ”œโ”€โ”€ README.md # This file โ”œโ”€โ”€ CHANGELOG.md # Version history โ””โ”€โ”€ package.json # Package configuration ## ๐Ÿ”ง **Development** ### **Setup Development Environment** Clone repository git clone https://github.com/perchance-ai/prompt-library.git cd prompt-library Install dependencies npm install Link for development npm link Run tests npm test npm run test:cli ### **Available Scripts** npm run dev # Development mode npm run test # Run all tests npm run test:cli # Test CLI functionality npm run lint # Code linting npm run docs # Generate documentation npm run release # Create release ## ๐Ÿ“Š **Performance & Scale** - **โšก Generation Speed**: 1-3 prompts/second - **๐Ÿ”„ Batch Capacity**: Up to 100 prompts with 5 parallel threads - **๐Ÿ’พ Memory Usage**: ~50MB for full encyclopedia - **๐Ÿ“ฑ Compatibility**: Node.js 14+ on Windows, macOS, Linux - **๐ŸŒ Network**: Offline-first, no external API dependencies ## ๐Ÿค **Contributing** We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md). ### **Ways to Contribute:** - ๐ŸŽจ Add new art styles or artists - ๐Ÿ“ Improve documentation - ๐Ÿ› Report bugs or request features - ๐Ÿ’ก Suggest new CLI commands - ๐Ÿงช Add test cases ## ๐Ÿ“ **License** MIT License - see [LICENSE](LICENSE) file for details. ## ๐Ÿ†• **What's New in v2.2.0** - โœจ **Advanced CLI**: Complete rewrite with 600+ lines of professional code - โšก **Batch Processing**: Parallel processing with progress tracking - ๐Ÿ“Š **Analytics System**: Comprehensive usage statistics and metrics - ๐Ÿ’พ **Export Capabilities**: Multi-format export (JSON, CSV, TXT) - ๐ŸŽฏ **Quality Control**: 10-level quality system with mood variations - โš™๏ธ **Configuration Management**: Persistent settings and preferences - ๐Ÿ“š **History Tracking**: Complete command history with search - ๐Ÿ” **Fuzzy Search**: Intelligent search across all data - ๐ŸŽจ **Professional UI**: Beautiful formatting and ASCII art - ๐Ÿ’จ **Performance**: Caching, optimization, and error handling ## ๐Ÿ“ž **Support & Links** - ๐Ÿ“– **Documentation**: [Full Documentation](https://github.com/perchance-ai/prompt-library/wiki) - ๐Ÿ› **Issues**: [GitHub Issues](https://github.com/perchance-ai/prompt-library/issues) - ๐Ÿ’ฌ **Discussions**: [GitHub Discussions](https://github.com/perchance-ai/prompt-library/discussions) - ๐Ÿ“ฆ **NPM**: [npm package](https://www.npmjs.com/package/perchance-ai-prompt-library) - โญ **Star us**: [GitHub Repository](https://github.com/perchance-ai/prompt-library) --- **Made with โค๏ธ by the AI Research Team** *Transform your AI image generation workflow with professional-grade prompts and advanced CLI tools.*