Token Validation Successful!

'; if ( isset( $validation_data['client'] ) ) { $client = $validation_data['client']; echo ''; } echo ''; delete_transient( 'ai_search_validation_data' ); } } elseif ( $validation_status === 'invalid' ) { $error_data = get_transient( 'ai_search_validation_error' ); echo '

Token Validation Failed!

'; if ( $error_data && isset( $error_data['details'] ) ) { echo '

Error: ' . esc_html( $error_data['details'] ) . '

'; } echo '
'; delete_transient( 'ai_search_validation_error' ); } elseif ( $validation_status === 'error' ) { echo '

Token Validation Error! Unable to connect to AI Search Service.

'; } elseif ( $validation_status === 'no_token' ) { echo '

No Token Found! Please save your settings first to generate a service token.

'; } } // Handle form submission if ( isset( $_POST['provider'], $_POST['api_key'], $_POST['similarity_threshold'] ) ) { check_admin_referer( 'ai_search_save_settings' ); $new_provider = sanitize_text_field( $_POST['provider'] ); $current_provider = get_option( 'ai_search_provider', '' ); // Save the basic settings update_option( 'ai_search_provider', $new_provider ); update_option( 'ai_search_api_key', sanitize_text_field( wp_unslash( $_POST['api_key'] ) ) ); update_option( 'ai_search_similarity_threshold', floatval( $_POST['similarity_threshold'] ) ); // Save service token if provided if ( isset( $_POST['service_token'] ) ) { update_option( 'ai_search_service_token', sanitize_text_field( wp_unslash( $_POST['service_token'] ) ) ); } // Handle AI service registration $service_client = new AI_Search_Service(); if ( $new_provider === 'ai_service' && empty( get_option( 'ai_search_service_token', '' ) ) ) { $service_token = $service_client->register_origin(); if ( $service_token ) { update_option( 'ai_search_service_token', $service_token ); echo '

Settings saved successfully! AI Search Service registered.

'; } else { update_option( 'ai_search_provider', $current_provider ); echo '

AI Search Service is temporarily unavailable. Please try again later or use your own OpenAI API key instead.

'; } } else { echo '

Settings saved successfully!

'; } } ?>

Choose between using our external service (no API key needed) or managing embeddings yourself with an OpenAI key. No personal data is stored or used for other purposes.





This token is automatically generated when you select the AI Service. You can manually update it if needed.

Click to validate your token and check usage statistics.




Defines how similar a post must be to appear in search results. Higher values (closer to 1.0) mean stricter, more relevant results. Lower values (0.2-0.4) return more results but may include less relevant matches. Recommended: 0.3-0.5.

Interactive Demo: Threshold Impact

See how threshold changes affect search results in real-time

SEARCH "I want something to use in the summer"

This query will match products based on summer-related keywords and context