Replace the error message the AI Client returns with a more specific one if image requests fail#332
Conversation
… error message the AI Client returns with something more specific
|
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. |
…though WordPress polyfills this
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #332 +/- ##
=============================================
- Coverage 57.85% 57.76% -0.10%
- Complexity 615 617 +2
=============================================
Files 46 46
Lines 3165 3170 +5
=============================================
Hits 1831 1831
- Misses 1334 1339 +5
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:
|
jeffpaul
left a comment
There was a problem hiding this comment.
Approved, feel free to merge when ready
What?
Ensure we show a more understandable error message if image generation / refinement / editing fails.
Why?
At the moment, image generation is supported by the Google and OpenAI provider plugins but image editing / refinement is only supported by Google. If you only have OpenAI connected, you can generate an image but if you then try and refine that image, you'll receive an error message.
Also, if you have no providers connected that support image generation and you turn on the image generation experiment, the UI is still available to use (which this is how all of our experiments currently work). If you try and generate an image you will get an error message.
These messages come from the AI Client and we just capture and display them. But the error messages aren't super specific and don't make it completely clear what the actual problem is, so this PR replaces those errors with more specific ones.
How?
If an error happens when we make an image generation request, replace the error message the AI Client returns from:
No models found that support image_generation for this prompt.to
Image generation failed. Please ensure you have a connected provider that supports image generation.If an error happens when we make an image edit request, replace the error message the AI Client returns from:
No models found that support image_generation for this prompt.to
Image refinement failed. Please ensure you have a connected provider that supports image refinement, not just image generation.Use of AI Tools
None
Testing Instructions
Screenshots