EasyAdminBundle icon indicating copy to clipboard operation
EasyAdminBundle copied to clipboard

[Feature Request] AI-Powered Field Assistants for Content Generation ✨

Open ahmed-bhs opened this issue 3 months ago • 1 comments

Summary

Add optional AI assistance to EasyAdmin fields to automatically generate content (slugs, meta descriptions, summaries, translations, etc.) directly from the admin interface with a simple button click.

Problem & Motivation

When managing content in EasyAdmin (blog posts, products, pages), administrators spend significant time on repetitive, predictable tasks:

  • ✍️ Writing SEO-friendly slugs from titles
  • 📝 Creating meta descriptions from content
  • 📄 Generating summaries or excerpts
  • 🖼️ Writing alt text for images
  • 🌍 Translating content contextually
  • 🏷️ Selecting appropriate tags/categories

These tasks are:

  • Time-consuming (10-15 min per entity)
  • Follow predictable patterns
  • Require consistent quality
  • Perfect candidates for AI assistance

Real-world impact:

  • A blog with 100 articles: ~25 hours spent on these tasks
  • An e-commerce site with 500 products: ~80 hours
  • Multilingual sites: Thousands of euros in translation costs

✨ Proposed Solution

Add an AI Assistant feature integrated directly into EasyAdmin fields using a declarative, developer-friendly API.

Quick Example

use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextareaField;

public function configureFields(string $pageName): iterable
{
    yield TextField::new('title');
    
    // AI-powered slug generation
    yield TextField::new('slug')
        ->setAiAssistant(
            prompt: 'Generate a SEO-friendly slug from: {title}',
            sourceFields: ['title'],
            maxLength: 100
        );
    
    yield TextareaField::new('content');
    
    // AI-powered meta description
    yield TextField::new('metaDescription')
        ->setAiAssistant(
            prompt: 'Write a compelling meta description (max 160 chars) for: {content}',
            sourceFields: ['content'],
            maxLength: 160
        );
}

User Experience

  1. Visual indicator: A small ✨ button appears next to AI-enabled fields
  2. One-click generation: Click the button to generate content
  3. Preview & validate: See the AI-generated content before accepting
  4. Manual override: Users can always edit or regenerate

Visual mockup:

Image

Technical Architecture

1. Field Configuration API

// New method in FieldTrait
public function setAiAssistant(
    string $prompt,                    // AI prompt with {field} placeholders
    array $sourceFields = [],          // Fields to use as context
    ?int $maxLength = null,           // Output length limit
    ?float $temperature = null,        // Creativity level (0.0-1.0)
    ?string $provider = null,          // Override default AI provider
    bool $autoGenerate = false,        // Auto-generate on entity save
    ?string $buttonLabel = null,       // Custom button text
    ?string $buttonIcon = null,        // Custom button icon
    ?string $resultType = 'string',    // string|array|number|choice
    bool $allowUserPrompt = false,     // 🆕 Allow user to customize prompt
    ?string $promptPlaceholder = null, // 🆕 Placeholder for user prompt input
): self;

2. Backend Integration

Leverages Symfony AI component:

  • Multi-provider support (OpenAI, Anthropic, Mistral, Ollama)
  • Type-safe interfaces
# config/packages/easy_admin.yaml
easy_admin:
    ai_assistant:
        enabled: true
        default_provider: openai  # Uses Symfony AI configuration
        
        defaults:
            temperature: 0.7
            max_tokens: 200
            cache_ttl: 3600
        
        rate_limit:
            enabled: true
            max_requests_per_hour: 100

New components:

  • AiAssistantConfigurator - Field configurator for AI-enabled fields
  • AiAssistantController - AJAX endpoint for generation requests
  • AiAssistantService - Business logic with caching and rate limiting
  • Stimulus controller - Frontend interactions

Similar Implementations

This pattern is proven and widely adopted:

  • WordPress: Jetpack AI Assistant, Yoast AI
  • Shopify: Product description generator

All use similar "suggest → preview → accept" flow.

I'm flexible and open to feedback! The goal is to add value to EasyAdmin while maintaining its simplicity and elegance. I believe AI-powered field assistants could significantly enhance EasyAdmin's value proposition while staying true to its philosophy of being developer-friendly and user-friendly.

ahmed-bhs avatar Oct 16 '25 19:10 ahmed-bhs

We have built such features for most of our EasyAdmin applications; we could work something out and release it on our own.

bytes-commerce avatar Nov 13 '25 23:11 bytes-commerce