diff --git a/includes/Utils/AISearchUtil.php b/includes/Utils/AISearchUtil.php index c7575bc..9ed8bd4 100644 --- a/includes/Utils/AISearchUtil.php +++ b/includes/Utils/AISearchUtil.php @@ -34,6 +34,13 @@ private static function _check_capabilities( ) { public static function get_search_results( string $hiive_token, string $user_prompt, string $identifier, array $extra = null ) { + + if ( !self::_check_capabilities() ) { + return array( + 'error' => __( 'We are unable to process the request at this moment' ), + ); + } + $response = wp_remote_post( NFD_AI_SERVICE_BASE, array( @@ -58,12 +65,6 @@ public static function get_search_results( ); } - if ( !self::_check_capabilities() ) { - return array( - 'error' => __( 'We are unable to process the request at this moment' ), - ); - } - $parsed_response = json_decode( wp_remote_retrieve_body( $response ), true ); try {