Changeset 3453818
- Timestamp:
- 02/04/2026 01:14:52 PM (8 weeks ago)
- Location:
- ai-search
- Files:
-
- 42 added
- 4 edited
-
tags/1.18.0 (added)
-
tags/1.18.0/admin (added)
-
tags/1.18.0/admin/class-admin-manager.php (added)
-
tags/1.18.0/admin/class-post-meta-box.php (added)
-
tags/1.18.0/admin/class-quota-manager.php (added)
-
tags/1.18.0/admin/class-settings-pages.php (added)
-
tags/1.18.0/admin/class-setup-wizard.php (added)
-
tags/1.18.0/admin/css (added)
-
tags/1.18.0/admin/css/admin-settings.css (added)
-
tags/1.18.0/admin/views (added)
-
tags/1.18.0/admin/views/components (added)
-
tags/1.18.0/admin/views/components/hybrid-balance-slider.php (added)
-
tags/1.18.0/admin/views/components/threshold-slider.php (added)
-
tags/1.18.0/admin/views/settings-cache.php (added)
-
tags/1.18.0/admin/views/settings-custom-fields.php (added)
-
tags/1.18.0/admin/views/settings-embeddings.php (added)
-
tags/1.18.0/admin/views/settings-general.php (added)
-
tags/1.18.0/admin/views/settings-quota.php (added)
-
tags/1.18.0/admin/views/settings-search-config.php (added)
-
tags/1.18.0/admin/views/settings-woocommerce.php (added)
-
tags/1.18.0/admin/views/wizard (added)
-
tags/1.18.0/admin/views/wizard/completion.php (added)
-
tags/1.18.0/admin/views/wizard/step-custom-fields.php (added)
-
tags/1.18.0/admin/views/wizard/step-final.php (added)
-
tags/1.18.0/admin/views/wizard/step-provider.php (added)
-
tags/1.18.0/admin/views/wizard/step-welcome.php (added)
-
tags/1.18.0/ai-search.php (added)
-
tags/1.18.0/assets (added)
-
tags/1.18.0/assets/icon.svg (added)
-
tags/1.18.0/includes (added)
-
tags/1.18.0/includes/class-ai-search-service.php (added)
-
tags/1.18.0/includes/class-rest-api.php (added)
-
tags/1.18.0/languages (added)
-
tags/1.18.0/languages/wp-plugins-ai-search-stable-es.po (added)
-
tags/1.18.0/languages/wp-plugins-ai-search-stable-pt.po (added)
-
tags/1.18.0/languages/wp-plugins-ai-search-stable-readme-de.po (added)
-
tags/1.18.0/languages/wp-plugins-ai-search-stable-readme-es.po (added)
-
tags/1.18.0/languages/wp-plugins-ai-search-stable-readme-fr.po (added)
-
tags/1.18.0/languages/wp-plugins-ai-search-stable-readme-ja.po (added)
-
tags/1.18.0/languages/wp-plugins-ai-search-stable-readme-pt_BR.po (added)
-
tags/1.18.0/readme.txt (added)
-
trunk/admin/views/components/threshold-slider.php (modified) (5 diffs)
-
trunk/admin/views/settings-general.php (modified) (5 diffs)
-
trunk/ai-search.php (modified) (13 diffs)
-
trunk/includes/class-rest-api.php (added)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ai-search/trunk/admin/views/components/threshold-slider.php
r3447176 r3453818 3 3 * Reusable Similarity Threshold Slider Component 4 4 * 5 * @param float $current_value Current threshold value (0. 5-1.0)5 * @param float $current_value Current threshold value (0.1-1.0) 6 6 * @param string $context 'wizard' or 'settings' - determines styling and features 7 7 */ … … 31 31 id="similarity_threshold_display" 32 32 class="ai-search-threshold-slider" 33 min=" 50"33 min="10" 34 34 max="100" 35 35 step="1" … … 38 38 39 39 <div class="ai-search-threshold-labels"> 40 <span><?php esc_html_e( ' 50% -Broad', 'ai-search' ); ?></span>40 <span><?php esc_html_e( '10% - Very Broad', 'ai-search' ); ?></span> 41 41 <span class="recommended"><?php esc_html_e( '65% Recommended', 'ai-search' ); ?></span> 42 42 <span><?php esc_html_e( '100% - Exact Match', 'ai-search' ); ?></span> … … 62 62 <p> 63 63 <strong><?php esc_html_e( 'Guidelines:', 'ai-search' ); ?></strong> 64 <?php esc_html_e( ' 50-60% (Broad) | 60-70% (Balanced) | 70-80% (Precise) | 80%+ (Very Strict)', 'ai-search' ); ?>64 <?php esc_html_e( '10-30% (Very Broad) | 30-60% (Broad) | 60-70% (Balanced) | 70-80% (Precise) | 80%+ (Very Strict)', 'ai-search' ); ?> 65 65 </p> 66 66 <p style="font-size: 12px; color: #666;"> … … 94 94 if (!icon || !label || !description || !indicator) return; 95 95 96 if (thresholdValue < 0.60) { 96 if (thresholdValue < 0.30) { 97 icon.textContent = "<?php esc_html_e( 'VERY BROAD', 'ai-search' ); ?>"; 98 label.textContent = "<?php esc_html_e( 'Very Broad Search', 'ai-search' ); ?>"; 99 label.style.color = "#8B0000"; 100 description.textContent = "<?php esc_html_e( 'Returns almost everything, even loosely related content. Useful when semantic scores are generally low.', 'ai-search' ); ?>"; 101 indicator.style.borderLeftColor = "#8B0000"; 102 indicator.style.background = "#fff0f0"; 103 } else if (thresholdValue < 0.60) { 97 104 icon.textContent = "<?php esc_html_e( 'BROAD', 'ai-search' ); ?>"; 98 105 label.textContent = "<?php esc_html_e( 'Broad Search', 'ai-search' ); ?>"; -
ai-search/trunk/admin/views/settings-general.php
r3451586 r3453818 10 10 $service_token = get_option( 'ai_search_service_token', '' ); 11 11 $badge_public = get_option( 'ai_search_badge_public', false ); 12 $openai_model = get_option( 'ai_search_openai_model', 'text-embedding-3-small' ); 12 13 13 14 // Handle connection check messages … … 58 59 update_option( 'ai_search_badge_public', isset( $_POST['badge_public'] ) && $_POST['badge_public'] === '1' ); 59 60 61 // Save OpenAI model selection 62 $allowed_models = [ 'text-embedding-3-small', 'text-embedding-3-large' ]; 63 $selected_model = isset( $_POST['openai_model'] ) ? sanitize_text_field( $_POST['openai_model'] ) : 'text-embedding-3-small'; 64 if ( in_array( $selected_model, $allowed_models, true ) ) { 65 update_option( 'ai_search_openai_model', $selected_model ); 66 } 67 60 68 // Handle AI service registration 61 69 $service_client = new AI_Search_Service(); … … 78 86 $service_token = get_option( 'ai_search_service_token', '' ); 79 87 $badge_public = get_option( 'ai_search_badge_public', false ); 88 $openai_model = get_option( 'ai_search_openai_model', 'text-embedding-3-small' ); 80 89 } 81 90 ?> … … 105 114 <input type="text" id="api_key" name="api_key" value="<?php echo esc_attr( $api_key ); ?>" class="regular-text" /> 106 115 <p class="description"><?php esc_html_e( 'Enter your OpenAI API key to use your own account for embeddings.', 'ai-search' ); ?></p> 116 </td> 117 </tr> 118 119 <tr id="openai-model-row" style="display: <?php echo ( $provider === 'openai' ? 'table-row' : 'none' ); ?>;"> 120 <th scope="row"> 121 <label for="openai_model"><?php esc_html_e( 'Embedding Model', 'ai-search' ); ?></label> 122 </th> 123 <td> 124 <select id="openai_model" name="openai_model"> 125 <option value="text-embedding-3-small" <?php selected( $openai_model, 'text-embedding-3-small' ); ?>><?php esc_html_e( 'text-embedding-3-small (Recommended)', 'ai-search' ); ?></option> 126 <option value="text-embedding-3-large" <?php selected( $openai_model, 'text-embedding-3-large' ); ?>><?php esc_html_e( 'text-embedding-3-large (Higher quality)', 'ai-search' ); ?></option> 127 </select> 128 <p class="description"><?php esc_html_e( 'The small model offers great performance at lower cost. The large model provides higher accuracy but costs more. Changing model requires regenerating all embeddings.', 'ai-search' ); ?></p> 107 129 </td> 108 130 </tr> … … 145 167 function aiSearchToggleApiKey() { 146 168 var provider = document.getElementById("provider").value; 147 document.getElementById("openai-key-row").style.display = (provider === "openai") ? "table-row" : "none"; 169 var isOpenAI = provider === "openai"; 170 document.getElementById("openai-key-row").style.display = isOpenAI ? "table-row" : "none"; 171 document.getElementById("openai-model-row").style.display = isOpenAI ? "table-row" : "none"; 148 172 document.getElementById("service-status-row").style.display = (provider === "ai_service") ? "table-row" : "none"; 149 173 } -
ai-search/trunk/ai-search.php
r3451586 r3453818 3 3 * Plugin Name: AI Search 4 4 * Description: Replaces the default search with an intelligent search system. 5 * Version: 1.1 7.05 * Version: 1.18.0 6 6 * Author: Samuel Silva 7 7 * Author URI: https://samuelsilva.pt … … 17 17 18 18 // Define plugin constants 19 define( 'AI_SEARCH_VERSION', '1.1 7.0' );19 define( 'AI_SEARCH_VERSION', '1.18.0' ); 20 20 define( 'AI_SEARCH_PATH', plugin_dir_path( __FILE__ ) ); 21 21 define( 'AI_SEARCH_URL', plugin_dir_url( __FILE__ ) ); … … 24 24 // Load dependencies 25 25 require_once AI_SEARCH_PATH . 'includes/class-ai-search-service.php'; 26 require_once AI_SEARCH_PATH . 'includes/class-rest-api.php'; 26 27 require_once AI_SEARCH_PATH . 'admin/class-admin-manager.php'; 27 28 … … 39 40 * Plugin version. 40 41 */ 41 const VERSION = '1.1 6.0';42 const VERSION = '1.18.0'; 42 43 43 44 /** … … 101 102 102 103 $this->register_hooks(); 103 104 105 // Initialize REST API 106 new AI_Search_REST_API(); 107 104 108 // Initialize admin interface if in admin area 105 109 if ( is_admin() ) { … … 434 438 'body' => wp_json_encode([ 435 439 'input' => $content, 436 'model' => 'text-embedding-ada-002',440 'model' => get_option( 'ai_search_openai_model', 'text-embedding-3-small' ), 437 441 ]), 438 442 ]); … … 498 502 if ( current_user_can( 'manage_options' ) && isset( $_GET['ai_threshold'] ) ) { 499 503 $threshold = floatval( $_GET['ai_threshold'] ); 500 $threshold = max( 0. 5, min( 1.0, $threshold ) ); // Clamp between 0.5 and 1.0504 $threshold = max( 0.1, min( 1.0, $threshold ) ); // Clamp between 0.5 and 1.0 501 505 } 502 506 … … 772 776 if ( current_user_can( 'manage_options' ) && isset( $_GET['ai_threshold'] ) ) { 773 777 $threshold = floatval( $_GET['ai_threshold'] ); 774 $threshold = max( 0. 5, min( 1.0, $threshold ) );778 $threshold = max( 0.1, min( 1.0, $threshold ) ); 775 779 } 776 780 … … 1221 1225 if ( isset( $_GET['ai_threshold'] ) ) { 1222 1226 $current_threshold = floatval( $_GET['ai_threshold'] ); 1223 $current_threshold = max( 0. 5, min( 1.0, $current_threshold ) );1227 $current_threshold = max( 0.1, min( 1.0, $current_threshold ) ); 1224 1228 } 1225 1229 … … 1240 1244 <input type="range" 1241 1245 id="ai-search-frontend-threshold" 1242 min=" 50"1246 min="10" 1243 1247 max="100" 1244 1248 step="1" … … 1246 1250 style="width: 100%; margin: 10px 0;"> 1247 1251 <div style="display: flex; justify-content: space-between; font-size: 10px; color: #666; margin-bottom: 10px;"> 1248 <span> 50% -Broad</span>1252 <span>10% - Very Broad</span> 1249 1253 <span>100% - Exact</span> 1250 1254 </div> … … 1285 1289 var label, description, color, bg; 1286 1290 1287 if (threshold < 0.60) { 1291 if (threshold < 0.30) { 1292 label = 'Very Broad Search'; 1293 description = 'Returns almost everything, even loosely related content.'; 1294 color = '#8B0000'; 1295 bg = '#fff0f0'; 1296 } else if (threshold < 0.60) { 1288 1297 label = 'Broad Search'; 1289 1298 description = 'Many results including loosely related content.'; … … 1397 1406 1398 1407 $threshold = isset( $_POST['threshold'] ) ? floatval( $_POST['threshold'] ) : 0.65; 1399 $threshold = max( 0. 5, min( 1.0, $threshold ) );1408 $threshold = max( 0.1, min( 1.0, $threshold ) ); 1400 1409 1401 1410 update_option( 'ai_search_similarity_threshold', $threshold ); -
ai-search/trunk/readme.txt
r3451586 r3453818 3 3 Tags: search, AI, semantic search, WooCommerce, ecommerce, product search, smart search, OpenAI 4 4 Tested up to: 6.8 5 Stable tag: 1.1 7.05 Stable tag: 1.18.0 6 6 Requires PHP: 8.0 7 7 License: GPLv2 … … 122 122 123 123 == Changelog == 124 125 = 1.18.0 = 126 - **REST API Settings Endpoint**: New public endpoint at `/wp-json/ai-search/v1/settings` exposing plugin configuration for debugging (no sensitive data) 127 - **OpenAI Model Selection**: Choose between `text-embedding-3-small` (default, recommended) and `text-embedding-3-large` when using your own OpenAI API key 128 - **Extended Threshold Range**: Similarity threshold now supports 10-100% (previously 50-100%) for broader search flexibility 129 - **Updated Default Model**: OpenAI embeddings now use `text-embedding-3-small` instead of the older `text-embedding-ada-002` 124 130 125 131 = 1.17.0 =
Note: See TracChangeset
for help on using the changeset viewer.