-
Notifications
You must be signed in to change notification settings - Fork 219
[Store Customization MVP] Add image alts to the ai prompt if available #11101
Conversation
The release ZIP for this PR is accessible via:
Script Dependencies ReportThere is no changed script dependency between this branch and trunk. This comment was automatically generated by the TypeScript Errors Report
🎉 🎉 This PR does not introduce new TS errors. |
Size Change: +11 kB (+1%) Total Size: 1.48 MB
ℹ️ View Unchanged
|
Thanks @albarin. I can see the problem we're trying to solve here but I am wondering what other approaches we have considered? I'm not sure what I'm about to suggest is the right way but I was wondering do you think it would be worth moving the ALT text to the dictionary file and using that text to build the prompt & the image alt. In the case of What about if we did the following: {
"name": "Featured Category Focus",
"slug": "woocommerce-blocks/featured-category-focus",
"images_total": 1,
"images_format": "landscape",
"content": {
"titles": [
{
"default": "Announcing our newest collection",
"ai_prompt": "The title of the featured category: {image.0}"
}
],
"image_description": [
"An image of a cosy living room showing contemporary decoration with a fireplace"
]
}
} We could then use the And the alt text: Again I'm not saying my suggestion is the right one, but it feels a little bit more intuitive. What do you think? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@albarin I think we will have to fine-tune the logic here a bit. Here are the test results on my end:
- On https://advisory-tarsier.jurassic.ninja/ we have the store description set as:
I'm selling merchandise with branding by local breweries. I have a small catalogue of about 10 products. I plan to sell to people who like craft beer. My business is all about beer.
- And in this particular case, since the Verticals API doesn't have any specific images for beers, this was the output received:
- The
"alt"
description does exist for all of these images within the verticals API:
Ref: https://public-api.wordpress.com/wpcom/v2/site-verticals/1512/images
But because we are concatenating these with the store description within the PatternsUpdater class, get_patterns_with_content
method, the output is still related to the breweries or beers (in this particular example), rather than the images.
As a workaround I would suggest that: for all patterns that display products, if the provided images have an alt description, rely exclusively on those to generate the content rather than a combination between store description + image description to ensure better accuracy. WDYT?
Yeah, you are right; this is a very tricky scenario, especially considering our limitations regarding the number of images available. Let's keep the logic as-is for now and work on additional fine-tuning as part of a separate task so we can spend more time discussing/brainstorming before implementing and unblock this work :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this @albarin , LGTM! 🚀
✅ Confirmed patterns are working as expected with these changes in place and descriptions are more accurate whenever the alt description is available for the image.
What
Uses the
alt
available in some of the Verticals API images to build the prompt so the content makes sense with the image.Also includes a pattern update which was not loading the right content.
Fixes #11084
Why
Since content is AI-generated, we need to avoid some images not matching the image displayed as much as possible.
Testing Instructions
Please consider any edge cases this change may have, and also other areas of the product this may impact.
Create a new JN install with both Jetpack and Woocommerce installed and activated.
Install and activate WooCommerce Blocks from this zip file: woocommerce-gutenberg-products-block.zip.
In your wp-admin, set up the JetPack connection, make sure it's successful.
From your admin screen, click on Tools > Plugin editor:
Select the WooCommerce Blocks plugin and add the following within your woocommerce-blocks/woocommerce-gutenberg-products-block.php file and save:
Screenshots or screencast
WooCommerce Visibility
Required:
Checklist
Required:
[type]
label or a[skip-changelog]
label.Conditional:
[skip-changelog]
label is not present).Changelog