Skip to main content

Getting Started

This guide will help you get started with AI Assistant for Craft CMS.

Installation

  1. Require the package: composer require solspace/craft-aiassistant
  2. In Craft CP → Plugins, install "AI Assistant"
  3. Configure providers in AI Assistant → Integrations
  4. Enable fields in AI Assistant → Settings

Configuration

Setting Up Integrations

  1. Go to AI Assistant → Integrations
  2. Click New Integration
  3. Choose provider (OpenAI, Gemini, Anthropic, xAI, Replicate), set API key, model, and defaults
  4. Save and test

Enabling Fields

  1. Go to AI Assistant → Settings
  2. Toggle which fields show the inline AI button
  3. Save

Configuring Prompts

  1. Go to AI Assistant → Prompts
  2. Create custom prompts or view built-in prompts
  3. Optionally bind a prompt to a specific integration

Field-Specific Prompts

You can preselect a prompt for each enabled field so the Generate modal opens with the right context:

  1. Go to AI Assistant → Settings
  2. In the "Field Prompts" table, choose a prompt per field (or keep "Any")
  3. Save Settings

Usage

Using the Inline AI Button

  1. Open any entry with enabled fields; an inline AI button appears inside the input area
  2. Click the button to open the modal
  3. Pick a prompt, edit "Prompt Text" as needed
  4. Optionally enable "Include input context"
  5. Generate and review in the right column; Insert replaces the field's content

Quick AI Actions Widget

  • Add the "AI Assistant Quick Actions" widget on the dashboard
  • Select a prompt, edit "Prompt Text," Generate, and Copy as needed

API Endpoints

  • GET /admin/ai-assistant/api/integrations
  • GET /admin/ai-assistant/api/prompts
  • POST /admin/ai-assistant/api/generate-text
  • POST /admin/ai-assistant/api/generate-image (coming soon)

File Structure

aiassistant/
├── src/
│ ├── assets/ # JS/CSS + AssetBundle
│ ├── controllers/ # CP + API endpoints
│ ├── models/ # Integration, Prompt, Settings
│ ├── records/ # ActiveRecord for DB tables
│ ├── services/ # Business logic + helpers
│ ├── Integrations/ # Providers (OpenAI, Gemini, …)
│ ├── templates/ # Twig (modal, widget, CP screens)
│ ├── AiAssistant.php # Main plugin class
│ ├── icon-mask.svg
│ └── icon.svg
└── composer.json

Support

For issues and feature requests, please contact Solspace.