PluginProbe
MxChat – AI Chatbot & Content Generation for WordPress / 3.2.23
MxChat – AI Chatbot & Content Generation for WordPress v3.2.23
3.2.25 3.2.24 3.2.23 3.2.22 3.2.21 3.2.20 3.2.19 3.2.18 3.2.17 3.2.16 3.2.15 3.2.14 3.2.12 3.2.13 3.2.11 3.2.10 3.2.9 3.2.8 3.2.7 3.2.6 3.2.5 3.2.4 3.2.3 3.2.2 3.2.1 All 156 releases
← All changes | admin/class-ajax-handler.php +28 -0 3.2.21 → 3.2.23 View file →
@@ -1057,8 +1057,36 @@
1057 1057 if ($field_name === 'mxchat_pinecone_host') {
1058 1058 $new_value = str_replace(['https://', 'http://'], '', $new_value);
1059 1059 }
1060 1060 break;
1061 + case 'mxchat_pinecone_index_type':
1062 + // 362c31: document only once the host has been checked (see sanitize_pinecone_settings).
1063 + $new_value = ($value === 'document') ? 'document' : 'vector';
1064 + if ($new_value === 'document' && strtolower(trim((string) ($current_options['mxchat_pinecone_host'] ?? ''), '/')) !== strtolower((string) ($current_options['mxchat_pinecone_docs_verified_host'] ?? ''))) {
1065 + wp_send_json_error(['message' => esc_html__('Check the document index host first (Check index or Create index for me).', 'mxchat')]);
1066 + }
1067 + // 3e83e4: same gate as the form save — no switch onto a half-copied index.
1068 + if ($new_value === 'document' && (($current_options['mxchat_pinecone_index_type'] ?? 'vector') !== 'document') && class_exists('MxChat_Pinecone_Documents')) {
1069 + $running = MxChat_Pinecone_Documents::migration_blocks_switch((string) ($current_options['mxchat_pinecone_host'] ?? ''));
1070 + if ($running !== null) {
1071 + wp_send_json_error(['message' => MxChat_Pinecone_Documents::switch_blocked_message($running)]);
1072 + }
1073 + }
1074 + break;
1075 + case 'mxchat_pinecone_vector_host':
1076 + $new_value = trim(str_replace(['https://', 'http://'], '', sanitize_text_field($value)), '/');
1077 + break;
1078 + case 'mxchat_pinecone_vector_index':
1079 + case 'mxchat_pinecone_docs_region':
1080 + $new_value = sanitize_text_field($value);
1081 + break;
1082 + case 'mxchat_pinecone_docs_cloud':
1083 + $new_value = in_array($value, array('aws', 'gcp', 'azure'), true) ? $value : 'aws';
1084 + break;
1085 + case 'mxchat_pinecone_docs_language':
1086 + $lang_value = sanitize_key($value);
1087 + $new_value = (class_exists('MxChat_Pinecone_Documents') && array_key_exists($lang_value, MxChat_Pinecone_Documents::languages())) ? $lang_value : 'en';
1088 + break;
1061 1089 case 'mxchat_pinecone_top_k':
1062 1090 // d0cae1: out-of-range and junk normalize to the default 50 —
1063 1091 // same clamp the read site applies.
1064 1092 $top_k = absint($value);