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
Markdown
# ๐จ Perchance AI Prompt Library v2.4.0
> **Now with AI Image Generation powered by Pollinations.ai!**
[](https://www.npmjs.com/package/perchance-ai-prompt-library)
[](https://opensource.org/licenses/MIT)
[](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.*