Skip to content

Commit 009c7e5

Browse files
committed
Merge branch 'develop' of github.com:10up/classifai into feat/488
2 parents 3ab7cfa + bd9ea48 commit 009c7e5

23 files changed

+449
-205
lines changed
+17-16
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
11
name: Build release zip
22

33
on:
4-
release:
5-
types: [published]
4+
workflow_dispatch:
65

76
jobs:
87
build_zip:
9-
name: New release
8+
name: Build release zip
109
runs-on: ubuntu-latest
1110
steps:
12-
1311
- name: Checkout code
1412
uses: actions/checkout@v3
15-
16-
- name: Create ZIP
13+
- name: Set Node.js 16.x
14+
uses: actions/setup-node@v3
15+
with:
16+
node-version-file: .nvmrc
17+
- name: npm install and build
1718
run: |
18-
git archive --prefix=classifai/ HEAD -o classifai.zip
19-
20-
- name: Upload release asset
21-
uses: actions/upload-release-asset@v1
22-
env:
23-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
npm install
20+
npm run build
21+
npm run makepot
22+
composer install --no-dev
23+
npm run archive
24+
- name: Upload the ZIP file as an artifact
25+
uses: actions/upload-artifact@v3
2426
with:
25-
upload_url: ${{ github.event.release.upload_url }}
26-
asset_path: ${{github.workspace}}/classifai.zip
27-
asset_name: classifai.zip
28-
asset_content_type: application/zip
27+
name: ${{ github.event.repository.name }}
28+
path: release
29+
retention-days: 2

.github/workflows/cypress.yml

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
core:
1818
- {name: 'WP latest', version: 'latest'}
1919
- {name: 'WP minimum', version: 'WordPress/WordPress#5.7'}
20+
- {name: 'WP trunk', version: 'WordPress/WordPress#master'}
2021
steps:
2122
- name: Checkout
2223
uses: actions/checkout@v3

.github/workflows/release.yml

+17-19
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,36 @@
1-
name: Build Release
1+
name: Release
2+
23
on:
3-
push:
4-
branches:
5-
- trunk
4+
release:
5+
types: [published]
6+
67
jobs:
78
release:
8-
name: Push (merge) to trunk
9+
name: New release
910
runs-on: ubuntu-latest
1011
steps:
1112
- name: Checkout
1213
uses: actions/checkout@v3
14+
1315
- name: Set Node.js 16.x
1416
uses: actions/setup-node@v3
1517
with:
16-
node-version: 16.x
17-
- name: npm install and build
18+
node-version-file: .nvmrc
19+
20+
- name: Install dependencies, build files and archive
1821
run: |
1922
npm install
2023
npm run build
2124
npm run makepot
2225
composer install --no-dev
2326
npm run archive
24-
- name: Release to Stable
25-
uses: s0/git-publish-subdir-action@develop
27+
28+
- name: Upload release asset
29+
uses: actions/upload-release-asset@v1
2630
env:
27-
REPO: self
28-
BRANCH: stable
29-
FOLDER: release
3031
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31-
MESSAGE: 'Release: ({sha}) {msg}'
32-
- name: Build docs
33-
run: npm run build:docs
34-
- name: Deploy docs update
35-
uses: peaceiris/actions-gh-pages@v3
3632
with:
37-
github_token: ${{ secrets.GITHUB_TOKEN }}
38-
publish_dir: './docs'
33+
upload_url: ${{ github.event.release.upload_url }}
34+
asset_path: ${{github.workspace}}/classifai.zip
35+
asset_name: classifai.zip
36+
asset_content_type: application/zip

.github/workflows/stable.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Release to Stable
2+
on:
3+
push:
4+
branches:
5+
- trunk
6+
jobs:
7+
release:
8+
name: Push (merge) to trunk
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v3
13+
- name: Set Node.js 16.x
14+
uses: actions/setup-node@v3
15+
with:
16+
node-version: 16.x
17+
- name: npm install and build
18+
run: |
19+
npm install
20+
npm run build
21+
npm run makepot
22+
composer install --no-dev
23+
npm run archive
24+
- name: Release to Stable
25+
uses: s0/git-publish-subdir-action@develop
26+
env:
27+
REPO: self
28+
BRANCH: stable
29+
FOLDER: release
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
MESSAGE: 'Release: ({sha}) {msg}'
32+
- name: Build docs
33+
run: npm run build:docs
34+
- name: Deploy docs update
35+
uses: peaceiris/actions-gh-pages@v3
36+
with:
37+
github_token: ${{ secrets.GITHUB_TOKEN }}
38+
publish_dir: './docs'

README.md

+12-12
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
* [Set Up OpenAI Embeddings Language Processing](#set-up-language-processing-via-openai-embeddings)
2121
* [Set Up OpenAI Whisper Language Processing](#set-up-language-processing-via-openai-whisper)
2222
* [Set Up Azure AI Language Processing](#set-up-language-processing-via-microsoft-azure)
23-
* [Set Up Azure AI Computer Vision Image Processing](#set-up-image-processing-via-microsoft-azure)
23+
* [Set Up Azure AI Vision Image Processing](#set-up-image-processing-via-microsoft-azure)
2424
* [Set Up OpenAI DALL·E Image Processing](#set-up-image-processing-via-openai)
25-
* [Set Up Azure Personalizer Recommended Content](#set-up-recommended-content-via-microsoft-azure-personalizer)
25+
* [Set Up Azure AI Personalizer Recommended Content](#set-up-recommended-content-via-microsoft-azure-ai-personalizer)
2626
* [WP CLI Commands](#wp-cli-commands)
2727
* [FAQs](#frequently-asked-questions)
2828
* [Support](#support-level)
@@ -41,16 +41,16 @@ Tap into leading cloud-based services like [OpenAI](https://openai.com/), [Micro
4141
* Generate transcripts of audio files using [OpenAI's Whisper API](https://platform.openai.com/docs/guides/speech-to-text)
4242
* Convert text content into audio and output a "read-to-me" feature on the front-end to play this audio using [Microsoft Azure's Text to Speech API](https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/text-to-speech)
4343
* Classify post content using [IBM Watson's Natural Language Understanding API](https://www.ibm.com/watson/services/natural-language-understanding/) and [OpenAI's Embedding API](https://platform.openai.com/docs/guides/embeddings)
44-
* BETA: Recommend content based on overall site traffic via [Microsoft Azure's Personalizer API](https://azure.microsoft.com/en-us/services/cognitive-services/personalizer/) _(note that we're gathering feedback on this feature and may significantly iterate depending on community input)_
45-
* Generate image alt text, image tags, and smartly crop images using [Microsoft Azure's Computer Vision API](https://azure.microsoft.com/en-us/services/cognitive-services/computer-vision/)
46-
* Scan images and PDF files for embedded text and save for use in post meta using [Microsoft Azure's Computer Vision API](https://azure.microsoft.com/en-us/services/cognitive-services/computer-vision/)
44+
* BETA: Recommend content based on overall site traffic via [Microsoft Azure's AI Personalizer API](https://azure.microsoft.com/en-us/services/cognitive-services/personalizer/) _(note that we're gathering feedback on this feature and may significantly iterate depending on community input)_
45+
* Generate image alt text, image tags, and smartly crop images using [Microsoft Azure's AI Vision API](https://azure.microsoft.com/en-us/services/cognitive-services/computer-vision/)
46+
* Scan images and PDF files for embedded text and save for use in post meta using [Microsoft Azure's AI Vision API](https://azure.microsoft.com/en-us/services/cognitive-services/computer-vision/)
4747
* Bulk classify content with [WP-CLI](https://wp-cli.org/)
4848

4949
### Language Processing
5050

5151
| Tagging | Recommended Content | Excerpt Generation |
5252
| :-: | :-: | :-: |
53-
| ![Screenshot of ClassifAI post tagging](assets/img/screenshot-1.png "Example of a Block Editor post with Watson Categories, Keywords, Concepts, and Entities.") | ![Screenshot of ClassifAI recommended content](assets/img/screenshot-2.png "Example of a Recommended Content Block with Azure Personalizer.") | ![Screenshot of ClassifAI excerpt generation](assets/img/screenshot-7.png "Example of automatic excerpt generation with OpenAI.") |
53+
| ![Screenshot of ClassifAI post tagging](assets/img/screenshot-1.png "Example of a Block Editor post with Watson Categories, Keywords, Concepts, and Entities.") | ![Screenshot of ClassifAI recommended content](assets/img/screenshot-2.png "Example of a Recommended Content Block with Azure AI Personalizer.") | ![Screenshot of ClassifAI excerpt generation](assets/img/screenshot-7.png "Example of automatic excerpt generation with OpenAI.") |
5454

5555
| Audio Transcripts | Title Generation | Text to Speech |
5656
| :-: | :-: | :-: |
@@ -68,7 +68,7 @@ Tap into leading cloud-based services like [OpenAI](https://openai.com/), [Micro
6868
* [WordPress](http://wordpress.org) 5.7+
6969
* To utilize the NLU Language Processing functionality, you will need an active [IBM Watson](https://cloud.ibm.com/registration) account.
7070
* To utilize the ChatGPT, Embeddings, or Whisper Language Processing functionality or DALL·E Image Processing functionality, you will need an active [OpenAI](https://platform.openai.com/signup) account.
71-
* To utilize the Computer Vision Image Processing functionality or Text to Speech Language Processing functionality, you will need an active [Microsoft Azure](https://signup.azure.com/signup) account.
71+
* To utilize the Azure AI Vision Image Processing functionality or Text to Speech Language Processing functionality, you will need an active [Microsoft Azure](https://signup.azure.com/signup) account.
7272

7373
## Pricing
7474

@@ -78,11 +78,11 @@ The service that powers ClassifAI's NLU Language Processing, IBM Watson's Natura
7878

7979
The service that powers ClassifAI's ChatGPT, Embeddings and Whisper Language Processing and DALL·E Image Processing, OpenAI, has a limited free trial and then requires a [pay per usage](https://openai.com/pricing) plan.
8080

81-
The service that powers ClassifAI's Computer Vision Image Processing, Microsoft Azure, has a ["free" pricing tier](https://azure.microsoft.com/en-us/pricing/details/cognitive-services/computer-vision/) that offers 20 transactions per minute and 5,000 transactions per month.
81+
The service that powers ClassifAI's Azure AI Vision Image Processing, Microsoft Azure, has a ["free" pricing tier](https://azure.microsoft.com/en-us/pricing/details/cognitive-services/computer-vision/) that offers 20 transactions per minute and 5,000 transactions per month.
8282

8383
The service that powers ClassifAI's Text to Speech Language Processing, Microsoft Azure, has a ["free" pricing tier](https://azure.microsoft.com/en-us/pricing/details/cognitive-services/speech-services/) that offers 0.5 million characters per month.
8484

85-
The service that powers ClassifAI's Recommended Content, Microsoft Azure's Personalizer, has a ["free" pricing tier](https://azure.microsoft.com/en-us/pricing/details/cognitive-services/personalizer/) that offers 50,000 transactions per month.
85+
The service that powers ClassifAI's Recommended Content, Microsoft Azure AI Personalizer, has a ["free" pricing tier](https://azure.microsoft.com/en-us/pricing/details/cognitive-services/personalizer/) that offers 50,000 transactions per month.
8686

8787
## Installation
8888

@@ -311,7 +311,7 @@ Note that [OpenAI](https://platform.openai.com/docs/guides/speech-to-text) can c
311311

312312
## Set Up Image Processing (via Microsoft Azure)
313313

314-
Note that [Computer Vision](https://docs.microsoft.com/en-us/azure/cognitive-services/computer-vision/home#image-requirements) can analyze and crop images that meet the following requirements:
314+
Note that [Azure AI Vision](https://docs.microsoft.com/en-us/azure/cognitive-services/computer-vision/home#image-requirements) can analyze and crop images that meet the following requirements:
315315
- The image must be presented in JPEG, PNG, GIF, or BMP format
316316
- The file size of the image must be less than 4 megabytes (MB)
317317
- The dimensions of the image must be greater than 50 x 50 pixels
@@ -320,7 +320,7 @@ Note that [Computer Vision](https://docs.microsoft.com/en-us/azure/cognitive-ser
320320
### 1. Sign up for Azure services
321321

322322
- [Register for a Microsoft Azure account](https://azure.microsoft.com/en-us/free/) or sign into your existing one.
323-
- Log into your account and create a new [*Computer Vision*](https://portal.azure.com/#blade/Microsoft_Azure_Marketplace/GalleryFeaturedMenuItemBlade/selectedMenuItemId/CognitiveServices_MP/dontDiscardJourney/true/launchingContext/%7B%22source%22%3A%22Resources%20Microsoft.CognitiveServices%2Faccounts%22%7D/resetMenuId/) Service if you do not already have one. It may take a minute for your account to fully populate with the default resource group to use.
323+
- Log into your account and create a new [*Azure AI Vision*](https://portal.azure.com/#blade/Microsoft_Azure_Marketplace/GalleryFeaturedMenuItemBlade/selectedMenuItemId/CognitiveServices_MP/dontDiscardJourney/true/launchingContext/%7B%22source%22%3A%22Resources%20Microsoft.CognitiveServices%2Faccounts%22%7D/resetMenuId/) Service if you do not already have one. It may take a minute for your account to fully populate with the default resource group to use.
324324
- Click `Keys and Endpoint` in the left hand Resource Management menu to view the `Endpoint` URL for this resource.
325325
- Click the copy icon next to `KEY 1` to copy the API Key credential for this resource.
326326

@@ -365,7 +365,7 @@ Note that [Computer Vision](https://docs.microsoft.com/en-us/azure/cognitive-ser
365365
* Once images are generated, choose one or more images to import into your media library
366366
* Choose one image to insert into the content
367367

368-
## Set Up Recommended Content (via Microsoft Azure Personalizer)
368+
## Set Up Recommended Content (via Microsoft Azure AI Personalizer)
369369

370370
Note that [Personalizer](https://azure.microsoft.com/en-us/services/cognitive-services/personalizer/) requires sufficient data volume to enable Personalizer to learn. In general, we recommend a minimum of ~1,000 events per day to ensure Personalizer learns effectively. If Personalizer doesn't receive sufficient data, the service takes longer to determine the best actions.
371371

hookdocs/wp-cli.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ The following WP-CLI commands are supported by ClassifAI:
238238

239239
* `wp classifai image <attachment_ids> [--limit=<int>] [--skip=<skip>] [--force]`
240240

241-
Directly add description "alt text" and tags to attachment(s) using Azure AI Computer Vision API.
241+
Directly add description "alt text" and tags to attachment(s) using Azure AI Vision API.
242242

243243
* `<attachment_ids>`: Comma delimited list of Attachment IDs to classify.
244244

@@ -256,7 +256,7 @@ The following WP-CLI commands are supported by ClassifAI:
256256

257257
* `wp classifai crop <attachment_ids> [--limit=<limit>] [--skip=<skip>]`
258258

259-
Batch crop image(s) using Azure AI Computer Vision API.
259+
Batch crop image(s) using Azure AI Vision API.
260260

261261
* `<attachment_ids>`: Comma delimited list of Attachment IDs to crop.
262262

includes/Classifai/Blocks/recommended-content-block/block.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"$schema": "https://schemas.wp.org/trunk/block.json",
33
"apiVersion": 2,
44
"title": "Recommended Content",
5-
"description": "Display content recommended by Azure Personalizer",
5+
"description": "Display content recommended by Azure AI Personalizer",
66
"textdomain": "classifai",
77
"name": "classifai/recommended-content-block",
88
"category": "classifai-blocks",

includes/Classifai/Blocks/recommended-content-block/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import { ReactComponent as icon } from '../../../../assets/img/block-icon.svg';
2626
registerBlockType( block.name, {
2727
title: __( 'Recommended Content', 'classifai' ),
2828
description: __(
29-
'Display content recommended by Azure Personalizer',
29+
'Display content recommended by Azure AI Personalizer',
3030
'classifai'
3131
),
3232
edit,

includes/Classifai/Providers/Azure/ComputerVision.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ class ComputerVision extends Provider {
3131
public function __construct( $service ) {
3232
parent::__construct(
3333
'Microsoft Azure',
34-
'Computer Vision',
34+
'AI Vision',
3535
'computer_vision',
3636
$service
3737
);
3838

3939
// Set the onboarding options.
4040
$this->onboarding_options = array(
41-
'title' => __( 'Microsoft Azure Computer Vision', 'classifai' ),
41+
'title' => __( 'Microsoft Azure AI Vision', 'classifai' ),
4242
'fields' => array( 'url', 'api-key' ),
4343
'features' => array(
4444
'enable_image_captions' => __( 'Automatically add alt-text to images', 'classifai' ),
@@ -1053,7 +1053,7 @@ public function setup_fields_sections() {
10531053
'input_type' => 'checkbox',
10541054
'default_value' => $default_settings['enable_smart_cropping'],
10551055
'description' => __(
1056-
'ComputerVision detects and saves the most visually interesting part of your image (i.e., faces, animals, notable text).',
1056+
'AI Vision detects and saves the most visually interesting part of your image (i.e., faces, animals, notable text).',
10571057
'classifai'
10581058
),
10591059
]

includes/Classifai/Providers/Azure/Personalizer.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* Azure Personalizer
3+
* Azure AI Personalizer
44
*/
55

66
namespace Classifai\Providers\Azure;
@@ -35,14 +35,14 @@ class Personalizer extends Provider {
3535
public function __construct( $service ) {
3636
parent::__construct(
3737
'Microsoft Azure',
38-
'Personalizer',
38+
'AI Personalizer',
3939
'personalizer',
4040
$service
4141
);
4242

4343
// Set the onboarding options.
4444
$this->onboarding_options = array(
45-
'title' => __( 'Microsoft Azure Personalizer', 'classifai' ),
45+
'title' => __( 'Microsoft Azure AI Personalizer', 'classifai' ),
4646
'fields' => array( 'url', 'api-key' ),
4747
'features' => array(
4848
'authenticated' => __( 'Recommended content block', 'classifai' ),
@@ -97,7 +97,7 @@ public function setup_fields_sections() {
9797
'description' => sprintf(
9898
wp_kses(
9999
// translators: 1 - link to create a Personalizer resource.
100-
__( 'Azure Cognitive Service Personalizer Endpoint, <a href="%1$s" target="_blank">create a Personalizer resource</a> in the Azure portal to get your key and endpoint.', 'classifai' ),
100+
__( 'Azure AI Personalizer Endpoint, <a href="%1$s" target="_blank">create a Personalizer resource</a> in the Azure portal to get your key and endpoint.', 'classifai' ),
101101
array(
102102
'a' => array(
103103
'href' => array(),
@@ -119,7 +119,7 @@ public function setup_fields_sections() {
119119
'label_for' => 'api_key',
120120
'input_type' => 'password',
121121
'default_value' => $default_settings['api_key'],
122-
'description' => __( 'Azure Cognitive Service Personalizer Key.', 'classifai' ),
122+
'description' => __( 'Azure AI Personalizer Key.', 'classifai' ),
123123
]
124124
);
125125
}
@@ -310,7 +310,7 @@ function( $ele ) {
310310

311311
if ( is_wp_error( $response ) ) {
312312
// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
313-
error_log( __( 'Failed to contact Azure Cognitive Service Personalizer: ', 'classifai' ) . $response->get_error_message() );
313+
error_log( __( 'Failed to contact Azure AI Personalizer: ', 'classifai' ) . $response->get_error_message() );
314314
return array(
315315
'response' => (object) array(),
316316
'actions' => $action_ids,
@@ -605,7 +605,7 @@ protected function get_string_words( $string ) {
605605
}
606606

607607
/**
608-
* Get Ranked action by sending request to Azure Personalizer.
608+
* Get Ranked action by sending request to Azure AI Personalizer.
609609
*
610610
* @param array $rank_request Prepared Request data.
611611
* @return object|string

includes/Classifai/Providers/Azure/TextToSpeech.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public function register() {
135135
}
136136

137137
/**
138-
* Resets settings for the Personalizer provider.
138+
* Resets settings for the TextToSpeech provider.
139139
*/
140140
public function reset_settings() {
141141
update_option( $this->get_option_name(), $this->get_default_settings() );
@@ -732,6 +732,10 @@ public function render_post_audio_controls( $content ) {
732732
return $content;
733733
}
734734

735+
if ( ! is_singular( $_post->post_type ) ) {
736+
return $content;
737+
}
738+
735739
if ( ! in_array( $_post->post_type, get_tts_supported_post_types(), true ) ) {
736740
return $content;
737741
}

0 commit comments

Comments
 (0)