feat(images): expose rewriter system prompt as admin setting
CEO feedback: every generated image is anchoring on the cartoon peptide-with-arms-and-legs character because the hardcoded rewriter system prompt both lists "anthropomorphized molecules" first in its primer and ships a few-shot example that literally shows one. The ask is to give CEO the lever without a code change. Adds `prautoblogger_image_prompt_instructions` (textarea) in the Images section. Default value is the existing REWRITER_SYSTEM_PROMPT constant verbatim, so behaviour is unchanged on upgrade until someone edits it. `Image_Prompt_Builder::rewrite_via_llm()` reads the option at call time via a new `resolve_system_prompt()` helper and falls back to the constant if the option is blank or whitespace-only, so a saved empty value cannot brick image generation. Const visibility flipped from `private` to `public` so the settings field can reference it directly as the field default. Tests: - `test_rewrite_uses_setting_when_present` — option set, assert the LLM's system message equals the option content. - `test_rewrite_falls_back_to_default_when_setting_empty` — option whitespace, assert the LLM's system message equals the constant. Uninstall: new option covered by the existing prautoblogger_% LIKE sweep in uninstall.php. Cost impact: none by default. Future CEO edits will change prompt length; current default is ~180 tokens, budget impact linear from there. Part of the v0.8.0 image bundle (thread image-mime-bug, message 03). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -256,6 +256,14 @@ class PRAutoBlogger_Settings_Fields_Extended {
|
||||
'default' => PRAUTOBLOGGER_DEFAULT_IMAGE_STYLE_SUFFIX,
|
||||
'description' => __( 'Appended to every image prompt. Controls visual look. Changing mid-run causes visible style drift.', 'prautoblogger' ),
|
||||
],
|
||||
[
|
||||
'id' => 'prautoblogger_image_prompt_instructions',
|
||||
'label' => __( 'Image Prompt Instructions', 'prautoblogger' ),
|
||||
'type' => 'textarea',
|
||||
'section' => 'prautoblogger_images',
|
||||
'default' => PRAutoBlogger_Image_Prompt_Builder::REWRITER_SYSTEM_PROMPT,
|
||||
'description' => __( 'System prompt given to the rewriter LLM that turns each article into a SCENE + CAPTION for the image generator. Changing this reshapes the look of all future images. Leave blank to use the default.', 'prautoblogger' ),
|
||||
],
|
||||
[
|
||||
'id' => 'prautoblogger_image_nsfw_retry',
|
||||
'label' => __( 'Retry NSFW-Blocked Images', 'prautoblogger' ),
|
||||
|
||||
Reference in New Issue
Block a user