| @@ -154,16 +154,16 @@ | ||
| 154 | 154 | return $settings; |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | /* ────────────────────────────────────────────── |
| 158 | - * 2. Settings screen (Blockenberg → AI Agent) | |
| 158 | + * 2. Settings screen (Blockenberg → AI Agent Settings) | |
| 159 | 159 | * ────────────────────────────────────────────── */ |
| 160 | 160 | |
| 161 | 161 | add_action( 'admin_menu', function () { |
| 162 | 162 | add_submenu_page( |
| 163 | 163 | 'blockenberg', |
| 164 | - __( 'AI Agent', 'blockenberg' ), | |
| 165 | - __( 'AI Agent', 'blockenberg' ), | |
| 164 | + __( 'AI Agent Settings', 'blockenberg' ), | |
| 165 | + __( 'AI Agent Settings', 'blockenberg' ), | |
| 166 | 166 | 'manage_options', |
| 167 | 167 | 'blockenberg-ai', |
| 168 | 168 | 'bkbg_ai_render_settings_page' |
| 169 | 169 | ); |
| @@ -249,10 +249,10 @@ | ||
| 249 | 249 | ?> |
| 250 | 250 | <div class="wrap bkbg-ai-settings"> |
| 251 | 251 | <header class="bkbg-ai-settings-header"> |
| 252 | 252 | <div> |
| 253 | - <p class="bkbg-ai-settings-eyebrow">Blockenberg</p> | |
| 254 | - <h1><?php esc_html_e( 'AI Agent', 'blockenberg' ); ?></h1> | |
| 253 | + <p class="bkbg-ai-settings-eyebrow"><svg viewBox="0 0 24 24" aria-hidden="true"><rect x="2" y="2" width="8" height="8" rx="1.5"/><rect x="14" y="2" width="8" height="8" rx="1.5"/><rect x="2" y="14" width="8" height="8" rx="1.5"/><rect x="14" y="14" width="8" height="8" rx="1.5"/></svg><span>Blockenberg</span></p> | |
| 254 | + <h1><?php esc_html_e( 'AI Agent Settings', 'blockenberg' ); ?></h1> | |
| 255 | 255 | <p><?php esc_html_e( 'Build and edit pages by chatting in the WordPress editor.', 'blockenberg' ); ?></p> |
| 256 | 256 | </div> |
| 257 | 257 | <span id="bkbg-ai-connection-status" class="bkbg-ai-status<?php echo $has_key ? ' is-configured' : ''; ?>"> |
| 258 | 258 | <span class="bkbg-ai-status-dot" aria-hidden="true"></span> |
| @@ -284,9 +284,9 @@ | ||
| 284 | 284 | placeholder="<?php echo $has_key ? esc_attr__( 'Saved key — leave blank to keep it', 'blockenberg' ) : 'sk-or-v1-…'; ?>" |
| 285 | 285 | aria-describedby="bkbg-ai-key-help" /> |
| 286 | 286 | <p id="bkbg-ai-key-help" class="bkbg-ai-help"><?php esc_html_e( 'Your saved key stays on the server. Enter a new key to replace it.', 'blockenberg' ); ?></p> |
| 287 | 287 | <?php if ( ! empty( $s['api_key'] ) ) : ?> |
| 288 | - <label class="bkbg-ai-check bkbg-ai-remove-key"><input type="checkbox" id="bkbg-ai-remove-key" name="remove_api_key" value="1" /><?php esc_html_e( 'Remove the saved key when I save', 'blockenberg' ); ?></label> | |
| 288 | + <label class="bkbg-ai-check bkbg-ai-remove-key"><input type="checkbox" id="bkbg-ai-remove-key" name="remove_api_key" value="1" /><?php esc_html_e( 'Hide the saved key: Once the key is successfully saved, clear the input field so the key is no longer visible.', 'blockenberg' ); ?></label> | |
| 289 | 289 | <?php endif; ?> |
| 290 | 290 | <?php endif; ?> |
| 291 | 291 | <div class="bkbg-ai-field-actions"> |
| 292 | 292 | <button type="button" class="button" id="bkbg-ai-test"><span class="dashicons dashicons-yes-alt" aria-hidden="true"></span><?php esc_html_e( 'Test connection', 'blockenberg' ); ?></button> |
| @@ -559,9 +559,9 @@ | ||
| 559 | 559 | */ |
| 560 | 560 | function bkbg_ai_rest_chat( WP_REST_Request $request ) { |
| 561 | 561 | $key = bkbg_ai_get_api_key(); |
| 562 | 562 | if ( '' === $key ) { |
| 563 | - return new WP_Error( 'bkbg_ai_no_key', __( 'No OpenRouter API key is configured. Add one under Blockenberg → AI Agent.', 'blockenberg' ), array( 'status' => 400 ) ); | |
| 563 | + return new WP_Error( 'bkbg_ai_no_key', __( 'No OpenRouter API key is configured. Add one under Blockenberg → AI Agent Settings.', 'blockenberg' ), array( 'status' => 400 ) ); | |
| 564 | 564 | } |
| 565 | 565 | |
| 566 | 566 | $settings = bkbg_ai_get_settings(); |
| 567 | 567 | $params = $request->get_json_params(); |
| @@ -743,9 +743,9 @@ | ||
| 743 | 743 | * @return array|WP_Error |
| 744 | 744 | */ |
| 745 | 745 | function bkbg_ai_openrouter_post( $path, $payload, $timeout = 120 ) { |
| 746 | 746 | if ( '' === bkbg_ai_get_api_key() ) { |
| 747 | - return new WP_Error( 'bkbg_ai_no_key', __( 'No OpenRouter API key is configured. Add one under Blockenberg → AI Agent.', 'blockenberg' ), array( 'status' => 400 ) ); | |
| 747 | + return new WP_Error( 'bkbg_ai_no_key', __( 'No OpenRouter API key is configured. Add one under Blockenberg → AI Agent Settings.', 'blockenberg' ), array( 'status' => 400 ) ); | |
| 748 | 748 | } |
| 749 | 749 | |
| 750 | 750 | $response = wp_remote_post( 'https://openrouter.ai/api/v1/' . ltrim( $path, '/' ), array( |
| 751 | 751 | 'timeout' => $timeout, |
| @@ -1100,9 +1100,9 @@ | ||
| 1100 | 1100 | return new WP_Error( |
| 1101 | 1101 | 'bkbg_ai_no_image', |
| 1102 | 1102 | sprintf( |
| 1103 | 1103 | /* translators: %s: model id */ |
| 1104 | - __( 'The model %s did not return an image. Pick an image-capable model under Blockenberg → AI Agent.', 'blockenberg' ), | |
| 1104 | + __( 'The model %s did not return an image. Pick an image-capable model under Blockenberg → AI Agent Settings.', 'blockenberg' ), | |
| 1105 | 1105 | $model |
| 1106 | 1106 | ), |
| 1107 | 1107 | array( 'status' => 502 ) |
| 1108 | 1108 | ); |