Skip to content

About

AI Content Factory provides a workflow for generating Drupal content with AI. It supports bulk content creation, editorial review, and automated background processing. This repository is a mirror of the Drupal module's repository: https://git.drupalcode.org/project/ai_content_factory

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

91 Commits

Folders and files

Repository files navigation

AI Content Factory

AI Content Factory provides a workflow for generating Drupal content with AI. It supports bulk content creation, editorial review, and automated background processing, managing each item from its initial title through generation and publication.

Table of contents

  • Requirements
  • Installation
  • Configuration
  • Features
  • Security
  • Troubleshooting
  • FAQ
  • Tested models
  • Support

Requirements

  • AI - provides the provider abstraction layer and site-level AI configuration.
  • Drupal Core ^11
  • At least one configured AI provider (e.g. OpenAI, Anthropic, OpenRouter) set up through the AI module's provider settings.

Installation

Install as you would normally install a contributed Drupal module. For further information, see Installing Drupal Modules.

Configuration

  1. Enable the module at Administration » Extend.

  2. Configure at least one AI provider under Administration » Configuration » AI and set a site default provider.

  3. Navigate to Administration » Configuration » Content authoring » AI Content Factory to configure global defaults (execution mode, queue limits, provider guardrails, debug retention).

  4. Navigate to Administration » Content » AI Content Factory » Profiles and create one or more generation profiles. Each profile defines:

    • Target entity type and bundle (e.g. node/article).
    • AI provider and model (or use the site default).
    • System and user prompts for title and content generation.
    • Field mappings that tell the AI which fields to populate and how.
    • Execution mode: Supervised (items start as draft, require manual queueing) or Automatic (items are queued immediately).
    • Publication mode: Draft or Auto-publish.
  5. Assign permissions to the appropriate roles:

    Permission Purpose
    Administer AI Content Factory Global settings and administration
    Manage AI Content Factory profiles Create, edit, and delete profiles
    Manage AI Content Factory queue Create and manage queue items
    Run AI Content Factory batches Trigger manual or automated runs
    View AI Content Factory diagnostics Access prompt/payload diagnostics

Features

Generation profiles

Config entities that encapsulate every parameter needed to generate a content item: target bundle, AI provider and model, system and user prompts for titles and body content, field mappings, word count target, execution mode, publication mode, and optional paragraph field targeting.

Content queue

A managed queue of ai_content_factory_queue_item content entities. Each item moves through the following statuses:

draft → queued → processing → completed / failed

Items can be created manually, or in bulk via the Generate Titles form. The queue list at Administration » Content » AI Content Factory » Content queue supports filtering and bulk batch operations.

Title generation

The Generate Titles form (Administration » Content » AI Content Factory » Generate Titles) accepts either a free-form list of titles or a prompt that asks the AI to suggest titles. Each accepted title becomes a queue item ready for full content generation.

Execution modes

  • Supervised - items are saved as drafts and only queued when an editor explicitly promotes them. Suitable for reviewing titles before committing to a full generation run.
  • Automatic - items are queued immediately on creation for unattended background processing via cron.

Background processing

Cron processes queued items up to the configured worker item limit. A manual batch run can also be started from the queue admin page without waiting for cron. A configurable lock scope prevents concurrent background workers from colliding on the same items.

Provider execution guardrails

  • Configurable transient retry count and exponential backoff for rate-limit and timeout errors.
  • Shared per-provider/model cooldown stored in expirable key-value storage so both cron and manual runs respect the same throttle window.
  • A separate browser request timeout cap keeps manual browser-driven runs within web-tier limits.

Paragraph field support

When paragraph targeting is enabled in settings, profiles can map generated content directly into paragraph fields on the target entity.

Diagnostics and debug mode

An optional debug mode retains raw prompt snapshots, generated payloads, and run logs on queue items. Retention is configurable (failed items only, all items, or none) and expires after a configurable number of days. Raw diagnostics are gated behind a dedicated view ai content factory diagnostics permission.

Security

  • The administer ai content factory and view ai content factory diagnostics permissions are marked restrict access: true. Grant them only to trusted roles.
  • Debug mode stores raw prompts and generated payloads. Do not enable it on production sites that process sensitive editorial content unless the diagnostics permission is tightly controlled.
  • Provider API keys are managed by the AI module and are never stored in queue items or profiles.
  • AI-generated content is not published automatically unless a profile is explicitly configured with the Auto-publish publication mode.

Troubleshooting

Queue items stay in "processing" status after a failure

A crashed worker may leave items locked. Check the Drupal watchdog log (admin/reports/dblog) filtered to the ai_content_factory channel for the failure reason. Items can be reset to queued from the queue admin edit form.

Generation times out in the browser

Browser-driven runs (manual batch, title generation) are subject to the Browser request timeout cap in settings (default 45 s) and the web server's own timeout. Increase the cap, or run generation through cron which is not subject to web-tier timeouts. Ensure the Drupal AI module's global request timeout is also set high enough for your provider and model.

Provider returns rate-limit errors

Increase Maximum shared cooldown wait and Transient retry attempts in Administration » Configuration » Content » AI Content Factory. Background workers automatically requeue rate-limited items; browser runs will surface a retry-later message.

Generated content is not published

Check the profile's Publication mode. The default is Draft. Switch to Auto-publish only if the target bundle has no content moderation workflow, or if a published moderation transition is available to the generation process.

FAQ

Q: Can I use different AI providers for different content types?

A: Yes. Each profile has its own provider and model configuration. Set use_default to false on a profile and select the provider and model you want for that content type.

Q: Can I generate content in multiple languages?

A: Queue items carry a language code. Create separate queue items (or bulk title submissions) for each target language. The generated entity is saved in the language specified on the item.

Tested models

The following OpenRouter models have been tested with this module. Use the OpenRouter provider from the AI module and enter the model identifier exactly as shown.

Model Pros Cons
google/gemini-3.1-flash-lite-preview Fastest response times; very low cost; good for high-volume queue runs Lower output quality; less reliable on complex field mappings
perplexity/sonar Strong factual accuracy due to search grounding; good for knowledge-heavy content Slower than flash models; higher cost; not ideal for purely creative content
x-ai/grok-4.3 High quality output; strong instruction following; good for complex prompts Higher cost; slower than fast variants
x-ai/grok-4.1-fast Good balance of speed and quality; suitable for supervised batch runs Slightly lower quality than grok-4.3 on nuanced content
google/gemini-3.5-flash Well-rounded quality and speed; reliable field mapping compliance Mid-range cost; occasionally verbose on short-form fields
google/gemini-2.5-flash-lite Fast and cheap; good for title generation and lightweight content Weaker on long-form structured content
deepseek/deepseek-v4-flash Very cost-effective; fast; good multilingual support May require more explicit prompt instructions for structured output
deepseek/deepseek-v3.2 Strong reasoning and long-form quality; good for detailed content profiles Higher latency; best suited for cron-based background runs

Support

Submit bug reports and feature suggestions, or track changes in the issue queue.

About

AI Content Factory provides a workflow for generating Drupal content with AI. It supports bulk content creation, editorial review, and automated background processing. This repository is a mirror of the Drupal module's repository: https://git.drupalcode.org/project/ai_content_factory

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages