A WordPress 7.0 plugin that demonstrates the WP AI Client integration with Elayne block patterns.
This plugin provides:
- AI-powered page generation using Elayne block patterns
- Abilities API integration for pattern management
- Mistral AI provider support via Composer
- Admin interface for testing and pattern discovery
- Pattern Discovery: Lists all registered Elayne patterns with metadata
- AI Page Generation: Uses AI to select appropriate patterns based on user description
- Page Assembly: Creates WordPress pages from ordered pattern slugs
elayne/list-patterns: List all Elayne patterns with filteringelayne/create-page: Create pages from pattern slugs
- Supports Mistral, Claude, OpenAI, and Gemini providers
- Smart pattern selection with business rules
- JSON schema validation for AI responses
- WordPress 7.0 or later
- PHP 8.0+
- Composer for dependency management
composer require saarnilauri/ai-provider-for-mistralCreate a .env file in your project root:
MISTRAL_API_KEY=your_api_key_hereUpload the plugin to your WordPress installation and activate it.
Access the plugin at Tools → Elayne AI Test in the WordPress admin.
- Enter a description of the page you want to create
- Click "Generate Page"
- The AI will select appropriate patterns and create a draft
Use the Abilities API to programmatically create pages:
// Example using REST API
const response = await fetch('/wp-json/wp/v2/abilities/elayne/create-page', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
title: 'My New Page',
patterns: ['elayne/hero-two-tone', 'elayne/features-grid'],
status: 'draft'
})
});Patterns are identified by slugs in the format elayne/{name}.
Each pattern includes:
slug: Unique identifiertitle: Human-readable namedescription: Purpose of the patterncategories: Pattern categories (e.g., 'hero', 'features', 'cta')keywords: Search keywords for discovery
The plugin includes status indicators for:
- WP AI Client availability
- Abilities API support
- Mistral provider loading
- API key configuration
- Pattern registration
Check the admin interface for status notices and error messages.
- This is a demo plugin for testing purposes only
- Not recommended for production use
- Mistral provider uses Composer autoloading, not the WordPress connector UI
- Requires WordPress 7.0+ for Abilities API support