Automattic\WooCommerce\Blocks\AIContent
UpdatePatterns::generate_ai_content_for_patterns()
Returns the patterns with AI generated content.
Метод класса: UpdatePatterns{}
Хуков нет.
Возвращает
Массив|WP_Error
. The patterns with AI generated content.
Использование
$UpdatePatterns = new UpdatePatterns(); $UpdatePatterns->generate_ai_content_for_patterns( $ai_connection, $token, $patterns, $business_description );
- $ai_connection(Connection) (обязательный)
- The AI connection.
- $token(строка|WP_Error) (обязательный)
- The JWT token.
- $patterns(массив) (обязательный)
- The array of patterns.
- $business_description(строка) (обязательный)
- The business description.
Код UpdatePatterns::generate_ai_content_for_patterns() UpdatePatterns::generate ai content for patterns WC 9.5.1
public function generate_ai_content_for_patterns( $ai_connection, $token, $patterns, $business_description ) { $prompts = $this->prepare_prompts( $patterns ); $expected_results_format = $this->prepare_expected_results_format( $prompts ); $formatted_prompts = $this->format_prompts_for_ai( $prompts, $business_description, $expected_results_format ); $ai_responses = $this->fetch_and_validate_ai_responses( $ai_connection, $token, $formatted_prompts, $expected_results_format ); if ( is_wp_error( $ai_responses ) ) { return $ai_responses; } return $this->apply_ai_responses_to_patterns( $patterns, $ai_responses ); }