Skip to content

badasswp/ai-plus-block-editor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ai-plus-block-editor

Add AI Capabilities to the WP Block Editor.

Coverage Status

ai-plus-block-editor

Download

Download from WordPress plugin repository.

You can also get the latest version from any of our release tags.

Why AI Plus Block Editor?

Generate Captions/Headlines, Summaries, Slugs, SEO Keywords using our amazing plugin. It is fast and very useful for users who need to quickly generate high-quality content with minimal effort. Whether you're a blogger, editor, or content creator, our plugin helps streamline your workflow by providing intelligent suggestions that enhance readability and SEO performance.

Save time and improve engagement with AI-powered insights directly within the WordPress block editor.

tone.mp4
Headline Slug
headline.mov
slug.mp4

Keywords Summary
keywords.mov
summary.mp4

Getting Started

To get started, you would need to have an API key of your own provided by AI Provider for e.g. Open AI. Head over to the URL below and follow the instructions to generate your personal API key:

https://platform.openai.com/api-keys

If you have done this successfully, you should have save these details into your AI + Block Editor options page and you are ready to go!

ai-plus-admin-options-page

Hooks

apbe_ai_provider

This custom hook (filter) provides the ability to modify the AI Provider.

use YourNamespace\OpenAI_Extender;

add_filter( 'apbe_ai_provider', [ $this, 'custom_ai_provider' ], 10, 1 );

public function custom_ai_provider( $ai_provider ) {
    if ( $ai_provider instanceOf OpenAI ) {
        $ai_provider = new OpenAI_Extender();
    }

    return $ai_provider;
}

Parameters

  • ai_provider {Provider} By default this will be an instance of the Provider interface that MUST contain a run method implementation.

apbe_open_ai_args

This custom hook (filter) provides the ability to modify the OpenAI args before it sent to the LLM.

add_filter( 'apbe_open_ai_args', [ $this, 'custom_args' ], 10, 1 );

public function custom_args( $args ) {
    return wp_parse_args(
        [
            'model'       => 'gpt-4-turbo',
            'temperature' => 1.5
            'max_tokens'  => 1000,
        ],
        $args
    )
}

Parameters

  • args {array} By default this will be an array containing the OpenAI default parameters.

apbe_tone_prompt

This custom hook provides a simple way to filter the tone used by the AI LLM endpoint.

add_filter( 'apbe_tone_prompt', [ $this, 'custom_tone' ], 10, 3 );

public function custom_tone( $prompt, $prompt_tone, $prompt_text ): string {
    if ( 'aggressive' === $prompt_tone ) {
        return sprintf(
            'Stay a bit official, but use an aggressive %s to generate text to replace %s',
            $prompt_tone,
            $prompt_text
        );
    }

    return $prompt;
}

Parameters

  • prompt {string} By default this will be a string that contains the prompt sent to the AI LLM endpoint.
  • prompt_tone {string} By default this will be a string that contains the tone sent to the AI LLM endpoint.
  • prompt_text {string} By default this will be a string that contains the text sent to the AI LLM endpoint.

apbe_feature_prompt

This custom hook provides a simple way to filter the feature prompt used by the AI LLM endpoint.

add_filter( 'apbe_feature_prompt', [ $this, 'custom_feature' ], 10, 3 );

public function custom_feature( $prompt, $prompt_feature, $prompt_text ): string {
    if ( 'slug' === $prompt_feature ) {
        return sprintf(
            'Generate an SEO friendly %s using the content: %s',
            $prompt_feature,
            $prompt_text
        );
    }

    return $prompt;
}

Parameters

  • prompt {string} By default this will be a string that contains the prompt sent to the AI LLM endpoint.
  • prompt_feature {string} By default this will be a string that contains the feature sent to the AI LLM endpoint.
  • prompt_text {string} By default this will be a string that contains the text sent to the AI LLM endpoint.

apbe_rest_routes

This custom hook (filter) provides the ability to add and modify the default REST routes in the plugin.

add_filter( 'apbe_rest_routes', [ $this, 'custom_route' ], 10, 1 );

public function custom_route( $rest_routes ) {
    if ( ! in_array( AiPostTitle::class, $rest_routes, true ) ) {
        $rest_routes[] = AiPostTitle::class;
    }

    return (array) $rest_routes;
}

Parameters

  • rest_routes {array} By default this will be an array containing the plugin's REST routes.