diff --git a/allPlugins.json b/allPlugins.json index f217b4db..e03e9454 100644 --- a/allPlugins.json +++ b/allPlugins.json @@ -17,6 +17,13 @@ "metaImage": "img/social/calendar-craft.jpg", "metaDescription": "Calendar is an effective event management and calendaring plugin. Its user-friendly interface simplifies the creation of events with complex recurring rules and exclusions." }, + { + "name": "AI Assistant", + "slug": "/craft/ai-assistant", + "latestVersionSlug": "/craft/ai-assistant/v1", + "metaImage": "img/social/ai-assistant-craft.jpg", + "metaDescription": "AI Assistant is a plugin that helps you create content with AI. It's a tool that helps you create content with AI." + }, { "name": "Express Forms", "slug": "https://discontinued-docs.solspace.com/express-forms", diff --git a/craft-ai-assistant/configuration/_category_.json b/craft-ai-assistant/configuration/_category_.json new file mode 100644 index 00000000..d3571879 --- /dev/null +++ b/craft-ai-assistant/configuration/_category_.json @@ -0,0 +1,5 @@ +{ + "label": "Configuration", + "position": 3 +} + diff --git a/craft-ai-assistant/configuration/integrations.mdx b/craft-ai-assistant/configuration/integrations.mdx new file mode 100644 index 00000000..7a51e41f --- /dev/null +++ b/craft-ai-assistant/configuration/integrations.mdx @@ -0,0 +1,37 @@ +--- +sidebar_position: 2 +--- + +# Integrations + +AI Assistant supports multiple AI providers. Configure your integrations to enable AI-powered content generation. + +## Supported Providers + +- **OpenAI** - GPT models (GPT-4, GPT-3.5, etc.) +- **Google Gemini** - Gemini models +- **Anthropic** - Claude models +- **xAI** - Grok models +- **Replicate** - Various AI models + +## Setting Up an Integration + +1. Go to **AI Assistant → Integrations** +2. Click **New Integration** +3. Choose provider (OpenAI, Gemini, Anthropic, xAI, Replicate) +4. Set API key, model, and defaults +5. Save and test + +## Integration Settings + +Each integration can be configured with: + +- **Enable/Disable** - Toggle the integration on or off +- **API Key** - Your provider's API key +- **Model Selection** - Choose which model to use +- **Default Settings** - Set default parameters for the integration + +## Testing Integrations + +After configuring an integration, you can test it using the Quick AI Actions widget or by using the inline AI button on any enabled field. + diff --git a/craft-ai-assistant/configuration/prompts.mdx b/craft-ai-assistant/configuration/prompts.mdx new file mode 100644 index 00000000..54b2fa24 --- /dev/null +++ b/craft-ai-assistant/configuration/prompts.mdx @@ -0,0 +1,32 @@ +--- +sidebar_position: 3 +--- + +# Prompts + +Prompts are the instructions you give to the AI to generate content. AI Assistant includes built-in prompts and allows you to create custom prompts. + +## Built-in Prompts + +AI Assistant comes with several built-in prompts for common content generation tasks. These prompts are ready to use and can be customized. + +## Custom Prompts + +1. Go to **AI Assistant → Prompts** +2. Click **New Prompt** +3. Enter a name and prompt text +4. Optionally bind the prompt to a specific integration +5. Set sort order +6. Save + +## Prompt Binding + +You can bind a prompt to a specific integration. When a prompt is bound to an integration: + +- That integration will be used automatically when the prompt is selected +- The prompt will only appear when that integration is enabled + +## Sort Order + +Prompts can be ordered to appear in your preferred sequence. Set a sort order value (lower numbers appear first) to organize your prompts. + diff --git a/craft-ai-assistant/configuration/settings.mdx b/craft-ai-assistant/configuration/settings.mdx new file mode 100644 index 00000000..00449135 --- /dev/null +++ b/craft-ai-assistant/configuration/settings.mdx @@ -0,0 +1,34 @@ +--- +sidebar_position: 1 +--- + +# Settings + +AI Assistant settings allow you to configure which fields show the inline AI button and set up field-specific prompts. + +## Field Enablement + +1. Go to **AI Assistant → Settings** +2. Toggle which fields show the inline AI button +3. Save + +## 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 + +### Behavior on Entry Edit Pages + +- When you click the inline AI button, the modal will auto-select the field's prompt. +- This works for Craft fields (Plain Text, CKEditor, Redactor, TinyMCE, Assets) and for the built-in Title field (handle `title`). +- For Title specifically, the modal reads the selection from plugin settings, so it's honored even though Title isn't a custom Craft field. + +### Notes + +- Choosing "Any" means the modal won't preselect a specific prompt. +- If a prompt is bound to a particular integration, that integration is used automatically; otherwise the selected integration is used. +- Changes you make to the selected prompt inside an entry are not saved back to Settings; edit the mapping in **AI Assistant → Settings**. + diff --git a/craft-ai-assistant/guides/_category_.json b/craft-ai-assistant/guides/_category_.json new file mode 100644 index 00000000..1d5975db --- /dev/null +++ b/craft-ai-assistant/guides/_category_.json @@ -0,0 +1,5 @@ +{ + "label": "User Guides", + "position": 4 +} + diff --git a/craft-ai-assistant/guides/getting-started.mdx b/craft-ai-assistant/guides/getting-started.mdx new file mode 100644 index 00000000..859f05d9 --- /dev/null +++ b/craft-ai-assistant/guides/getting-started.mdx @@ -0,0 +1,88 @@ +--- +sidebar_position: 1 +--- + +# 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. + diff --git a/craft-ai-assistant/intro.mdx b/craft-ai-assistant/intro.mdx new file mode 100644 index 00000000..3d574980 --- /dev/null +++ b/craft-ai-assistant/intro.mdx @@ -0,0 +1,247 @@ +--- +sidebar_position: 1 +title: 'Overview' +slug: / +hide_table_of_contents: true +id: landing-page +--- + +import Player from 'react-player'; +import { FlexCards, Section } from '@site/src/components/docs'; +import SearchBar from '@theme/SearchBar'; +import NavbarSearch from '@theme/Navbar/Search'; + +import Icons from '@site/static/icons/cards'; +import OldIcons from '@site/static/icons/old'; +import { + Photo, + PrimaryButtonWithLink, + SimpleTextLink, + FlexButton, +} from '@site/src/components/utils'; + +# Overview + +
+
+
+ + for + +

+ AI-powered content assistance for Craft CMS with prompt management, multiple providers, and a rich in-field workflow. +

+
+ + + + + +
+ + + +
+
+
+ +
+
Docs
+
+ +
+
+ +
+ + + +## Key Features + +AI Assistant is loaded with features that make AI-powered content creation seamless and powerful. + + + +## Current Functionality + +AI Assistant provides a comprehensive set of features for AI-powered content creation: + +- [x] Inline AI button on supported fields (Title, Plain Text, CKEditor, Redactor, TinyMCE) +- [x] Two-column modal (Input Context left, Generated Text right) with rich HTML rendering +- [x] Lightswitch to include/exclude input context in the prompt +- [x] Correct HTML handling for CKEditor, TinyMCE, and Redactor when inserting back into the field +- [x] Prompt management (built-in and custom) with integration binding and sort order +- [x] Field-specific prompts per field with automatic modal preselection +- [x] Integration management for OpenAI, Google Gemini, Anthropic, xAI, and Replicate (enable/disable, API keys, model selection) +- [x] Quick AI Actions dashboard widget (select prompt, editable prompt text, generate, copy) +- [x] Craft-native UI components (lightswitch, notices), event-based widget registration +- [x] Responsive, larger modal with dynamic body height +- [x] Image generation for Assets fields + + +## Upcoming Features + +- [ ] Per-site settings and field rules +- [ ] Prompt variables and templating +- [ ] Batch content processing +- [ ] Analytics dashboard +- [ ] SEO content assistant +- [ ] Commerce integration +- [ ] Multi-language support + +## Package Information + +- **Package:** `solspace/craft-aiassistant` +- **Namespace:** `Solspace\AIAssistant` + +## Requirements + +- Craft CMS 5+ +- PHP 8.0+ +- Valid API key(s) for configured providers + +
+ +
+
+

Start exploring AI Assistant...

+

Check out these helpful links.

+
+ +
+
+ +
+ diff --git a/craft-ai-assistant/setup/_category_.json b/craft-ai-assistant/setup/_category_.json new file mode 100644 index 00000000..77a30a26 --- /dev/null +++ b/craft-ai-assistant/setup/_category_.json @@ -0,0 +1,5 @@ +{ + "label": "Installing & Updating", + "position": 2 +} + diff --git a/craft-ai-assistant/setup/changelog.mdx b/craft-ai-assistant/setup/changelog.mdx new file mode 100644 index 00000000..aa6f3198 --- /dev/null +++ b/craft-ai-assistant/setup/changelog.mdx @@ -0,0 +1,24 @@ +--- +sidebar_position: 2 +--- + +# Changelog + +All notable changes to AI Assistant will be documented here. + +## Version 1.0.0 + +### Added + +- Initial release +- Inline AI button on supported fields (Title, Plain Text, CKEditor, Redactor, TinyMCE) +- Two-column modal (Input Context left, Generated Text right) with rich HTML rendering +- Lightswitch to include/exclude input context in the prompt +- Correct HTML handling for CKEditor, TinyMCE, and Redactor when inserting back into the field +- Prompt management (built-in and custom) with integration binding and sort order +- Field-specific prompts per field with automatic modal preselection +- Integration management for OpenAI, Google Gemini, Anthropic, xAI, and Replicate (enable/disable, API keys, model selection) +- Quick AI Actions dashboard widget (select prompt, editable prompt text, generate, copy) +- Craft-native UI components (lightswitch, notices), event-based widget registration +- Responsive, larger modal with dynamic body height + diff --git a/craft-ai-assistant/setup/installing-updating.mdx b/craft-ai-assistant/setup/installing-updating.mdx new file mode 100644 index 00000000..5da718d1 --- /dev/null +++ b/craft-ai-assistant/setup/installing-updating.mdx @@ -0,0 +1,78 @@ +--- +sidebar_position: 1 +--- + +import { FlexCards } from '@site/src/components/docs'; +import Icons from '@site/static/icons/cards'; + +# Installing & Updating + + + +## Requirements + +AI Assistant requires: + +**Craft CMS compatibility:** + +- **Craft CMS 4.x or 5.x (4.0.0+ / 5.0.0+)** +- **PHP 8.0+** +- Valid API key(s) for configured providers (OpenAI, Google Gemini, Anthropic, xAI, or Replicate) + +## Installation + +AI Assistant can be installed one of two ways: + +### Via Composer + +1. Require the package: + + ```bash + 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** + +### Via Plugin Store + +1. Go to **Plugin Store** in your Craft control panel +2. Search for "AI Assistant" +3. Click **Install** +4. Configure providers in **AI Assistant → Integrations** +5. Enable fields in **AI Assistant → Settings** + +## Updating + +To update AI Assistant: + +1. Run `composer update solspace/craft-aiassistant` in your terminal +2. Or update via the Plugin Store in your Craft control panel + +After updating, clear your caches and check the changelog for any breaking changes. diff --git a/docsTag.json b/docsTag.json index cd59b1c0..9246d8ff 100644 --- a/docsTag.json +++ b/docsTag.json @@ -43,6 +43,12 @@ "id": "docs-craft-calendar-v1" } ], + "/craft/ai-assistant": [ + { + "version": "v1", + "id": "docs-craft-ai-assistant-current" + } + ], "/expressionengine/freeform": [ { "version": "v3", diff --git a/docusaurus.config.ts b/docusaurus.config.ts index a3a4cbc3..c8f32590 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -225,6 +225,25 @@ const config: Config = { }, }, ], + [ + '@docusaurus/plugin-content-docs', + { + id: 'craft-ai-assistant', + path: 'craft-ai-assistant', + routeBasePath: '/craft/ai-assistant', + editUrl: 'https://github.com/solspace/documentation/edit/main', + sidebarPath: './sidebars.ts', + sidebarCollapsed: false, + lastVersion: 'current', + versions: { + current: { + label: '1.x', + path: 'v1', + badge: false, + }, + }, + }, + ], [ '@docusaurus/plugin-content-docs', { @@ -335,6 +354,11 @@ const config: Config = { docsPluginId: 'craft-calendar', position: 'left', }, + { + type: 'docsVersionDropdown', + docsPluginId: 'craft-ai-assistant', + position: 'left', + }, { type: 'docsVersionDropdown', docsPluginId: 'ee-freeform', diff --git a/src/pages/craft/index.tsx b/src/pages/craft/index.tsx index fe3d109f..1add8041 100644 --- a/src/pages/craft/index.tsx +++ b/src/pages/craft/index.tsx @@ -30,6 +30,11 @@ export default function Craft(): JSX.Element { icon: Icons.CalendarIcon, fullCardLink: '/craft/calendar/v5', }, + { + title: 'AI Assistant', + icon: Icons.AIIcon, + fullCardLink: '/craft/ai-assistant/v1', + }, { title: 'Express Forms', icon: Icons.ExpressFormsIcon, diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 2b56cfd1..af18320d 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -52,6 +52,11 @@ export default function Home(): JSX.Element { icon: Icons.CalendarIcon, fullCardLink: 'craft/calendar/v5', }, + { + title: 'AI Assistant', + icon: Icons.AIAssistantIcon, + fullCardLink: 'craft/ai-assistant/v1', + }, { title: 'Express Forms', icon: Icons.ExpressFormsIcon, diff --git a/src/theme/Logo/index.tsx b/src/theme/Logo/index.tsx index 2f73341e..155659f8 100644 --- a/src/theme/Logo/index.tsx +++ b/src/theme/Logo/index.tsx @@ -33,6 +33,14 @@ const logos: LogoItem[] = [ logoLineShort: null, src: 'logos/icons/calendar.png', }, + { + pathname: '/craft/ai-assistant', + latestVersionSlug: '/craft/ai-assistant/v1', + title: 'AI Assistant', + logoLine: 'for Craft', + logoLineShort: null, + src: 'logos/icons/ai.png', + }, { pathname: 'https://discontinued-docs.solspace.com/express-forms/', title: 'Express Forms', diff --git a/static/icons/cards/ai-assistant.svg b/static/icons/cards/ai-assistant.svg new file mode 100644 index 00000000..61f7f562 --- /dev/null +++ b/static/icons/cards/ai-assistant.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/icons/cards/index.ts b/static/icons/cards/index.ts index e79ccb88..4e67e111 100644 --- a/static/icons/cards/index.ts +++ b/static/icons/cards/index.ts @@ -1,4 +1,5 @@ export default { + AIAssistantIcon: 'ai-assistant', AIIcon: 'ai', AISpamIcon: 'ai-spam', AlarmIcon: 'alarm', diff --git a/static/img/favicon.ico b/static/img/favicon.ico index d802c6c3..05ce25bf 100644 Binary files a/static/img/favicon.ico and b/static/img/favicon.ico differ diff --git a/static/img/intro/aiassistant-dark.png b/static/img/intro/aiassistant-dark.png new file mode 100644 index 00000000..89c26b59 Binary files /dev/null and b/static/img/intro/aiassistant-dark.png differ diff --git a/static/img/intro/aiassistant-light.png b/static/img/intro/aiassistant-light.png new file mode 100644 index 00000000..08e2060c Binary files /dev/null and b/static/img/intro/aiassistant-light.png differ diff --git a/static/logos/icons/ai.png b/static/logos/icons/ai.png new file mode 100644 index 00000000..b6343662 Binary files /dev/null and b/static/logos/icons/ai.png differ diff --git a/vercel.json b/vercel.json index b7599bfb..259e5a49 100644 --- a/vercel.json +++ b/vercel.json @@ -41,6 +41,14 @@ { "destination": "/craft/freeform/v5/templates/caching/", "source": "/craft/freeform/v5/guides/guide/caching-forms/" + }, + { + "destination": "/craft/ai-assistant/v1/", + "source": "/craft/ai-assistant" + }, + { + "destination": "/craft/ai-assistant/v1/", + "source": "/craft/ai-assistant/" } ] } diff --git a/versionsBadge.json b/versionsBadge.json index edca884f..1a8d1df3 100644 --- a/versionsBadge.json +++ b/versionsBadge.json @@ -11,6 +11,10 @@ { "version": "v2", "badge": "Retired" }, { "version": "v1", "badge": "Retired" } ], + "/craft/ai-assistant": [ + { "version": "current", "badge": "Latest" }, + { "version": "v1", "badge": "Latest" } + ], "/craft/express-forms": [ { "version": "v2", "badge": "Discontinued" }, { "version": "v1", "badge": "Retired" }