Skip to content

Add new "On Demand Mode" for Key Takeaways processing#1127

Open
dkotter wants to merge 9 commits into
developfrom
feature/on-demand-key-takeaways
Open

Add new "On Demand Mode" for Key Takeaways processing#1127
dkotter wants to merge 9 commits into
developfrom
feature/on-demand-key-takeaways

Conversation

@dkotter

@dkotter dkotter commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Description of the Change

Very similar to #1125 but adding this to Key Takeaways instead of TTS.

The Key Takeaways Feature currently only has a single "mode", manually adding the block to the post you want. This works fine but does require a user do this on each post. In addition, requires the summary to be generated in advance even if there aren't any users that care to read that summary.

This PR introduces a new setting to control the processing mode, defaulting to "manual" and adding a new "on-demand
option. When "on-demand" is chosen, a few additional settings are shown, like the post types this should apply to, the button label and the display format.

With this new mode turned on, a button will show at the top of the content for the single view for each supported post type. When you click this button, it will either render existing Key Takeaways or will generate those on-demand. Once generated, those are stored and re-used the next time.

Couple things to keep in mind:

  • The first time a user wants the Key Takeaways they'll need to wait a few seconds for those to load in
  • Because this is a front-end generation, we can't limit based on a user being logged in. This does open the door for someone to trigger this functionality on a bunch of posts and thus lead to a large amount of usage. We don't allow multiple generation requests per post and we don't generate anything if it already exists so the most impact you'd see is one generation request per post. This may be a dealbreaker for merging this in
  • There's a chance on a high traffic site for multiple users to request generation at the same time. We do have protection in place to only generate once but for any users that try generating while a previous generation is happening, they'll get an error message until generation is done

Screenshot and screenshare

New on demand settings for Key Takeaways
on-demand-key-takeaways.mp4

How to test the Change

  1. Checkout this PR and run npm i && npm run build
  2. Turn on the Key Takeaways Feature and choose the new On demand processing mode
  3. Create a new post, add some content and ensure you don't add the Key Takeaways block
  4. Publish this post and go to the front-end
  5. Ensure you see a button for Key Takeaways
  6. Click the play button and ensure you get a loading indicator
  7. Ensure once that is done the Key Takeaways display
  8. Refresh the page, click the play button again and ensure this runs immediately
  9. Go back to the post in the editor and add the Key Takeaways block. Ensure this loads content in immediately (will use the same Key Takeaways you generated on the front-end)
  10. Go to the front-end and ensure the block displays but the Key Takeaways button no longer displays

Changelog Entry

Added - On demand generation mode for Key Takeaways. When enabled, a button is shown on the front-end single view for supported content types that allows a user to request the Key Takeaways, either generating new or using existing ones.
Changed - Store the Key Takeaways result in post meta for future use

Credits

Props @dkotter

Checklist:

Open WordPress Playground Preview

@dkotter dkotter added this to the Future Release milestone Jun 24, 2026
@dkotter dkotter self-assigned this Jun 24, 2026
@dkotter dkotter requested review from a team and jeffpaul as code owners June 24, 2026 21:39
@github-actions github-actions Bot added the needs:code-review This requires code review. label Jun 24, 2026
@github-actions

Copy link
Copy Markdown

✅ WordPress Plugin Check Report

✅ Status: Passed

📊 Report

All checks passed! No errors or warnings found.


🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs:code-review This requires code review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant