| @@ -512,43 +512,40 @@ | ||
| 512 | 512 | <label class="mxch-field-label" for="mxch-content-model"><?php esc_html_e('Content Model', 'mxchat'); ?></label> |
| 513 | 513 | <div class="mxch-field-control"> |
| 514 | 514 | <select id="mxch-content-model" data-field="content_model" class="mxch-cg-select"> |
| 515 | 515 | <?php |
| 516 | - $content_model = $options['content_model'] ?? ($options['model'] ?? 'gpt-5.1-chat-latest'); | |
| 517 | - $models = array( | |
| 518 | - 'OpenAI' => array( | |
| 519 | - 'gpt-5.5' => 'GPT-5.5', | |
| 520 | - 'gpt-5.4' => 'GPT-5.4', | |
| 521 | - 'gpt-5.2' => 'GPT-5.2', | |
| 522 | - 'gpt-5.1-chat-latest' => 'GPT-5.1', | |
| 523 | - 'gpt-5' => 'GPT-5', | |
| 524 | - ), | |
| 525 | - 'Anthropic' => array( | |
| 526 | - 'claude-fable-5' => 'Claude Fable 5', | |
| 527 | - 'claude-opus-4-8' => 'Claude Opus 4.8', | |
| 528 | - 'claude-opus-4-7' => 'Claude Opus 4.7', | |
| 529 | - 'claude-opus-4-6' => 'Claude Opus 4.6', | |
| 530 | - 'claude-sonnet-5' => 'Claude Sonnet 5', | |
| 531 | - 'claude-sonnet-4-6' => 'Claude Sonnet 4.6', | |
| 532 | - 'claude-haiku-4-5-20251001' => 'Claude Haiku 4.5', | |
| 533 | - ), | |
| 534 | - 'Google' => array( | |
| 535 | - 'gemini-3.5-flash' => 'Gemini 3.5 Flash', | |
| 536 | - 'gemini-3.1-pro-preview' => 'Gemini 3.1 Pro', | |
| 537 | - 'gemini-3-flash-preview' => 'Gemini 3 Flash', | |
| 538 | - 'gemini-3.1-flash-lite' => 'Gemini 3.1 Flash-Lite', | |
| 539 | - 'gemini-3.1-flash-lite-preview' => 'Gemini 3.1 Flash-Lite (Preview)', | |
| 540 | - 'gemini-2.5-pro' => 'Gemini 2.5 Pro', | |
| 541 | - 'gemini-2.5-flash' => 'Gemini 2.5 Flash', | |
| 542 | - 'gemini-2.5-flash-lite' => 'Gemini 2.5 Flash-Lite', | |
| 543 | - ), | |
| 544 | - 'xAI' => array( | |
| 545 | - 'grok-4-0709' => 'Grok 4', | |
| 546 | - 'grok-4-1-fast-non-reasoning' => 'Grok 4.1 Fast', | |
| 547 | - 'grok-code-fast-1' => 'Grok Code Fast', | |
| 548 | - ), | |
| 516 | + $content_model = $options['content_model'] ?? ($options['model'] ?? 'gpt-5.6-sol'); | |
| 517 | + // Catalog-derived (plan ccb751): this select was the seventh | |
| 518 | + // hand-maintained model map and had drifted (it still offered | |
| 519 | + // a code model for content generation). It now renders from | |
| 520 | + // MxChat_Model_Catalog, restricted to the providers the | |
| 521 | + // generator can actually dispatch to — see | |
| 522 | + // MxChat_Content_Generator::supported_content_providers(). | |
| 523 | + $model_groups = MxChat_Model_Catalog::settings_dropdown_groups( | |
| 524 | + $content_model, | |
| 525 | + MxChat_Content_Generator::supported_content_providers() | |
| 549 | 526 | ); |
| 550 | - foreach ($models as $group => $group_models) { | |
| 527 | + // Round-trip guard: an install saved on an id the catalog no | |
| 528 | + // longer lists (e.g. grok-code-fast-1) keeps its selection | |
| 529 | + // rendered instead of silently snapping to the first option | |
| 530 | + // on the next save. | |
| 531 | + $mxch_cg_model_in_groups = false; | |
| 532 | + foreach ($model_groups as $group_models) { | |
| 533 | + if (array_key_exists($content_model, $group_models)) { | |
| 534 | + $mxch_cg_model_in_groups = true; | |
| 535 | + break; | |
| 536 | + } | |
| 537 | + } | |
| 538 | + if (!$mxch_cg_model_in_groups && $content_model !== '') { | |
| 539 | + $model_groups[__('Currently saved', 'mxchat')] = array( | |
| 540 | + /* translators: %s: model id */ | |
| 541 | + $content_model => sprintf(__('%s — no longer offered, choose a replacement', 'mxchat'), $content_model), | |
| 542 | + ); | |
| 543 | + } | |
| 544 | + foreach ($model_groups as $group => $group_models) { | |
| 545 | + if (empty($group_models)) { | |
| 546 | + continue; | |
| 547 | + } | |
| 551 | 548 | echo '<optgroup label="' . esc_attr($group) . '">'; |
| 552 | 549 | foreach ($group_models as $value => $label) { |
| 553 | 550 | $selected = selected($content_model, $value, false); |
| 554 | 551 | echo '<option value="' . esc_attr($value) . '" ' . $selected . '>' . esc_html($label) . '</option>'; |
| @@ -691,8 +688,29 @@ | ||
| 691 | 688 | <?php endif; ?> |
| 692 | 689 | <?php endif; ?> |
| 693 | 690 | </div> |
| 694 | 691 | |
| 692 | + </div> | |
| 693 | + </div> | |
| 694 | + | |
| 695 | + <!-- ── Editor Assistant (moved from Settings → Behavior, plan-f7df40) ── --> | |
| 696 | + <div class="mxch-card"> | |
| 697 | + <div class="mxch-card-header"> | |
| 698 | + <h3 class="mxch-card-title"> | |
| 699 | + <svg class="mxch-card-title-icon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 4V2"/><path d="M15 16v-2"/><path d="M8 9h2"/><path d="M20 9h2"/><path d="M17.8 11.8 19 13"/><path d="M15 9h.01"/><path d="M17.8 6.2 19 5"/><path d="m3 21 9-9"/><path d="M12.2 6.2 11 5"/></svg> | |
| 700 | + <?php esc_html_e('Editor Assistant', 'mxchat'); ?> | |
| 701 | + </h3> | |
| 702 | + </div> | |
| 703 | + <?php // mxchat-autosave-section: this toggle saves through the shared | |
| 704 | + // settings transport (mxchat-admin.js + the ajax-handler's | |
| 705 | + // mxchat_editor_assistant_enabled case), NOT the data-field | |
| 706 | + // transport the rest of this tab uses — keep those apart. ?> | |
| 707 | + <div class="mxch-card-body mxchat-autosave-section"> | |
| 708 | + <?php | |
| 709 | + mxchat_render_field_wrapper('mxchat_editor_assistant_enabled', __('Editor Assistant', 'mxchat'), function() use ($admin_instance) { | |
| 710 | + $admin_instance->mxchat_editor_assistant_toggle_callback(); | |
| 711 | + }, __('Add magic-wand AI writing actions (rewrite, summarize, translate, continue, fix grammar) to the WordPress block editor. Opens a sidebar in the post editor. Uses the chat AI model configured in MxChat Settings. Off by default.', 'mxchat')); | |
| 712 | + ?> | |
| 695 | 713 | </div> |
| 696 | 714 | </div> |
| 697 | 715 | |
| 698 | 716 | <!-- ── SEO Settings ── --> |