feat: add Image B toggle to disable second image generation (v0.4.6)

New toggle in Images settings controls whether the source-data-based
second image is generated. Disabling saves one image gen call + one
LLM prompt rewrite per article. Defaults to enabled.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
peptiderepo
2026-04-19 22:08:06 +07:00
parent ca8fe1bfba
commit 7d61c8c76d
4 changed files with 25 additions and 5 deletions

View File

@@ -5,6 +5,13 @@ All notable changes to PRAutoBlogger will be documented in this file.
Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project uses [Semantic Versioning](https://semver.org/).
## [0.4.6] — 2026-04-19
### Added
- **Image B toggle.** New "Generate Second Image (B)" toggle in Images settings.
Disabling saves one image generation call + one LLM prompt rewrite per article.
Defaults to enabled for backwards compatibility.
## [0.4.5] — 2026-04-19
### Added

View File

@@ -172,7 +172,15 @@ class PRAutoBlogger_Settings_Fields_Extended {
'type' => 'toggle',
'section' => 'prautoblogger_images',
'default' => '0',
'description' => __( 'When enabled, generate two images (A/B) for each published article.', 'prautoblogger' ),
'description' => __( 'Generate images for each published article.', 'prautoblogger' ),
],
[
'id' => 'prautoblogger_image_b_enabled',
'label' => __( 'Generate Second Image (B)', 'prautoblogger' ),
'type' => 'toggle',
'section' => 'prautoblogger_images',
'default' => '1',
'description' => __( 'Generate a second image from source data for A/B testing. Disabling saves one image generation + one LLM prompt rewrite per article.', 'prautoblogger' ),
],
[
'id' => 'prautoblogger_image_provider',

View File

@@ -94,8 +94,13 @@ class PRAutoBlogger_Image_Pipeline {
return $result;
}
// Check whether Image B is enabled in settings.
$image_b_enabled = get_option( 'prautoblogger_image_b_enabled', '1' );
$has_source_data = null !== $source_data && ! empty( $source_data );
$generate_b = $has_source_data && '1' === $image_b_enabled;
// Budget pre-check: estimate cost for all images before any HTTP calls.
$image_count = ( null !== $source_data && ! empty( $source_data ) ) ? 2 : 1;
$image_count = $generate_b ? 2 : 1;
$estimated_cost = $this->provider->estimate_cost( self::DEFAULT_WIDTH, self::DEFAULT_HEIGHT ) * $image_count;
if ( $this->cost_tracker->would_exceed_budget( $estimated_cost ) ) {
$result['errors'][] = 'Image generation would exceed monthly budget.';
@@ -114,7 +119,7 @@ class PRAutoBlogger_Image_Pipeline {
$captions = [ 'image_a' => $article_prompt['caption'] ];
$source_prompt = null;
if ( null !== $source_data && ! empty( $source_data ) ) {
if ( $generate_b ) {
$source_prompt = $this->prompt_builder->build_source_prompt( $source_data );
$batch_requests['image_b'] = [
'prompt' => $source_prompt['prompt'],

View File

@@ -8,7 +8,7 @@ declare(strict_types=1);
* Plugin Name: PRAutoBlogger
* Plugin URI: https://peptiderepo.com/prautoblogger
* Description: Monitors social media for trending topics, generates SEO-friendly blog posts using AI, and publishes them on a daily schedule with full cost tracking and self-improvement metrics.
* Version: 0.4.5
* Version: 0.4.6
* Requires at least: 6.0
* Requires PHP: 7.4
* Author: PeptideRepo
@@ -35,7 +35,7 @@ if ( ! defined( 'ABSPATH' ) ) {
| and limits without magic strings.
*/
define( 'PRAUTOBLOGGER_VERSION', '0.4.5' );
define( 'PRAUTOBLOGGER_VERSION', '0.4.6' );
define( 'PRAUTOBLOGGER_DB_VERSION', '1.1.0' );
define( 'PRAUTOBLOGGER_PLUGIN_FILE', __FILE__ );
define( 'PRAUTOBLOGGER_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );