Add bulk "Generate AI Summary" action to the posts list table#650
Draft
prasadkarmalkar wants to merge 3 commits into
Draft
Add bulk "Generate AI Summary" action to the posts list table#650prasadkarmalkar wants to merge 3 commits into
prasadkarmalkar wants to merge 3 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #650 +/- ##
=============================================
- Coverage 74.57% 74.19% -0.38%
- Complexity 1754 1770 +16
=============================================
Files 85 85
Lines 7548 7593 +45
=============================================
+ Hits 5629 5634 +5
- Misses 1919 1959 +40
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Closes #614
Why?
AI summary generation is only available from within the block editor for a single post at a time. This PR adds a bulk workflow that lets users generate summaries for multiple posts in a single action directly from the list table.
How?
References from the existing Alt Text Generation bulk action pattern:
PHP (three new methods on
Summarizationexperiment):register_bulk_action()— appends"Generate AI Summary"to the bulk actions menu.handle_bulk_action()— validates capabilities (edit_posts+ per-postedit_post), then redirects back toedit.phpwithwpai_bulk_summary=1&wpai_post_ids=1,2,3query args.maybe_enqueue_bulk_assets()— detects the redirect on page reload, sanitizes post IDs, resolves the correct REST base from the current post type (so pages and custom post types work), and enqueues the bulk script with localized data (window.aiSummarizationBulkData).JavaScript (
src/experiments/summarization/bulk.ts, new file):DOMContentLoaded, readswindow.aiSummarizationBulkDataand processes posts sequentially.runAbility('ai/summarization', { context: postId })(the ability fetches post content from the DB itself), fetches raw block content via the REST API, strips any pre-existing summary block, prepends the new one, and saves bothcontentandmeta.ai_generated_summaryin a singleapiFetchPOST.wpai_bulk_summaryandwpai_post_idsfrom the URL viahistory.replaceState.Webpack (
webpack.config.js): Addsexperiments/summarization-bulkentry pointing tobulk.ts.Use of AI Tools
AI assistance: Yes
Tool(s): GitHub Copilot
Model(s): Claude Sonnet 4.6
Used for: Initial code skeleton. Final implementation reviewed and edited by me.
Testing Instructions
Prerequisites: An AI connector must be configured in Settings → Connectors.
ai_generated_summaryis addedScreenshots or screencast
Screen.Recording.2026-06-03.at.10.28.13.AM.mov
Changelog Entry