Skip to content

Gate image generation UI on provider support detection#679

Merged
dkotter merged 7 commits into
WordPress:developfrom
t-hamano:image-generation-check
Jun 11, 2026
Merged

Gate image generation UI on provider support detection#679
dkotter merged 7 commits into
WordPress:developfrom
t-hamano:image-generation-check

Conversation

@t-hamano

@t-hamano t-hamano commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Related to https://core.trac.wordpress.org/ticket/64917#comment:14

Ideally the UI would reveal that image generation isn't available before the user types the prompt and clicks the button. Otherwise they waste time, risk losing the prompt, and hit a dead end while in the flow.

What?

The server checks if any connectors supporting image generation are registered and passes this information to the client side. If no connectors supporting image generation are found, a warning is displayed without sending a REST request.

Why?

It is unhelpful that users can attempt to generate images by entering prompts, even though there are no connectors supporting image generation.

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 4.8
Used for: Drafting this pull request description. Implementation was reviewed by me.

Testing Instructions

  • Only register the Anthropic API key.
  • Image Block:
    • Insert an Image block and click the Generate Image button.
    • A warning should be displayed.
  • Media Library:
    • Access Media > Generate Image.
    • A warning should be displayed.
  • Featured Image:
    • Open the post editor and click the Generate featured image button.
    • A warning should be displayed.

Screenshot

Image Block:
image

Media Library:
image

Featured Image:
image

Changelog Entry

Changed - Gate the image generation UI on detected provider support for image generation.

Open WordPress Playground Preview

t-hamano and others added 2 commits June 7, 2026 23:42
Connectors may be authenticated without exposing an image-generation-capable
model. Detect this server-side via has_image_generation_support() and surface
it to the editor so the prompt form and featured-image action show a clear
"connect a provider" notice instead of failing on generate.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The actions prop was added with inconsistent inline indentation. Reformat
it to match the surrounding code style for readability.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment thread includes/helpers.php
@dkotter

dkotter commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

This idea has been brought up multiple times and the conclusion we've come to in the past is to leave things as they are:

  • If someone enables a Feature, we should always show the UI for that Feature even if they have no AI Connector in place to support that Feature
  • In that scenario, when they try and use the Feature, we should output an error message letting them know they need a valid Connector in place

The discussion in the past has mostly focused on if we should completely remove the UI if there isn't a valid Connector while this PR approaches it differently, where the general UI is still there but you can't fully trigger it.

I'm fine with considering this approach but ideally these are things that should be talked through prior to trying to implement so we can ensure we're all on the same page first. For example, my opinion here is if we implement this for image generation, we should likely implement this for all Features to keep parity.

@t-hamano

t-hamano commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review.

The purpose of this PR is to prevent users from engaging in futile tasks. For example, users would be disappointed if they entered a long prompt text, clicked the Generate button, and then encountered an error.

I am happy to follow up if there are any other areas that need to be addressed.

@t-hamano t-hamano marked this pull request as ready for review June 10, 2026 14:02
@github-actions

github-actions Bot commented Jun 10, 2026

Copy link
Copy Markdown

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: dkotter <dkotter@git.wordpress.org>
Co-authored-by: mindctrl <mindctrl@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@dkotter dkotter added this to the 1.1.0 milestone Jun 11, 2026
@dkotter dkotter merged commit babdbc7 into WordPress:develop Jun 11, 2026
21 of 22 checks passed
@dkotter

dkotter commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

The purpose of this PR is to prevent users from engaging in futile tasks. For example, users would be disappointed if they entered a long prompt text, clicked the Generate button, and then encountered an error.

Thanks, in thinking about it more I agree this is a better experience so I've merged this in now

I am happy to follow up if there are any other areas that need to be addressed.

This may be the only feature that requires additional action after triggering (i.e. entering in a prompt). Most other features trigger immediately after you click a button so the error message we already show there is likely good enough. But happy for someone to review all of our other features and decide if changes are needed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants