Files
prautoblogger/assets/js/pipeline-settings.js
PRAutoBlogger Engineer e6550e1cbf feat: Pipeline Settings M1 — per-step model picker, system instructions, agent prompts (v0.23.0)
Adds a new 'Pipeline' wp-admin submenu page (prautoblogger-pipeline) with a
step rail covering all LLM stages: Research, Analysis, Writer, Editorial, Image.

Per-step panels surface:
- The existing PRAutoBlogger_OpenRouter_Model_Field picker (no new dropdown) with
  stage-accurate cost-preview for each step.
- System-instructions editor + agent-prompt editor(s) bound to the versioned
  prompt registry. Saving creates a new immutable version; reset-to-default
  available; active version number shown per panel.
- Step params read from PRAutoBlogger_Prompt_Registry::defs() (read-only in M1).

Writer panel marks inactive sub-stage prompts based on current pipeline mode.

No existing Settings sections changed — both surfaces edit the same wp_options
and prompts table. Decomposition of AI Models / Content / Sources tabs is M2.

get_stages_for_setting() extended: prautoblogger_research_model → [research,
llm_research] and prautoblogger_image_model → [image_a, image_b] for
cost-preview accuracy.

New files (4 classes + 1 CSS + 1 JS + 2 templates, all <=300 lines):
  includes/admin/class-pipeline-settings-page.php
  includes/admin/class-pipeline-settings-renderer.php
  includes/admin/class-pipeline-settings-save-handler.php
  includes/admin/class-pipeline-settings-step-map.php
  assets/css/pipeline-settings.css
  assets/js/pipeline-settings.js
  templates/admin/pipeline-settings-page.php
  templates/admin/pipeline-settings-prompt-panel.php

Modified:
  includes/admin/fields/class-open-router-model-field.php
  includes/class-prautoblogger.php
  prautoblogger.php (v0.23.0)
  ARCHITECTURE.md / INFORMATION-ARCHITECTURE.md / CHANGELOG.md

No new wp_options; uninstall unchanged.

Agent-Session: pipeline-settings-m1
2026-06-22 13:04:08 +00:00

35 lines
1.1 KiB
JavaScript

/**
* Pipeline Settings page — step rail and prompt editor interactions.
*
* Responsibilities:
* - Confirm before resetting a prompt to default (redundant safety; the
* PHP onclick already handles it, but JS enhances UX).
* - Wire the model-picker hidden input so the save_model form picks up
* the newly selected model id from the popup.
*
* @see admin/class-pipeline-settings-page.php — Enqueues this script.
* @see assets/js/model-picker.js — Handles the picker popup.
*/
/* global jQuery */
( function ( $ ) {
'use strict';
$( function () {
// When the model picker JS selects a model, update the hidden
// 'model_id' input in the same .pab-model-form so the save form
// carries the chosen value on submit.
$( document ).on( 'prautoblogger:model_selected', function ( e, data ) {
var $form = $( '.pab-model-form' );
var $hidden = $form.find( 'input[name="model_id"]' );
if ( 0 === $hidden.length ) {
$hidden = $( '<input type="hidden" name="model_id" />' );
$form.append( $hidden );
}
$hidden.val( data.model_id || data.id || '' );
} );
} );
}( jQuery ) );