Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure custom Classification Providers can fully work #762

Merged
merged 1 commit into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions includes/Classifai/Features/Classification.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,21 @@ public function rest_endpoint_callback( WP_REST_Request $request ) {
public function save( int $post_id, array $results, bool $link = true ) {
$provider_instance = $this->get_feature_provider_instance();

/**
* Filter results to be saved.
*
* @since 3.1.0
* @hook classifai_feature_classification_pre_save_results
*
* @param {array} $supported Term results.
* @param {int} $post_id Post ID.
* @param {bool} $link Whether to link the terms or not.
* @param {object} $this Current instance of the class.
*
* @return {array} Term results.
*/
$results = apply_filters( 'classifai_' . static::ID . '_pre_save_results', $results, $post_id, $link, $this );

switch ( $provider_instance::ID ) {
case NLU::ID:
$results = $provider_instance->link( $post_id, $results, $link );
Expand Down
2 changes: 1 addition & 1 deletion src/js/language-processing.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ import '../scss/language-processing.scss';
previewWatson();

const previewEmbeddings = () => {
if ( 'openai_embeddings' !== provider ) {
if ( 'ibm_watson_nlu' === provider ) {
return;
}

Expand Down
Loading