| @@ -513,48 +513,39 @@ | ||
| 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 | 516 | $content_model = $options['content_model'] ?? ($options['model'] ?? 'gpt-5.6-sol'); |
| 517 | - // gpt-5.1-chat-latest removed 2026-08-02: OpenAI retires | |
| 518 | - // it 2026-08-10 (plan e46b8f); saved values migrate via | |
| 519 | - // mxchat_migrate_deprecated_models(). | |
| 520 | - $models = array( | |
| 521 | - 'OpenAI' => array( | |
| 522 | - 'gpt-5.6-sol' => 'GPT-5.6 Sol', | |
| 523 | - 'gpt-5.6-terra' => 'GPT-5.6 Terra', | |
| 524 | - 'gpt-5.6-luna' => 'GPT-5.6 Luna', | |
| 525 | - 'gpt-5.5' => 'GPT-5.5', | |
| 526 | - 'gpt-5.4' => 'GPT-5.4', | |
| 527 | - 'gpt-5.2' => 'GPT-5.2', | |
| 528 | - 'gpt-5' => 'GPT-5', | |
| 529 | - ), | |
| 530 | - 'Anthropic' => array( | |
| 531 | - 'claude-fable-5' => 'Claude Fable 5', | |
| 532 | - 'claude-opus-5' => 'Claude Opus 5', | |
| 533 | - 'claude-opus-4-8' => 'Claude Opus 4.8', | |
| 534 | - 'claude-opus-4-7' => 'Claude Opus 4.7', | |
| 535 | - 'claude-opus-4-6' => 'Claude Opus 4.6', | |
| 536 | - 'claude-sonnet-5' => 'Claude Sonnet 5', | |
| 537 | - 'claude-sonnet-4-6' => 'Claude Sonnet 4.6', | |
| 538 | - 'claude-haiku-4-5-20251001' => 'Claude Haiku 4.5', | |
| 539 | - ), | |
| 540 | - 'Google' => array( | |
| 541 | - 'gemini-3.5-flash' => 'Gemini 3.5 Flash', | |
| 542 | - 'gemini-3.1-pro-preview' => 'Gemini 3.1 Pro', | |
| 543 | - 'gemini-3-flash-preview' => 'Gemini 3 Flash', | |
| 544 | - 'gemini-3.1-flash-lite' => 'Gemini 3.1 Flash-Lite', | |
| 545 | - 'gemini-3.1-flash-lite-preview' => 'Gemini 3.1 Flash-Lite (Preview)', | |
| 546 | - 'gemini-2.5-pro' => 'Gemini 2.5 Pro', | |
| 547 | - 'gemini-2.5-flash' => 'Gemini 2.5 Flash', | |
| 548 | - 'gemini-2.5-flash-lite' => 'Gemini 2.5 Flash-Lite', | |
| 549 | - ), | |
| 550 | - 'xAI' => array( | |
| 551 | - 'grok-4-0709' => 'Grok 4', | |
| 552 | - 'grok-4-1-fast-non-reasoning' => 'Grok 4.1 Fast', | |
| 553 | - 'grok-code-fast-1' => 'Grok Code Fast', | |
| 554 | - ), | |
| 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() | |
| 555 | 526 | ); |
| 556 | - 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 | + } | |
| 557 | 548 | echo '<optgroup label="' . esc_attr($group) . '">'; |
| 558 | 549 | foreach ($group_models as $value => $label) { |
| 559 | 550 | $selected = selected($content_model, $value, false); |
| 560 | 551 | echo '<option value="' . esc_attr($value) . '" ' . $selected . '>' . esc_html($label) . '</option>'; |