You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,7 +39,7 @@ This [Canonical Plugin](https://make.wordpress.org/core/2022/09/11/canonical-plu
39
39
***[Content Summarization](docs/experiments/summarization.md)** - Summarizes long-form content into digestible overviews.
40
40
***[Excerpt Generation](docs/experiments/excerpt-generation.md)** - Generates excerpt suggestions from content.
41
41
***Experiment Framework** - Opt-in system that lets you enable only the AI features you want to use.
42
-
***[Image Generation and Editing](docs/experiments/image-generation.md)** - Create and edit images from post content in the editor, also via the Media Library.
42
+
***[Image Generation and Editing](docs/features/image-generation.md)** - Create and edit images from post content in the editor, also via the Media Library.
43
43
***[Meta Description Generation](docs/experiments/meta-description.md)** - Generates meta description suggestions and integrates those with various SEO plugins.
44
44
***Multi-Provider Support** - Works with popular AI providers like OpenAI, Google, and Anthropic.
45
45
***[Review Notes](docs/experiments/review-notes.md)** - Reviews post content block-by-block and adds Notes with suggestions for Accessibility, Readability, Grammar, and SEO.
Copy file name to clipboardExpand all lines: docs/features/image-generation.md
+27-27Lines changed: 27 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,13 +2,13 @@
2
2
3
3
## Summary
4
4
5
-
The Image Generation experiment adds AI-powered image generation to the WordPress post editor in two ways: **featured images** (from the featured image panel) and **inline images** (from supported blocks). It provides a "Generate featured image" button in the featured image panel and a "Generate Image" buttons on Image, Cover, Media & Text, and Gallery blocks. The experiment registers three WordPress Abilities (`ai/image-generation`, `ai/image-import`, `ai/image-prompt-generation`) that can be used both through the admin UI and directly via REST API requests.
5
+
The Image Generation feature adds AI-powered image generation to the WordPress post editor in two ways: **featured images** (from the featured image panel) and **inline images** (from supported blocks). It provides a "Generate featured image" button in the featured image panel and a "Generate Image" buttons on Image, Cover, Media & Text, and Gallery blocks. The feature registers three WordPress Abilities (`ai/image-generation`, `ai/image-import`, `ai/image-prompt-generation`) that can be used both through the admin UI and directly via REST API requests.
6
6
7
7
## Overview
8
8
9
9
### For End Users
10
10
11
-
When enabled, the Image Generation experiment adds:
11
+
When enabled, the Image Generation feature adds:
12
12
13
13
-**Featured image panel:** A "Generate featured image" button that creates AI images from post content. The image is imported into the media library and set as the featured image. Images are marked with an "AI Generated Featured Image" label.
14
14
-**Block buttons:** A "Generate Image" inline and toolbar button on Image, Cover, Media & Text, and Gallery blocks. Clicking it opens a modal where you describe the image, generate it, preview it, optionally refine it (edit with follow-up prompts using the current image as reference), and insert it into the block.
@@ -29,9 +29,9 @@ When enabled, the Image Generation experiment adds:
29
29
30
30
### For Developers
31
31
32
-
The experiment consists of four main components:
32
+
The feature consists of four main components:
33
33
34
-
1.**Experiment Class** (`WordPress\AI\Experiments\Image_Generation\Image_Generation`): Handles registration, asset enqueuing, featured image and inline block editor UI integration, and post meta registration
34
+
1.**Feature Class** (`WordPress\AI\Features\Image_Generation\Image_Generation`): Handles registration, asset enqueuing, featured image and inline block editor UI integration, and post meta registration
35
35
2.**Generate Image Prompt Ability** (`WordPress\AI\Abilities\Image\Generate_Image_Prompt`): Generates optimized image generation prompts from post content and context
36
36
3.**Generate Image Ability** (`WordPress\AI\Abilities\Image\Generate_Image`): Generates base64-encoded images from prompts (and optionally from a reference image for refining) using AI models
37
37
4.**Import Image Ability** (`WordPress\AI\Abilities\Image\Import_Base64_Image`): Imports base64-encoded images into the WordPress media library
@@ -42,7 +42,7 @@ All three abilities can be called directly via REST API, making them useful for
42
42
43
43
### Key Hooks & Entry Points
44
44
45
-
-`WordPress\AI\Experiments\Image_Generation\Image_Generation::register()` wires everything once the experiment is enabled:
45
+
-`WordPress\AI\Features\Image_Generation\Image_Generation::register()` wires everything once the feature is enabled:
46
46
-`register_post_meta()` → registers `ai_generated` post meta for attachment post type
47
47
-`wp_abilities_api_init` → registers the `ai/image-generation`, `ai/image-import`, and `ai/image-prompt-generation` abilities
48
48
-`admin_enqueue_scripts` → `enqueue_assets()` loads assets on `post.php` and `post-new.php` screens for post types that support featured images
@@ -51,8 +51,8 @@ All three abilities can be called directly via REST API, making them useful for
51
51
### Assets & Data Flow
52
52
53
53
1.**PHP Side:**
54
-
-`enqueue_shared_assets()` (called from `enqueue_assets()` and `enqueue_inline_assets()`) loads `experiments/image-generation` (`src/experiments/image-generation/index.ts`) and localizes `window.aiImageGenerationData` with:
55
-
-`enabled`: Whether the experiment is enabled
54
+
-`enqueue_shared_assets()` (called from `enqueue_assets()` and `enqueue_inline_assets()`) loads `features/image-generation` (`src/features/image-generation/index.ts`) and localizes `window.aiImageGenerationData` with:
55
+
-`enabled`: Whether the feature is enabled
56
56
-`altTextEnabled`: Whether the alt text generation experiment is enabled
57
57
58
58
2.**React Side (Featured Image):**
@@ -675,7 +675,7 @@ Example error response:
675
675
}
676
676
```
677
677
678
-
## Extending the Experiment
678
+
## Extending the Feature
679
679
680
680
### Customizing the Image Prompt Generation System Instruction
`uploadImage( imageData, options? )` accepts generated image data and an optional `options` object with `onProgress?: ( message:string ) =>void` for progress callbacks. When the Alt Text Generation experiment is enabled, it generates alt text via `generateAltText()` before importing; otherwise it uses the image prompt as alt text.
@@ -715,45 +715,45 @@ You can also filter the input before calling the import ability via REST API.
715
715
716
716
### Customizing Post Context
717
717
718
-
The experiment uses `getContext()` to fetch post details (title, type). You can extend this to include additional context by modifying:
718
+
The feature uses `getContext()` to fetch post details (title, type). You can extend this to include additional context by modifying:
- The component renders a button and, while generating, a progress container (`.ai-featured-image__progress`) that displays the current step and a spinner; progress is driven by the `onProgress` callbacks passed to `generateImage()` and `uploadImage()`
- The modal supports idle (prompt input), generating, preview (keep/refine/start over) states
741
741
- Customize the flow, UI copy, or add new actions
742
742
743
743
3. **Add or change supported blocks for inline generation:**
744
744
- Edit `inline.tsx` and modify the `TARGET_BLOCKS` array (`core/image`, `core/cover`, `core/media-text`, `core/gallery`)
745
-
- To support a new block type, update `insertIntoBlock()` in `src/experiments/image-generation/functions/insert-into-block.ts` with the correct attribute mapping
745
+
- To support a new block type, update `insertIntoBlock()` in `src/features/image-generation/functions/insert-into-block.ts` with the correct attribute mapping
@@ -115,7 +115,7 @@ private function get_default_features(): array {
115
115
*
116
116
* @since 0.6.0
117
117
*
118
-
* @param array<string, \WordPress\AI\Contracts\Feature|class-string<\WordPress\AI\Contracts\Feature>> $feature_classes Array of feature class names, keyed by ID.
118
+
* @param array<string, class-string<\WordPress\AI\Contracts\Feature>> $feature_classes Array of feature class names, keyed by ID.
0 commit comments