Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Tweak the product prompt #11903

Merged
merged 2 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/Patterns/PatternUpdater.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ class PatternUpdater {
* @return bool|WP_Error
*/
public function generate_content( $ai_connection, $token, $images, $business_description ) {
if ( empty( $images ) ) {
return new \WP_Error( 'images_not_found', __( 'No images provided for generating AI content.', 'woo-gutenberg-products-block' ) );
}

if ( is_wp_error( $images ) ) {
return $images;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Patterns/ProductUpdater.php
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,9 @@ public function assign_ai_generated_content_to_dummy_products( $ai_connection, $
$prompts = [];
foreach ( $products_information_list as $product_information ) {
if ( ! empty( $product_information['image']['alt'] ) ) {
$prompts[] = sprintf( 'Generate a product name that exactly matches the following image description: "%s" and also is related to the following business description: "%s". Do not include any adjectives or descriptions of the qualities of the product and always refer to objects or services, not humans. The returned result should not refer to people, only objects.', $product_information['image']['alt'], $business_description );
$prompts[] = sprintf( 'Generate a product name for a product that could be sold in a store and could be associated with the following image description: "%s" and also is related to the following business description: "%s". Do not include any adjectives or descriptions of the qualities of the product and always refer to objects or services, not humans. The returned result should not refer to people, only objects.', $product_information['image']['alt'], $business_description );
} else {
$prompts[] = sprintf( 'Generate a product name that matches the following business description: "%s". Do not include any adjectives or descriptions of the qualities of the product and always refer to objects or services, not humans.', $business_description );
$prompts[] = sprintf( 'Generate a product name for a product that could be sold in a store and matches the following business description: "%s". Do not include any adjectives or descriptions of the qualities of the product and always refer to objects or services, not humans.', $business_description );
}
}

Expand Down