Skip to content

Commit

Permalink
take jetpack_ai_enabled into consideration, don't waste cycles if use…
Browse files Browse the repository at this point in the history
…r has disabled it. Respond with default payload
  • Loading branch information
CGastrell committed Sep 10, 2024
1 parent a759b86 commit 0cee08d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions projects/plugins/jetpack/_inc/lib/class-jetpack-ai-helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,11 @@ public static function get_ai_assistance_feature() {
return $cache;
}

if ( ! apply_filters( 'jetpack_ai_enabled', true ) ) {
// if user has disabled AI, don't waste request/computing cycles and return default payload.
return self::get_default_feature_payload();
}

if ( null !== static::$ai_assistant_failed_request ) {
return static::$ai_assistant_failed_request;
}
Expand Down

0 comments on commit 0cee08d

Please sign in to comment.