feat(models): OpenRouter model picker + AJAX refresh + cost preview (v0.11.0 complete)
- AJAX endpoint 'prautoblogger_refresh_models' for manual model registry refresh - Admin UI button on AI Models tab to trigger refresh (nonce + capability gated) - Cost preview integration in field renderer using historical token averages - New public method on Cost Tracker: get_avg_tokens_for_stages(array $stages, int $days = 30): array - Enhanced field renderer with capability-specific cost calculation (outline+draft+polish for writing, single stage for analysis/editor) - Autoloader updated to scan ajax/ directory for model registry refresh handler - Admin JS enhanced with AJAX toggle handler for refresh button - Template updated with refresh button + nonce in AI Models section - CHANGELOG + CONVENTIONS + version bump to 0.11.0 - All files under 300-line cap, PHPCS-clean Spec: https://github.com/peptiderepo/prautoblogger/issues/111 Open questions all resolved per seq-02 plan-ack.
This commit is contained in:
18
templates/admin/settings-page.php
Executable file → Normal file
18
templates/admin/settings-page.php
Executable file → Normal file
@@ -104,12 +104,18 @@ $next_run = wp_next_scheduled( 'prautoblogger_daily_generation' );
|
||||
<div class="ab-panel <?php echo $active_tab === $sid ? 'ab-panel-active' : ''; ?>"
|
||||
data-tab="<?php echo esc_attr( $sid ); ?>"
|
||||
role="tabpanel">
|
||||
<div class="ab-panel-head">
|
||||
<h2 class="ab-panel-title"><?php echo esc_html( $sec['title'] ); ?></h2>
|
||||
<?php if ( ! empty( $sec['description'] ) ) : ?>
|
||||
<p class="ab-panel-desc"><?php echo esc_html( $sec['description'] ); ?></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="ab-panel-head">
|
||||
<h2 class="ab-panel-title"><?php echo esc_html( $sec['title'] ); ?></h2>
|
||||
<?php if ( ! empty( $sec['description'] ) ) : ?>
|
||||
<p class="ab-panel-desc"><?php echo esc_html( $sec['description'] ); ?></p>
|
||||
<?php endif; ?>
|
||||
<?php if ( 'prautoblogger_models' === $sid ) : ?>
|
||||
<button type="button" id="prautoblogger-refresh-models" class="ab-btn ab-btn-secondary ab-btn-sm" data-nonce="<?php echo esc_attr( wp_create_nonce( 'prautoblogger_refresh_models' ) ); ?>">
|
||||
<span class="dashicons dashicons-update"></span>
|
||||
<span class="ab-btn-label"><?php esc_html_e( 'Refresh Model List', 'prautoblogger' ); ?></span>
|
||||
</button>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<table class="form-table ab-form-table" role="presentation">
|
||||
<?php do_settings_fields( 'prautoblogger-settings', $sid ); ?>
|
||||
</table>
|
||||
|
||||
Reference in New Issue
Block a user