Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

🚀 AI Content Agent Pro - WordPress Edition

A powerful Streamlit-based application for automated content creation and WordPress publishing powered by Google Gemini AI. Create professional articles, technical documentation, complete Python projects, and publish directly to WordPress with SEO optimization, featured images, and comprehensive customization options.

Python Streamlit Gemini WordPress License

✨ Features

🤖 AI-Powered Content Generation

  • 13 Content Types: Blog posts, technical articles, tutorials, reviews, documentation, case studies, and more
  • Google Gemini 2.0: State-of-the-art AI model for natural, professional content
  • SEO Optimization: Automatic title, meta description, keywords, and URL slug generation
  • Customizable Parameters: Writing style, target audience, word count (500-5000+ words)
  • Advanced Options: Table of contents, practical examples, code blocks, conclusions

🚀 Complete Project Generation

  • 9 Project Types: Python projects, web apps, APIs, ML projects, Discord bots, automation scripts, CLI tools, games
  • Multiple Files: Main code, requirements.txt, README.md, .gitignore, config files
  • Advanced Features: Unit tests, Docker setup, CI/CD configuration, comprehensive documentation
  • Production-Ready: Error handling, best practices, proper code structure
  • Download Options: ZIP archive or individual files

📡 WordPress Publishing

  • Direct Publishing: One-click publishing to WordPress from the app
  • Self-Hosted & WordPress.com: Support for both hosting types with auto-detection
  • Permalink Auto-Detection: Works with and without pretty permalinks
  • Featured Images: Manual upload or AI-generated placeholder images
  • Categories & Tags: Select from existing WordPress terms or let SEO suggest tags
  • Post Status: Publish immediately or save as draft
  • REST API: Uses WordPress REST API for secure, modern integration

🔍 SEO & Metadata

  • Automatic SEO Generation: AI-powered SEO metadata for every piece of content
  • Title Optimization: 50-60 character SEO titles
  • Meta Descriptions: 150-160 character descriptions optimized for click-through
  • Keyword Extraction: 3-5 relevant, high-impact keywords
  • URL Slugs: Clean, search-friendly URL slugs
  • Editable Metadata: Review and adjust all SEO elements before publishing

📊 Analytics & Results

  • Publication History: Track all WordPress publications with timestamps
  • Content Analytics: Word count, paragraphs, code blocks, headings
  • SEO Analysis: Title/description length validation and recommendations
  • Project Statistics: File count, total lines, file type breakdown
  • Session Management: Export/import configuration preferences

💾 Export Options

  • Markdown Files: Save with YAML front matter metadata
  • HTML Websites: Complete, styled HTML with responsive design
  • Project ZIP: Download complete projects as ZIP archives
  • Individual Downloads: Download project files separately
  • Configuration Export: Save and load your preferences

📋 Requirements

System Requirements

  • Python 3.8 or higher
  • Modern web browser
  • Internet connection
  • 2GB+ RAM
  • WordPress 4.7+ (for publishing)

Python Dependencies

streamlit>=1.28.0
requests>=2.31.0
markdown>=3.5.0
python-dotenv>=1.0.0

🔧 Installation

1. Install Dependencies

pip install streamlit requests markdown python-dotenv

Or use requirements.txt:

pip install -r requirements.txt

requirements.txt:

streamlit>=1.28.0
requests>=2.31.0
markdown>=3.5.0
python-dotenv>=1.0.0

2. Get Google Gemini API Key

  1. Visit Google AI Studio
  2. Sign in with your Google account
  3. Click "Get API Key"
  4. Create a new API key
  5. Copy the key (starts with AIza...)

3. Set Up WordPress (Optional)

For Self-Hosted WordPress:

  1. Enable REST API (usually enabled by default in WordPress 4.7+)
  2. Create Application Password:
    • Go to WordPress Admin → Users → Profile
    • Scroll to "Application Passwords"
    • Enter name (e.g., "AI Content Agent")
    • Click "Add New Application Password"
    • Copy the generated password (appears only once)

For WordPress.com:

  1. Upgrade Plan: Requires Business plan or higher
  2. Make Site Public: Remove "Coming Soon" mode
  3. Get Access Token:
    • Go to WordPress.com → My Sites → Manage → Marketing → Connections
    • Create a new connection/token
    • Copy the access token

4. Configure Environment Variables (Optional)

Create a .env file in the project directory:

# Gemini AI API Key
GEMINI_API_KEY=AIzaSyXXXXXXXXXXXXXXXXXXXXXXXXXX

# WordPress Configuration (Self-Hosted)
WP_SITE_URL=https://yoursite.com
WP_USERNAME=your-username
WP_APP_PASSWORD=xxxx xxxx xxxx xxxx xxxx xxxx

# Or for WordPress.com
WP_SITE_URL=https://yoursite.wordpress.com
WP_USERNAME=your-username
WP_APP_PASSWORD=your-access-token

Note: Settings can also be configured directly in the app's sidebar.

🚀 Usage

Start the Application

streamlit run app.py

The app will open in your default browser at http://localhost:8501

Basic Workflow

1. Configure API Keys (Sidebar)

Gemini AI:

  • Enter your Gemini API key
  • Click outside the field or press Enter
  • Wait for "✅ Gemini AI Connected"

WordPress (Optional):

  • Select WordPress type (Self-hosted or WordPress.com)
  • Enter Site URL
  • Enter Username
  • Enter Application Password/Access Token
  • Click "🔗 Test WordPress Connection"
  • Wait for success message

2. Create Content

Navigate to "📝 Content & Project Creation" tab:

  1. Choose Type: Content (articles) or Projects (Python code)

  2. For Articles:

    • Enter topic (e.g., "The Future of AI")
    • Select content type (Blog Post, Tutorial, etc.)
    • Choose writing style (Professional, Casual, etc.)
    • Select target audience (Beginners, Advanced, etc.)
    • Choose word count (500-5000+ words)
    • Add detailed description and requirements
    • Enable/disable advanced options (SEO, TOC, examples)
    • Click "🚀 Generate Content"
  3. For Projects:

    • Enter project name (e.g., "Flask API Server")
    • Select project type (Python Project, Web App, etc.)
    • Choose target audience
    • Add detailed description and features
    • Enable/disable advanced options (tests, Docker, CI/CD)
    • Click "🚀 Generate Project"

3. Review & Edit

In the "🚀 Publishing" tab:

  • Preview generated content
  • Edit SEO metadata (title, description, keywords, slug)
  • View content statistics
  • For projects: Browse individual files

4. Publish or Download

WordPress Publishing:

  • Select post status (draft or publish)
  • Choose categories and tags
  • Add featured image (manual upload or AI-generated)
  • Click "📝 Publish Post to WordPress"
  • Get live URL and edit link

Local Download:

  • Save as Markdown file
  • Create HTML website
  • Download project as ZIP
  • Download individual project files

5. View Results

Navigate to "📊 Results" tab:

  • View publication history
  • Check content analytics
  • Review SEO analysis
  • Track WordPress publications

⚙️ Configuration

Content Generation Options

Writing Styles:

  • Professional
  • Casual
  • Technical
  • Conversational
  • Academic
  • Creative
  • Formal
  • Friendly
  • Authoritative

Target Audiences:

  • Beginners
  • Intermediate
  • Advanced
  • General Public
  • Developers
  • Business Professionals
  • Students
  • Researchers
  • Decision Makers

Word Counts:

  • 500-800 (short article)
  • 800-1200 (standard article)
  • 1200-2000 (comprehensive article)
  • 2000-3000 (in-depth guide)
  • 3000-5000 (extensive tutorial)
  • 5000+ (complete guide/documentation)

Project Generation Options

Project Types:

  • Python Project
  • Web Application
  • API Project
  • Data Science Project
  • Machine Learning Project
  • Discord Bot
  • Automation Script
  • CLI Tool
  • Game Project

Complexity Levels:

  • Simple: Basic functionality
  • Intermediate: Production features
  • Advanced: Enterprise-grade code

Optional Features:

  • Unit Tests (pytest/unittest)
  • Docker Setup (Dockerfile + compose)
  • CI/CD Configuration (GitHub Actions)
  • Comprehensive Documentation
  • Usage Examples

WordPress Configuration

Permalink Settings: The app auto-detects your WordPress permalink structure:

  • Pretty permalinks: /wp-json/wp/v2/posts
  • Query parameters: /?rest_route=/wp/v2/posts

Categories & Tags:

  • Auto-fetched from WordPress on connection
  • Select existing categories/tags from dropdown
  • Tags can be auto-suggested from SEO keywords
  • Must exist in WordPress before publishing

Post Status:

  • draft: Save as draft for review
  • publish: Publish immediately to live site

🎯 Use Cases

1. Blog Content Creation

Topic: "10 Python Tips for Beginners"
Content Type: Blog Post
Writing Style: Friendly
Audience: Beginners
Word Count: 1200-2000
Advanced: Enable SEO, Examples, Conclusion

Result: SEO-optimized blog post with code examples, ready to publish.

2. Technical Documentation

Topic: "REST API Documentation for XYZ Service"
Content Type: API Documentation
Writing Style: Technical
Audience: Developers
Word Count: 2000-3000
Advanced: Enable TOC, Examples

Result: Complete API docs with endpoints, parameters, examples.

3. Complete Python Project

Project Name: "Discord Weather Bot"
Type: Discord Bot
Audience: Intermediate
Complexity: Intermediate
Advanced: Enable Tests, Docker, Examples

Result: Full project with bot.py, requirements.txt, README, Docker setup.

4. Tutorial Series

Topic: "Machine Learning with scikit-learn"
Content Type: Tutorial
Writing Style: Professional
Audience: Intermediate
Word Count: 3000-5000
Advanced: Enable all options

Result: Step-by-step tutorial with code, explanations, exercises.

5. Product Reviews

Topic: "ChatGPT Plus vs Claude Pro Comparison"
Content Type: Review
Writing Style: Conversational
Audience: General Public
Word Count: 1200-2000
Advanced: Enable SEO, Conclusion

Result: Detailed comparison with pros/cons, ratings, recommendations.

🛠️ Advanced Features

Custom Prompts

The app uses sophisticated prompts that include:

  • Content type-specific instructions
  • SEO requirements
  • Structural guidelines
  • Code formatting rules
  • Quality standards

SEO Optimization

Automatic Generation:

  • Primary keywords extracted from content
  • Related keywords suggested
  • Title optimized for 50-60 characters
  • Description optimized for 150-160 characters
  • Clean URL slugs with hyphens

Validation:

  • Real-time length checking
  • Green checkmarks for optimal lengths
  • Yellow warnings for improvements needed

Featured Image Handling

Manual Upload:

  • Support for PNG, JPG, JPEG, GIF
  • Upload to WordPress media library
  • Automatic association with post

AI Generated (Placeholder):

  • Describe desired image
  • Generate placeholder image
  • Upload to WordPress
  • Note: Real AI image generation requires external API integration

Project File Structure

Standard Project Files:

project_name/
├── main.py (core logic)
├── requirements.txt (dependencies)
├── README.md (documentation)
├── .gitignore (Git exclusions)
├── config.py (configuration)
├── .env.example (environment template)
├── tests/ (optional)
│   └── test_main.py
├── Dockerfile (optional)
├── docker-compose.yml (optional)
└── .github/workflows/ci.yml (optional)

Configuration Management

Export Settings:

  • Generate JSON configuration file
  • Save content preferences
  • Save project preferences
  • Save WordPress settings (passwords excluded)

Import Settings:

  • Upload configuration JSON
  • Load saved preferences
  • Apply to new sessions
  • Merge with current settings

🔒 Security & Privacy

Best Practices

  1. API Keys

    • Store in .env file
    • Never commit to version control
    • Add .env to .gitignore
    • Rotate keys periodically
  2. WordPress Credentials

    • Use Application Passwords (not login passwords)
    • Create specific user for API access
    • Limit permissions as needed
    • Revoke unused application passwords
  3. WordPress.com

    • Use access tokens instead of passwords
    • Keep site public for REST API access
    • Upgrade to Business plan minimum
    • Monitor API usage
  4. Data Privacy

    • Content generated locally
    • API calls use HTTPS
    • No data stored on external servers
    • Session data cleared on exit

.gitignore Template

.env
*.pyc
__pycache__/
.streamlit/secrets.toml
generated_content/
generated_website/
ai_agent_config.json
.DS_Store

🛠️ Troubleshooting

Gemini AI Issues

Error: "Authentication failed"

  • Verify API key is correct
  • Check for extra spaces
  • Ensure key has proper permissions
  • Try generating new API key

Error: "No content generated"

  • Check internet connection
  • Verify API key is active
  • Try simpler prompts
  • Check Gemini API status

WordPress Connection Issues

Self-Hosted WordPress:

"Authentication failed"

  • Use Application Password, not login password
  • Verify username is correct
  • Check WordPress user has proper permissions
  • Ensure REST API is enabled

"404 Not Found"

  • Check site URL is correct
  • Try toggling permalink settings
  • Verify .htaccess is writable
  • Check if REST API endpoint exists

WordPress.com:

"Site is private or Coming Soon"

  • Make site public
  • Remove "Coming Soon" mode
  • Settings → Privacy → Public

"403 Forbidden"

  • Upgrade to Business plan or higher
  • Verify access token is valid
  • Check token permissions

Publishing Issues

"Invalid parameter(s): categories"

  • Categories must exist in WordPress first
  • Create categories manually
  • Match category names exactly (case-insensitive)
  • App fetches available categories on connection

"Featured image upload failed"

  • Check file size limits (PHP settings)
  • Verify file type is supported
  • Check user permissions for media upload
  • Try smaller image files

"Tags not applied"

  • Tags must exist in WordPress first
  • Create tags manually or
  • WordPress may auto-create tags on first use
  • Check spelling matches exactly

General Issues

App won't start

# Check Python version
python --version  # Should be 3.8+

# Reinstall dependencies
pip install -r requirements.txt --upgrade

# Clear Streamlit cache
streamlit cache clear

Session state errors

  • Click "🗑️ Clear All Session Data" in Settings
  • Refresh browser
  • Restart Streamlit app

Slow content generation

  • Normal for long content (2000+ words)
  • Expected time: 30-180 seconds
  • Check internet speed
  • Try shorter word count first

📊 Performance & Limits

Content Generation

Word Count Generation Time Quality
500-800 30-45 seconds Excellent
800-1200 45-60 seconds Excellent
1200-2000 60-90 seconds Excellent
2000-3000 90-120 seconds Very Good
3000-5000 120-180 seconds Good

Project Generation

Complexity Files Time Quality
Simple 3-5 45-60s Good
Intermediate 5-8 60-90s Very Good
Advanced 8-12 90-150s Excellent

API Limits

Gemini AI:

  • Free tier: 60 requests/minute
  • Rate limiting may apply
  • No monthly limit on free tier

WordPress REST API:

  • No specific rate limits
  • Depends on hosting
  • Shared hosting may be slower

💡 Tips & Best Practices

Content Generation

  1. Be Specific: Detailed descriptions produce better content
  2. Use Examples: Reference similar content you like
  3. Iterate: Generate, review, refine requirements, regenerate
  4. Keywords: Include target keywords in topic/description
  5. Audience: Match style to target audience

WordPress Publishing

  1. Test First: Always publish as draft first
  2. Review Content: Check formatting in WordPress editor
  3. Create Terms: Create categories/tags before publishing
  4. Featured Images: Use high-quality, relevant images
  5. SEO Check: Review and adjust SEO metadata

Project Generation

  1. Clear Requirements: List specific features needed
  2. Example Code: Reference similar projects
  3. Technical Details: Specify libraries, frameworks
  4. Complexity: Start simple, iterate to advanced
  5. Documentation: Enable all documentation options

Performance

  1. Cache Results: Generated content persists in session
  2. Batch Operations: Generate multiple pieces separately
  3. Monitor Limits: Watch API usage on free tiers
  4. Optimize Prompts: Shorter prompts = faster generation

🤝 Contributing

Contributions welcome! Areas for improvement:

  • Add real AI image generation (DALL-E, Stable Diffusion)
  • Support for more CMS platforms (Ghost, Medium, etc.)
  • Bulk content generation
  • Content scheduling
  • Multi-language support
  • Custom templates
  • Analytics integration
  • Social media posting
  • Content optimization suggestions
  • A/B testing for headlines

📝 License

This project is licensed under the MIT License.

⚠️ Disclaimer

This software is for content creation and automation purposes. Users are responsible for:

  • Compliance with WordPress terms of service
  • Content accuracy and originality
  • Proper attribution and citations
  • Copyright compliance
  • SEO best practices
  • API key security

The AI-generated content should be reviewed and edited before publishing.

🙏 Acknowledgments

  • Google Gemini AI: Content generation engine
  • Streamlit: Web application framework
  • WordPress: Content management system
  • Markdown: Content formatting
  • Python: Core programming language

📞 Support

🗺️ Roadmap

Current (v2.1.0)

  • Content generation with Gemini AI
  • Project generation (9 types)
  • WordPress publishing (self-hosted & .com)
  • SEO optimization
  • Featured image upload
  • Categories & tags support

Next (v2.2.0)

  • Real AI image generation integration
  • Content templates
  • Bulk publishing
  • Post scheduling
  • Analytics dashboard

Future (v3.0.0)

  • Multi-CMS support
  • Social media integration
  • Team collaboration
  • Custom AI training
  • Mobile app

💻 Quick Start Example

# 1. Start the app
streamlit run app.py

# 2. In the browser:
#    - Add Gemini API key in sidebar
#    - Configure WordPress (optional)
#    - Click "Test WordPress Connection"

# 3. Generate Content:
#    - Go to "Content & Project Creation" tab
#    - Enter topic: "Getting Started with Python"
#    - Select: Blog Post, Professional, Beginners, 1200-2000 words
#    - Add description: "Cover installation, first program, variables"
#    - Click "Generate Content"

# 4. Publish:
#    - Go to "Publishing" tab
#    - Review SEO metadata
#    - Select WordPress status: draft
#    - Choose categories and tags
#    - Click "Publish Post to WordPress"

# 5. Done!
#    - View published post URL
#    - Edit in WordPress admin
#    - Check results in "Results" tab

Made with ❤️ for content creators and developers

🚀 Create professional content and code with AI

About

THis is to generate contents

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages