-
Notifications
You must be signed in to change notification settings - Fork 221
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: 0 B Total Size: 1.54 MB ℹ️ View Unchanged
|
Migrate internal AI routes to WooCommerce Core codebase.Migrate internal AI routes to WooCommerce Core codebase.
woocommerce-blocks/src/StoreApi/RoutesController.php Lines 62 to 71 in 8325b5e
🚀 This comment was generated by the automations bot based on a
|
…o fix/pattern-route-performance WIP WIP
…e/woocommerce-blocks into fix/pattern-route-performance
95aeb81
to
b9a5808
Compare
} | ||
|
||
/** | ||
* Get the Patterns response. |
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.
I think the get_item_response
comment is the same in all schemas files.
} | ||
|
||
/** | ||
* Ensure the content and images in patterns are powered by AI. |
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.
Same here, it's the same comment for a few of the endpoints.
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.
It's working great, amazing job 👏
Just left a couple of small comments regarding repeated comments, nothing important.
…o fix/pattern-route-performance
…e/woocommerce-blocks into fix/pattern-route-performance
Moving to 11.6.0 |
…_products_to_update method for handling the fetch of dummy products to be updated.
…ate method for fetching dummy products to avoid code repetition and add safety checks and handle errors in case certain properties are not available.
Great work here @gigitux 🎉 ! Confirmed that with this change, we have a significant boost in performance, well done! I hope you don't mind I pushed a few changes here to address some issues found during testing and also to remove redundancies: On 827bc3c , the On 7c69cef , a change was made to ensure the Product endpoint relies on the newly created On 4a9ff4a a change was made to ensure the On 734e485. The memory increase was also removed and doc blocks updated. I can confirm the feature works, but it would be great if more folks could re-test the PR with the latest changes to ensure everything is working as expected. cc: @albarin @tjcafferkey. Here's the latest zip file for testing: |
Thanks for the review, @tjcafferkey!
This issue woocommerce/woocommerce#41229 was fixed yesterday and the Core build uploaded here doesn't contain the patch.
Just to confirm, for "inaccurate text" are you referring to the duplicate text? If yes, @albarin fixed it (#11612), but this branch doesn't contain the patch. |
Thanks @gigitux I will continue to review the code now. |
@gigitux @tjcafferkey FYI: I just noticed that we could occasionally have products with content not updated without increasing the max_execution_time, so I went ahead and re-added it here since it is still required: 31daa33 |
* fix pattern route performance * update namespace * improve middleware * improve ProductSchema * improve error handling * update identifier * fix middleware * update description * use schema to return the response * Break down the generate_content method and create the new fetch_dummy_products_to_update method for handling the fetch of dummy products to be updated. * Ensure the Product endpoint relies on the fetch_dummy_products_to_update method for fetching dummy products to avoid code repetition and add safety checks and handle errors in case certain properties are not available. * Add error handling for the Products endpoint. * Remove memory limit increase and update docblocks. * re-add set_time_limit --------- Co-authored-by: Patricia Hillebrandt <[email protected]>
* Empty commit for release pull request * Add readme and testing notes * Bump versions to 11.5.1 * Fix Single Product Classic Template block not showing on the front-end (#11455) In WordPress 6.4, it appears that the global `have_posts` is `false` in the context of the full site editing single product template. This breaks the Classic Template block. In this commit, we are creating a custom query using the available id instead of relying on the global query. This might be a temporary workaround as we are waiting to see if that's an issue that core is willing to fix, as it might affect backwards-compatibility for other vendors. (cherry picked from commit d9e8809) * Update testing notes with new zip file * Add protection against wrong params in get_block_template_fallback() (#11690) * Add protection towards wrong params in get_block_template_fallback() * Improve protection * Update WC Blocks 11.5.1 changelog and testing steps with new fix * bump version * [CYS] Fix decoding issue and pattern (#11681) * Fix pattern description * Decode the actual file content, not the filepath * Use wp_post table instead wp_option to store patterns data generated by AI (#11659) * Use wp_post table instead wp_option to store patterns data generated by AI * avoid crash when there isn't any patterns_ai_data post type * restore check * remove unnecessary constant * catch error * pass boolean to return WP_Error * Rename Centered Header Menu with Search pattern (#11637) * Rename Centered Header Menu with Search pattern Since the search bar has been removed from this pattern, this PR renames the pattern title and slug to reflect that change. * Rename file to reflect search removal. Remove `search` from the filename, as this no longer reflects the pattern. * Add missing condition to avoid a php warning when 'plugins' is not set (#11652) * Fix pattern route performance (#11535) * fix pattern route performance * update namespace * improve middleware * improve ProductSchema * improve error handling * update identifier * fix middleware * update description * use schema to return the response * Break down the generate_content method and create the new fetch_dummy_products_to_update method for handling the fetch of dummy products to be updated. * Ensure the Product endpoint relies on the fetch_dummy_products_to_update method for fetching dummy products to avoid code repetition and add safety checks and handle errors in case certain properties are not available. * Add error handling for the Products endpoint. * Remove memory limit increase and update docblocks. * re-add set_time_limit --------- Co-authored-by: Patricia Hillebrandt <[email protected]> * Empty commit for release pull request * add testing instructions * add zip link --------- Co-authored-by: github-actions <[email protected]> Co-authored-by: Lucio Giannotta <[email protected]> Co-authored-by: Albert Juhé Lluveras <[email protected]> Co-authored-by: Luigi <[email protected]> Co-authored-by: Alba Rincón <[email protected]> Co-authored-by: Daniel W. Robert <[email protected]> Co-authored-by: Patricia Hillebrandt <[email protected]>
* Empty commit for release pull request * Add readme and testing notes * Bump versions to 11.5.1 * Fix Single Product Classic Template block not showing on the front-end (#11455) In WordPress 6.4, it appears that the global `have_posts` is `false` in the context of the full site editing single product template. This breaks the Classic Template block. In this commit, we are creating a custom query using the available id instead of relying on the global query. This might be a temporary workaround as we are waiting to see if that's an issue that core is willing to fix, as it might affect backwards-compatibility for other vendors. (cherry picked from commit d9e8809) * Update testing notes with new zip file * Add protection against wrong params in get_block_template_fallback() (#11690) * Add protection towards wrong params in get_block_template_fallback() * Improve protection * Update WC Blocks 11.5.1 changelog and testing steps with new fix * bump version * [CYS] Fix decoding issue and pattern (#11681) * Fix pattern description * Decode the actual file content, not the filepath * Use wp_post table instead wp_option to store patterns data generated by AI (#11659) * Use wp_post table instead wp_option to store patterns data generated by AI * avoid crash when there isn't any patterns_ai_data post type * restore check * remove unnecessary constant * catch error * pass boolean to return WP_Error * Rename Centered Header Menu with Search pattern (#11637) * Rename Centered Header Menu with Search pattern Since the search bar has been removed from this pattern, this PR renames the pattern title and slug to reflect that change. * Rename file to reflect search removal. Remove `search` from the filename, as this no longer reflects the pattern. * Add missing condition to avoid a php warning when 'plugins' is not set (#11652) * Fix pattern route performance (#11535) * fix pattern route performance * update namespace * improve middleware * improve ProductSchema * improve error handling * update identifier * fix middleware * update description * use schema to return the response * Break down the generate_content method and create the new fetch_dummy_products_to_update method for handling the fetch of dummy products to be updated. * Ensure the Product endpoint relies on the fetch_dummy_products_to_update method for fetching dummy products to avoid code repetition and add safety checks and handle errors in case certain properties are not available. * Add error handling for the Products endpoint. * Remove memory limit increase and update docblocks. * re-add set_time_limit --------- Co-authored-by: Patricia Hillebrandt <[email protected]> * Empty commit for release pull request * add testing instructions * add zip link * [CYS] Fix decoding issue and pattern (#11681) * Fix pattern description * Decode the actual file content, not the filepath * bump version * add changelog * add zip link * add link to the readme --------- Co-authored-by: github-actions <[email protected]> Co-authored-by: Lucio Giannotta <[email protected]> Co-authored-by: Albert Juhé Lluveras <[email protected]> Co-authored-by: Luigi <[email protected]> Co-authored-by: Alba Rincón <[email protected]> Co-authored-by: Daniel W. Robert <[email protected]> Co-authored-by: Patricia Hillebrandt <[email protected]>
PR linked with woocommerce/woocommerce#41168
What
Fixes #
Why
This PR splits the
/patterns
endpoint into different endpoints to allow the client to parallelize the requests. The new endpoints are:/private/ai/images
-> generate images and return the client the image URLs./private/ai/products
-> generate the payload to pass to /ai/product./private/ai/product
-> update a specific product./private/ai/patterns
-> generate and save patterns.In the next iteration, we should improve how we handle the errors, but for now, these endpoints are private, so it should not be a big issue.
Testing Instructions
Please consider any edge cases this change may have, and also other areas of the product this may impact.
/wp-admin/tools.php?page=woocommerce-admin-test-helper
and enablecustomize-store
feature flag:Test the AI-managed images
Screenshots or screencast
WooCommerce Visibility
Required:
Checklist
Required:
[type]
label or a[skip-changelog]
label.Conditional:
[skip-changelog]
label is not present).Changelog