Enhance Summarization feature: add minimum content length filter and disable button for short content#492
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #492 +/- ##
=============================================
- Coverage 70.07% 70.05% -0.03%
Complexity 1107 1107
=============================================
Files 67 67
Lines 5367 5369 +2
=============================================
Hits 3761 3761
- Misses 1606 1608 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Okay I think I need to fix the test. Is it okay if I do it once we finalize the implementation? |
dkotter
left a comment
There was a problem hiding this comment.
Left a few comments but overall this looks good and tests well.
I left a similar comment on #479 but both that PR and this PR solve the same problem though for different experiments (title generation vs content summarization). Ideally we take the same approach for both to avoid confusion.
I personally like the approach here, where we have a minimum length we look for and we disable the UI instead of removing it. But open to discussion on that.
One other thing we should look to add here that #479 has is adding an E2E test to verify a situation where the minimum content length isn't met, ensuring the button is disabled then.
Co-authored-by: Darin Kotter <darin.kotter@gmail.com>
Co-authored-by: Darin Kotter <darin.kotter@gmail.com>
|
I also prefer the approach here of showing the button disabled with the note of minimal characters needed. Where reasonable, would be nice to allow that 100 character minimum to be filterable but not something we should expose as an AI setting. |
…ing' into feature/conditional-sumary-enabling
# Conflicts: # includes/Experiments/Summarization/Summarization.php # src/experiments/summarization/components/SummarizationPlugin.tsx
|
Hi all Is there anything else left here to work on? Just following up to make sure we are on the same page. |
…disable button for short content (WordPress#492) Changed - Disable the Summarization button until content reaches a certain length. Co-authored-by: coderGtm <gautam23@git.wordpress.org> Co-authored-by: jeffpaul <jeffpaul@git.wordpress.org> Co-authored-by: dkotter <dkotter@git.wordpress.org> Co-authored-by: vishnupprajapat <vishnuprajapat@git.wordpress.org> Co-authored-by: pcprajapatcms <phoolchandcms@git.wordpress.org>

What?
Closes #390
Disabled the Summarize button in editor for shorter content and adds a filter for minimum content length required to enable the Summarize button (default is 100 characters).
Why?
Summarize button stays visible even if there is no content or very less content on the page. This is practically useless and can potentially rack up AI costs for the user unknowingly. Disabling it for shorter content length ensures that it is only available when it makes sense.
How?
includes/Experiments/Summarization/Summarization.phpwpai_summarization_min_content_lengthfilter with a default value of 100aiSummarizationData.minContentLengthsrc/experiments/summarization/functions/useSummaryGeneration.tsminContentLengthfrom the localized data (falls back to 100)isContentTooShortandminContentLengthin the returned objectsrc/experiments/summarization/components/SummarizationPlugin.tsxisContentTooShortistruesrc/experiments/summarization/components/SummarizationBlockControls.tsxThe toolbar button is also disabled when content is too short
Use of AI Tools
Testing Instructions
function.phpfor testing purposes:Screenshots or screencast
Screen.Recording.2026-05-01.at.10.23.50.AM.mov
Changelog Entry