| @@ -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.5 | |
| 6 | + * Version: 3.1.8 | |
| 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 |
| @@ -262,9 +262,8 @@ | ||
| 262 | 262 | 'includes/class-mxchat-meta-box.php', |
| 263 | 263 | 'includes/class-mxchat-chunker.php', |
| 264 | 264 | 'includes/class-mxchat-word-handler.php', |
| 265 | 265 | 'includes/class-mxchat-content-generator.php', |
| 266 | - 'includes/class-rest-api.php', | |
| 267 | 266 | 'admin/class-ajax-handler.php', |
| 268 | 267 | 'admin/class-pinecone-manager.php', |
| 269 | 268 | 'admin/class-knowledge-manager.php' |
| 270 | 269 | ); |
| @@ -276,16 +275,8 @@ | ||
| 276 | 275 | } else { |
| 277 | 276 | //error_log('MxChat: Missing class file - ' . $file); |
| 278 | 277 | } |
| 279 | 278 | } |
| 280 | - | |
| 281 | - // Admin pages that aren't classes (procedural include). | |
| 282 | - if (is_admin()) { | |
| 283 | - $admin_api_page = plugin_dir_path(__FILE__) . 'includes/admin-api-page.php'; | |
| 284 | - if (file_exists($admin_api_page)) { | |
| 285 | - require_once $admin_api_page; | |
| 286 | - } | |
| 287 | - } | |
| 288 | 279 | } |
| 289 | 280 | |
| 290 | 281 | /** |
| 291 | 282 | * Lazy-load the PDF parser library only when needed. |
| @@ -617,33 +608,8 @@ | ||
| 617 | 608 | update_option('mxchat_content_type_migration_version', '2.5.6'); |
| 618 | 609 | } |
| 619 | 610 | |
| 620 | 611 | /** |
| 621 | - * 3.2.4: Backfill the active embedding model option for installs that already | |
| 622 | - * have KB content but no stamped model. The mismatch warning compares this | |
| 623 | - * against the user's currently selected model — no per-row column needed. | |
| 624 | - */ | |
| 625 | -function mxchat_backfill_active_embedding_model() { | |
| 626 | - global $wpdb; | |
| 627 | - | |
| 628 | - if (get_option('mxchat_active_embedding_model', '') !== '') { | |
| 629 | - return; | |
| 630 | - } | |
| 631 | - | |
| 632 | - $kb_table = $wpdb->prefix . 'mxchat_system_prompt_content'; | |
| 633 | - if ($wpdb->get_var("SHOW TABLES LIKE '{$kb_table}'") !== $kb_table) { | |
| 634 | - return; | |
| 635 | - } | |
| 636 | - | |
| 637 | - $kb_count = (int) $wpdb->get_var("SELECT COUNT(*) FROM {$kb_table}"); | |
| 638 | - if ($kb_count > 0) { | |
| 639 | - $options = get_option('mxchat_options', array()); | |
| 640 | - $current_model = $options['embedding_model'] ?? 'text-embedding-ada-002'; | |
| 641 | - update_option('mxchat_active_embedding_model', $current_model, false); | |
| 642 | - } | |
| 643 | -} | |
| 644 | - | |
| 645 | -/** | |
| 646 | 612 | * 2.5.2: Create queue processing tables for reliable background processing |
| 647 | 613 | */ |
| 648 | 614 | function mxchat_create_queue_tables() { |
| 649 | 615 | global $wpdb; |
| @@ -946,11 +912,8 @@ | ||
| 946 | 912 | |
| 947 | 913 | // Run migration for existing installations |
| 948 | 914 | mxchat_migrate_pinecone_roles_add_bot_id(); |
| 949 | 915 | |
| 950 | - // 3.2.4: Backfill active embedding model option (replaces 3.2.3 column-based tracking) | |
| 951 | - mxchat_backfill_active_embedding_model(); | |
| 952 | - | |
| 953 | 916 | // Setup cron jobs |
| 954 | 917 | mxchat_setup_cron_jobs(); |
| 955 | 918 | |
| 956 | 919 | // Update version |
| @@ -985,14 +948,13 @@ | ||
| 985 | 948 | // Clear fallback flags if cron scheduling succeeded |
| 986 | 949 | delete_option('mxchat_use_fallback_rate_limits'); |
| 987 | 950 | } |
| 988 | 951 | |
| 989 | - // Schedule transcript cleanup if configured (bucket dropdown OR custom retention-days > 0) | |
| 952 | + // Schedule transcript cleanup if configured | |
| 990 | 953 | $transcript_options = get_option('mxchat_transcripts_options', array()); |
| 991 | 954 | $cleanup_interval = isset($transcript_options['mxchat_auto_delete_transcripts']) ? $transcript_options['mxchat_auto_delete_transcripts'] : 'never'; |
| 992 | - $custom_retention = isset($transcript_options['mxchat_retention_days']) ? (int) $transcript_options['mxchat_retention_days'] : 0; | |
| 993 | - | |
| 994 | - if ($cleanup_interval !== 'never' || $custom_retention > 0) { | |
| 955 | + | |
| 956 | + if ($cleanup_interval !== 'never') { | |
| 995 | 957 | // Check if not already scheduled |
| 996 | 958 | if (!wp_next_scheduled('mxchat_cleanup_old_transcripts')) { |
| 997 | 959 | // Schedule to run daily at 3 AM |
| 998 | 960 | $next_run = strtotime('tomorrow 3:00 AM'); |
| @@ -1126,14 +1088,8 @@ | ||
| 1126 | 1088 | delete_option('mxchat_email_null'); |
| 1127 | 1089 | delete_option('mxchat_name_null'); |
| 1128 | 1090 | } |
| 1129 | 1091 | |
| 1130 | - // 3.2.4: Backfill active embedding model option for the warning UI | |
| 1131 | - // (replaces the per-row column tracking from 3.2.3, which was reverted) | |
| 1132 | - if (version_compare($current_version, '3.2.4', '<')) { | |
| 1133 | - mxchat_backfill_active_embedding_model(); | |
| 1134 | - } | |
| 1135 | - | |
| 1136 | 1092 | // Run full activation to ensure everything is up to date |
| 1137 | 1093 | mxchat_activate(); |
| 1138 | 1094 | |
| 1139 | 1095 | // Run migration functions |
| @@ -1356,16 +1312,8 @@ | ||
| 1356 | 1312 | // Initialize content generator globally — it registers wp_head hook |
| 1357 | 1313 | // for frontend CSS injection, plus wp_ajax_ hooks for admin. |
| 1358 | 1314 | if (class_exists('MxChat_Content_Generator')) { |
| 1359 | 1315 | new MxChat_Content_Generator(); |
| 1360 | - } | |
| 1361 | - | |
| 1362 | - // Initialize REST API globally — endpoints must be registered on | |
| 1363 | - // every request (admin and frontend) so they're reachable via /wp-json/. | |
| 1364 | - // Endpoints are auth-gated and locked until the site owner generates | |
| 1365 | - // a token in MxChat → API Access. | |
| 1366 | - if (class_exists('MxChat_Rest_Api')) { | |
| 1367 | - new MxChat_Rest_Api(); | |
| 1368 | 1316 | } |
| 1369 | 1317 | |
| 1370 | 1318 | // Initialize public classes |
| 1371 | 1319 | if (class_exists('MxChat_Public')) { |