| @@ -2,9 +2,9 @@ | ||
| 2 | 2 | /** |
| 3 | 3 | * Plugin Name: MxChat |
| 4 | 4 | * Plugin URI: https://mxchat.ai/ |
| 5 | 5 | * Description: AI chatbot for WordPress with OpenAI, Claude, xAI, DeepSeek, live agent, PDF uploads, WooCommerce, and training on website data. |
| 6 | - * Version: 3.2.4 | |
| 6 | + * Version: 3.1.4 | |
| 7 | 7 | * Author: MxChat |
| 8 | 8 | * Author URI: https://mxchat.ai |
| 9 | 9 | * License: GPLv2 or later |
| 10 | 10 | * License URI: https://www.gnu.org/licenses/gpl-2.0.html |
| @@ -608,33 +608,8 @@ | ||
| 608 | 608 | update_option('mxchat_content_type_migration_version', '2.5.6'); |
| 609 | 609 | } |
| 610 | 610 | |
| 611 | 611 | /** |
| 612 | - * 3.2.4: Backfill the active embedding model option for installs that already | |
| 613 | - * have KB content but no stamped model. The mismatch warning compares this | |
| 614 | - * against the user's currently selected model — no per-row column needed. | |
| 615 | - */ | |
| 616 | -function mxchat_backfill_active_embedding_model() { | |
| 617 | - global $wpdb; | |
| 618 | - | |
| 619 | - if (get_option('mxchat_active_embedding_model', '') !== '') { | |
| 620 | - return; | |
| 621 | - } | |
| 622 | - | |
| 623 | - $kb_table = $wpdb->prefix . 'mxchat_system_prompt_content'; | |
| 624 | - if ($wpdb->get_var("SHOW TABLES LIKE '{$kb_table}'") !== $kb_table) { | |
| 625 | - return; | |
| 626 | - } | |
| 627 | - | |
| 628 | - $kb_count = (int) $wpdb->get_var("SELECT COUNT(*) FROM {$kb_table}"); | |
| 629 | - if ($kb_count > 0) { | |
| 630 | - $options = get_option('mxchat_options', array()); | |
| 631 | - $current_model = $options['embedding_model'] ?? 'text-embedding-ada-002'; | |
| 632 | - update_option('mxchat_active_embedding_model', $current_model, false); | |
| 633 | - } | |
| 634 | -} | |
| 635 | - | |
| 636 | -/** | |
| 637 | 612 | * 2.5.2: Create queue processing tables for reliable background processing |
| 638 | 613 | */ |
| 639 | 614 | function mxchat_create_queue_tables() { |
| 640 | 615 | global $wpdb; |
| @@ -766,9 +741,9 @@ | ||
| 766 | 741 | if (in_array($current_model, $deprecated_claude_models, true)) { |
| 767 | 742 | $options['model'] = 'claude-opus-4-6'; |
| 768 | 743 | $migrated = true; |
| 769 | 744 | $migration_message = sprintf( |
| 770 | - 'Your chatbot model has been automatically updated from %s to Claude Opus 4.6 due to Anthropic deprecating older Claude models.', | |
| 745 | + __('Your chatbot model has been automatically updated from %s to Claude Opus 4.6 due to Anthropic deprecating older Claude models.', 'mxchat'), | |
| 771 | 746 | $current_model |
| 772 | 747 | ); |
| 773 | 748 | } |
| 774 | 749 | |
| @@ -775,9 +750,9 @@ | ||
| 775 | 750 | // Migrate deprecated Claude Haiku 3.5 to Claude Haiku 4.5 |
| 776 | 751 | if ($current_model === 'claude-3-5-haiku-20241022') { |
| 777 | 752 | $options['model'] = 'claude-haiku-4-5-20251001'; |
| 778 | 753 | $migrated = true; |
| 779 | - $migration_message = 'Your chatbot model has been automatically updated from Claude Haiku 3.5 to Claude Haiku 4.5 due to Anthropic deprecating the older model.'; | |
| 754 | + $migration_message = __('Your chatbot model has been automatically updated from Claude Haiku 3.5 to Claude Haiku 4.5 due to Anthropic deprecating the older model.', 'mxchat'); | |
| 780 | 755 | } |
| 781 | 756 | |
| 782 | 757 | // Migrate deprecated GPT-4 series and GPT-3.5 Turbo to GPT-5.1 Chat Latest |
| 783 | 758 | if (in_array($current_model, array('gpt-4o', 'gpt-4.1-2025-04-14', 'gpt-4-turbo', 'gpt-4', 'gpt-3.5-turbo'), true)) { |
| @@ -783,9 +758,9 @@ | ||
| 783 | 758 | if (in_array($current_model, array('gpt-4o', 'gpt-4.1-2025-04-14', 'gpt-4-turbo', 'gpt-4', 'gpt-3.5-turbo'), true)) { |
| 784 | 759 | $options['model'] = 'gpt-5.1-chat-latest'; |
| 785 | 760 | $migrated = true; |
| 786 | 761 | $migration_message = sprintf( |
| 787 | - 'Your chatbot model has been automatically updated from %s to GPT-5.1 Chat Latest due to OpenAI deprecating older models.', | |
| 762 | + __('Your chatbot model has been automatically updated from %s to GPT-5.1 Chat Latest due to OpenAI deprecating older models.', 'mxchat'), | |
| 788 | 763 | $current_model |
| 789 | 764 | ); |
| 790 | 765 | } |
| 791 | 766 | |
| @@ -793,9 +768,9 @@ | ||
| 793 | 768 | if (in_array($current_model, array('gpt-4o-mini', 'gpt-4.1-mini'), true)) { |
| 794 | 769 | $options['model'] = 'gpt-5-mini'; |
| 795 | 770 | $migrated = true; |
| 796 | 771 | $migration_message = sprintf( |
| 797 | - 'Your chatbot model has been automatically updated from %s to GPT-5 Mini due to OpenAI deprecating GPT-4 series models.', | |
| 772 | + __('Your chatbot model has been automatically updated from %s to GPT-5 Mini due to OpenAI deprecating GPT-4 series models.', 'mxchat'), | |
| 798 | 773 | $current_model |
| 799 | 774 | ); |
| 800 | 775 | } |
| 801 | 776 | |
| @@ -862,26 +837,13 @@ | ||
| 862 | 837 | enabled_bots LONGTEXT DEFAULT NULL, |
| 863 | 838 | PRIMARY KEY (id) |
| 864 | 839 | ) $charset_collate;"; |
| 865 | 840 | |
| 866 | - // Individual Intent Phrases Table - each phrase gets its own embedding vector | |
| 867 | - $intent_phrases_table = $wpdb->prefix . 'mxchat_intent_phrases'; | |
| 868 | - $sql_intent_phrases_table = "CREATE TABLE $intent_phrases_table ( | |
| 869 | - id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, | |
| 870 | - intent_id BIGINT(20) UNSIGNED NOT NULL, | |
| 871 | - phrase TEXT NOT NULL, | |
| 872 | - embedding_vector LONGTEXT NOT NULL, | |
| 873 | - created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, | |
| 874 | - PRIMARY KEY (id), | |
| 875 | - KEY intent_id (intent_id) | |
| 876 | - ) $charset_collate;"; | |
| 877 | - | |
| 878 | 841 | require_once ABSPATH . 'wp-admin/includes/upgrade.php'; |
| 879 | 842 | |
| 880 | 843 | // Create other tables |
| 881 | 844 | dbDelta($sql_system_prompt); |
| 882 | 845 | dbDelta($sql_intents_table); |
| 883 | - dbDelta($sql_intent_phrases_table); | |
| 884 | 846 | |
| 885 | 847 | // Create URL click tracking table |
| 886 | 848 | mxchat_create_url_clicks_table(); |
| 887 | 849 | |
| @@ -937,11 +899,8 @@ | ||
| 937 | 899 | |
| 938 | 900 | // Run migration for existing installations |
| 939 | 901 | mxchat_migrate_pinecone_roles_add_bot_id(); |
| 940 | 902 | |
| 941 | - // 3.2.4: Backfill active embedding model option (replaces 3.2.3 column-based tracking) | |
| 942 | - mxchat_backfill_active_embedding_model(); | |
| 943 | - | |
| 944 | 903 | // Setup cron jobs |
| 945 | 904 | mxchat_setup_cron_jobs(); |
| 946 | 905 | |
| 947 | 906 | // Update version |
| @@ -1110,20 +1069,8 @@ | ||
| 1110 | 1069 | if (version_compare($current_version, '3.1.2', '<')) { |
| 1111 | 1070 | mxchat_migrate_transcripts_charset(); |
| 1112 | 1071 | } |
| 1113 | 1072 | |
| 1114 | - // 3.1.7: Clean up stale shared session email/name entries | |
| 1115 | - if (version_compare($current_version, '3.1.7', '<')) { | |
| 1116 | - delete_option('mxchat_email_null'); | |
| 1117 | - delete_option('mxchat_name_null'); | |
| 1118 | - } | |
| 1119 | - | |
| 1120 | - // 3.2.4: Backfill active embedding model option for the warning UI | |
| 1121 | - // (replaces the per-row column tracking from 3.2.3, which was reverted) | |
| 1122 | - if (version_compare($current_version, '3.2.4', '<')) { | |
| 1123 | - mxchat_backfill_active_embedding_model(); | |
| 1124 | - } | |
| 1125 | - | |
| 1126 | 1073 | // Run full activation to ensure everything is up to date |
| 1127 | 1074 | mxchat_activate(); |
| 1128 | 1075 | |
| 1129 | 1076 | // Run migration functions |
| @@ -1294,9 +1241,9 @@ | ||
| 1294 | 1241 | // Check if we're upgrading TO 3.0.1 and haven't handled this yet |
| 1295 | 1242 | if (version_compare($current_version, $target_version, '<') && !$update_handled) { |
| 1296 | 1243 | // Check if Pro is activated - only show to Pro users |
| 1297 | 1244 | $license_status = get_option('mxchat_license_status', 'inactive'); |
| 1298 | - $is_pro = ($license_status === 'active'); | |
| 1245 | + $is_pro = ($license_status === 'active' || $license_status === esc_html__('active', 'mxchat')); | |
| 1299 | 1246 | |
| 1300 | 1247 | if ($is_pro) { |
| 1301 | 1248 | // Set flag to show the theme migration notification banner |
| 1302 | 1249 | update_option('mxchat_show_theme_migration_notice', true); |