Commit Graph

6 Commits

Author SHA1 Message Date
peptiderepo
1a2af595c6 fix: attach images immediately + upgrade image prompts to v2
Two fixes:

1. Image attachment: moved set_post_thumbnail() and Image B post meta
   into generate_and_attach_images() so they persist immediately after
   each image generates. Previously the caller set them after both images
   completed — if the process timed out (common with GPT-5 Image at
   ~30s/image), the featured image was never attached and Image B was
   never attempted.

2. Image prompts: replaced FLUX.1-optimized rewriter system prompt and
   90s infomercial style suffix with prompts optimized for Gemini Flash
   Image and GPT-5 Image. New style: premium scientific lifestyle
   photography with golds/teals color grading. Includes one-time migration
   to update stored style suffix.

Also logs when Image B is skipped due to missing source data (previously
silent), helping diagnose why some posts only get one image.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-18 12:17:05 +07:00
peptiderepo
1968864073 fix: widen all catch blocks from \Exception to \Throwable
PHP 8.3 TypeError and Error extend \Throwable but NOT \Exception,
so catch(\Exception) silently drops them — explaining why the
generation pipeline fails at the publishing step with no activity
log entry. Now every catch in the generation path catches
\Throwable and logs the exception class name for diagnostics.

Bump to v0.2.7.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-18 10:12:06 +07:00
peptiderepo
b5e91ba3a6 fix: wire Image B source data — was hardcoded null, never generated
Root cause: both attach_generated_images() in post-assembler and the
retroactive handler in executor passed null as source_data to the image
pipeline. The pipeline's Image B branch requires non-null source_data
to fire, so Image B was silently skipped on every article since the
feature was built.

Fix: added get_source_data_for_image() to Source_Collector to retrieve
the original Reddit post title/content by source_ids. Post-assembler
now pulls source_ids from the Article_Idea; executor pulls them from
the _prautoblogger_source_ids post meta saved by the publisher.

Also added a regression test proving Image B is skipped when source_data
is null, so this handoff gap will be caught if re-introduced.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-18 08:34:21 +07:00
peptiderepo
31f303a831 feat: interactive model picker with searchable popup and pricing
Replace plain text inputs for analysis/writing/editor model fields
with a rich model picker that fetches the OpenRouter model registry
and displays a searchable popup with model name, provider, input/output
pricing per 1M tokens, and context window. Also extracts source status
and model field renderers into dedicated field classes to keep
class-admin-page.php under the 300-line cap.

New files:
- assets/js/model-picker.js — popup UI with search, filtering, caching
- assets/css/model-picker.css — popup styles matching admin design system
- includes/admin/fields/class-open-router-model-field.php — server render
- includes/admin/fields/class-source-status-field.php — extracted field

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-18 02:53:40 +07:00
peptiderepo
0e44c52ad8 feat: add AJAX endpoint for retroactive image generation
Adds wp_ajax_prautoblogger_generate_image so images can be generated
for existing posts that were published before image gen was enabled
or fixed. Uses set_time_limit(120) to handle the Cloudflare API
latency that caused fatals when run via Code Snippets init hook.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-18 00:39:10 +07:00
peptiderepo
4d09141550 refactor: extract PRAutoBlogger_Executor from PRAutoBlogger (404→186+186)
Cron handlers (daily generation, metrics collection), AJAX handlers
(generate now, test connection), atomic generation lock, and model
registry access moved to PRAutoBlogger_Executor. Main orchestrator
retains hook registration, DB migrations, and cron schedule filter.
Backward-compatible proxy methods on PRAutoBlogger.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-17 02:48:16 +07:00