Skip to content

imagewize/elayne-ai-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Elayne AI Test Plugin

A WordPress 7.0 plugin that demonstrates the WP AI Client integration with Elayne block patterns.

Overview

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

Features

Core Functionality

  • 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

Abilities API (WP 7.0)

  • elayne/list-patterns: List all Elayne patterns with filtering
  • elayne/create-page: Create pages from pattern slugs

AI Integration

  • Supports Mistral, Claude, OpenAI, and Gemini providers
  • Smart pattern selection with business rules
  • JSON schema validation for AI responses

Requirements

  • WordPress 7.0 or later
  • PHP 8.0+
  • Composer for dependency management

Installation

1. Install Dependencies

composer require saarnilauri/ai-provider-for-mistral

2. Configure Mistral API Key

Create a .env file in your project root:

MISTRAL_API_KEY=your_api_key_here

3. Activate Plugin

Upload the plugin to your WordPress installation and activate it.

Usage

Admin Interface

Access the plugin at Tools → Elayne AI Test in the WordPress admin.

AI Page Generation

  1. Enter a description of the page you want to create
  2. Click "Generate Page"
  3. The AI will select appropriate patterns and create a draft

Manual Page Creation

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'
  })
});

Pattern Format

Patterns are identified by slugs in the format elayne/{name}.

Pattern Metadata

Each pattern includes:

  • slug: Unique identifier
  • title: Human-readable name
  • description: Purpose of the pattern
  • categories: Pattern categories (e.g., 'hero', 'features', 'cta')
  • keywords: Search keywords for discovery

Development

Testing

The plugin includes status indicators for:

  • WP AI Client availability
  • Abilities API support
  • Mistral provider loading
  • API key configuration
  • Pattern registration

Debugging

Check the admin interface for status notices and error messages.

Notes

  • 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

About

Elayne AI Demo

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages