Plugin Directory

Changeset 3146436


Ignore:
Timestamp:
09/04/2024 12:21:39 PM (18 months ago)
Author:
contentbot
Message:
  • Added a custom REST Endpoint used for unlinking from app side
  • Fixed issue where the "Rewrite draft with AI" action would be displayed if not logged in
  • Updated GPT models
  • - GPT-4o-mini
  • - GPT-4o
Location:
content-bot
Files:
2062 added
6 edited

Legend:

Unmodified
Added
Removed
  • content-bot/trunk/content-bot.php

    r3002162 r3146436  
    33Plugin Name: Content Bot
    44Plugin URI: https://contentbot.ai
    5 Description: Create amazing AI content snippets with OpenAI's GPT3 autoregressive language model that uses deep learning to produce human-like text.
    6 Version: 1.2.3
     5Description: Create amazing AI content snippets with OpenAI's GPT4 autoregressive language model that uses deep learning to produce human-like text.
     6Version: 1.2.4
    77Author: ContentBot
    88Author URI: https://codecabin.io
     
    1313
    1414/**
     15 * v1.2.4 - 2024-09-04
     16 * Added a custom REST Endpoint used for unlinking from app side
     17 * Fixed issue where the "Rewrite draft with AI" action would be displayed if not logged in
     18 * Updated GPT models
     19 *  - GPT-4o-mini
     20 *  - GPT-4o
     21 *
    1522 * v1.2.3 - 2023-11-27
    1623 * Updated InstructBot to Chat feature
     
    99106
    100107global $cbaiVersion;
    101 $cbaiVersion = '1.2.3';
     108$cbaiVersion = '1.2.4';
    102109define( 'CBAI_PLUGIN_DIR_URL', plugin_dir_url(__FILE__) );
    103110define( 'CBAI_PLUGIN_DIR_PATH', plugin_dir_path(__FILE__) );
     
    495502function cb_addPostActions(){
    496503
     504    if(empty(get_option( 'cbai_hash' ))){
     505        return false;
     506    }
    497507    wp_enqueue_script( 'content-bot-rewrite-action', plugin_dir_url(__FILE__) . 'js/rewrite-actions.js');
    498508
     
    575585        'methods' => 'POST',
    576586        'callback' => 'cbai_import_document',
     587        'show_in_index' => false,
     588        'permission_callback' => '__return_true',
     589    ));
     590
     591    register_rest_route( 'content-bot', '/cbai_force_unlink', array(
     592        'methods' => 'POST',
     593        'callback' => 'cbai_force_unlink',
    577594        'show_in_index' => false,
    578595        'permission_callback' => '__return_true',
     
    656673
    657674/**
     675 * Unlinks the site when called through the REST API endpoint
     676 *
     677 * @param array $data
     678 *
     679 * @return void
     680 */
     681function cbai_force_unlink($data){
     682    $params = $data->get_params();
     683
     684    $otl = get_option( 'cbai_otl' );
     685
     686    if(!empty($params['otl'])){
     687
     688        if($otl !== $params['otl']){
     689            echo json_encode(
     690                array(
     691                    "success" => false,
     692                    "error" => "Not authorized - OTL does not match"
     693                )
     694            );
     695            exit();
     696        }
     697
     698        $user_id = get_current_user_id();
     699
     700        delete_option( 'cbai_hash' );
     701        delete_option( 'cbai_otl' );
     702        delete_option( 'cbai_website' );
     703
     704        echo json_encode(
     705            array(
     706                "success" => true,
     707                "error" => "WordPress site unlinked"
     708            )
     709        );
     710
     711        exit();
     712
     713    } else {
     714        echo json_encode(
     715            array(
     716                "success" => false,
     717                "error" => "Not authorized - OTL missing"
     718            )
     719        );
     720
     721        exit();
     722    }
     723}
     724
     725
     726/**
    658727 * Gets the version number of the plugin
    659728 *
  • content-bot/trunk/js/functions.js

    r2902193 r3146436  
    125125                    // Link to their account in CB
    126126                    const data = {
    127                         action : 'linkIntegration_WordPress',
     127                        action : 'linkIntegrationWordPress',
    128128                        apikey : msg.apikey,
    129129                        website : cbai_data.website,
     
    219219        // Link to their account in CB
    220220        const data = {
    221             action : 'linkIntegration_WordPress',
     221            action : 'linkIntegrationWordPress',
    222222            apikey : apikey,
    223223            website : website,
     
    234234
    235235                console.log(response);
     236
     237                debugger;
    236238
    237239                if(response.linked){
  • content-bot/trunk/js/rewrite-actions.js

    r3002162 r3146436  
    3636        }
    3737
    38     this.data = {};
    39     this.data.postRows = [];
    40     this.data.postRowsSorted = {};
     38        this.data = {};
     39        this.data.postRows = [];
     40        this.data.postRowsSorted = {};
    4141
    4242        this.data.pageRows = [];
     
    6868        this.elements = {};
    6969
    70     this.elements.postsTable = jQuery('.post-type-post table.posts');
    71     this.elements.postsTableList = jQuery('.post-type-post table.posts tbody#the-list');
     70        this.elements.postsTable = jQuery('.post-type-post table.posts');
     71        this.elements.postsTableList = jQuery('.post-type-post table.posts tbody#the-list');
    7272
    7373        this.elements.pagesTable = jQuery('.post-type-page table.pages');
     
    8383    bindEvents(){
    8484
    85     jQuery(document).ready(function(){
    86 
    87       cbRewriteActions.findRows();
    88 
    89       cbRewriteActions.insertActions();
    90 
    91     })
     85        jQuery(document).ready(function(){
     86
     87            cbRewriteActions.findRows();
     88
     89            cbRewriteActions.insertActions();
     90
     91        })
    9292
    9393        jQuery(document).on('click', '.cb_rewrite_as_draft', (event) => {
     
    9999        })
    100100
    101   }
    102 
    103   insertActions(){
    104 
    105     for(let row of this.data.postRows){
     101    }
     102
     103    insertActions(){
     104
     105        for(let row of this.data.postRows){
    106106
    107107            if(row.find('.cb_rewrite_as_draft').length > 0){
     
    112112            let id = row.attr('id');
    113113            let raw_id = id.replace('post-', '');
    114      
    115       let actionRow = row.find('.row-actions');
    116 
    117       if(actionRow.length > 0){
    118 
    119         let actionElement = jQuery(`
    120         <span class="cb_rewrite_as_draft">
    121             | <a href="${cbai_data.website}/wp-admin/admin.php?action=cb_rewrite_draft_with_ai&post=${raw_id}&wpnonce=${cbai_data.nonce}" aria-label="" data-cb-type="post">Rewrite Draft with AI</a>
    122         </span>`);
     114       
     115            let actionRow = row.find('.row-actions');
     116
     117            if(actionRow.length > 0){
     118
     119                let actionElement = jQuery(`
     120                <span class="cb_rewrite_as_draft">
     121                    | <a href="${cbai_data.website}/wp-admin/admin.php?action=cb_rewrite_draft_with_ai&post=${raw_id}&wpnonce=${cbai_data.nonce}" aria-label="" data-cb-type="post">Rewrite Draft with AI</a>
     122                </span>`);
    123123
    124124                actionRow.append(actionElement);
    125        
    126       }
    127      
    128     }
     125               
     126            }
     127       
     128        }
    129129
    130130        for(let row of this.data.pageRows){
     
    137137            let id = row.attr('id');
    138138            let raw_id = id.replace('post-', '');
    139      
    140       let actionRow = row.find('.row-actions');
    141 
    142       if(actionRow.length > 0){
    143 
    144         let actionElement = jQuery(`
    145         <span class="cb_rewrite_as_draft">
    146             | <a href="${cbai_data.website}/wp-admin/admin.php?action=cb_rewrite_draft_with_ai&post=${raw_id}&wpnonce=${cbai_data.nonce}" aria-label="" data-cb-type="page">Rewrite Draft with AI</a>
    147         </span>`);
     139       
     140            let actionRow = row.find('.row-actions');
     141
     142            if(actionRow.length > 0){
     143
     144                let actionElement = jQuery(`
     145                <span class="cb_rewrite_as_draft">
     146                    | <a href="${cbai_data.website}/wp-admin/admin.php?action=cb_rewrite_draft_with_ai&post=${raw_id}&wpnonce=${cbai_data.nonce}" aria-label="" data-cb-type="page">Rewrite Draft with AI</a>
     147                </span>`);
    148148
    149149                actionRow.append(actionElement);
    150        
    151       }
    152 
    153         }
    154 
    155   }
    156 
    157   findRows(){
     150           
     151            }
     152
     153        }
     154
     155    }
     156
     157    findRows(){
    158158
    159159        if(this.elements.postsTable.length > 0){
     
    174174        if(this.elements.pagesTable.length > 0){
    175175            this.elements.pagesTableList.find('tr').each(function(){
    176      
     176   
    177177                let row = jQuery(this);
    178178   
     
    185185        }
    186186
    187   }
     187    }
    188188}
    189189
  • content-bot/trunk/readme.txt

    r3002162 r3146436  
    1 === ContentBot AI Writer (ChatGPT, GPT3, GPT4) ===
     1=== ContentBot AI Writer (ChatGPT, GPT4) ===
    22Contributors: NickDuncan, contentbot
    33Donate link: https://contentbot.ai
    4 Tags: chatgpt, ai writer, ai content, artificial intelligence, gpt3, chat gpt, contentbot
     4Tags: chatgpt, ai writer, ai content, artificial intelligence, gpt4, chat gpt, contentbot
    55Requires at least: 3.8
    6 Tested up to: 6.4.1
     6Tested up to: 6.6.1
    77Requires PHP: 5.6
    8 Stable tag: 1.2.3
     8Stable tag: 1.2.4
    99License: GPLv3
    1010License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    102102== Changelog ==
    103103
     104= v1.2.4 - 2024-09-04 =
     105* Added a custom REST Endpoint used for unlinking from app side
     106* Fixed issue where the "Rewrite draft with AI" action would be displayed if not logged in
     107* Updated GPT models
     108*  - GPT-4o-mini
     109*  - GPT-4o
     110
    104111= v1.2.3 - 2023-11-27 =
    105112* Updated InstructBot to Chat feature
  • content-bot/trunk/templates/instruct-bot.html.php

    r3002162 r3146436  
    8989                    <label class="cbaiLabelPill" for="cbaiInstructModel">Model</label>
    9090                    <select id="cbaiInstructModel">
    91                         <option value="open_prompt_v2">GPT-3.5 Turbo</option>
    92                         <option value="open_prompt_v4">GPT-4</option>
     91                        <option value="open_prompt_v2">GPT-4o-mini</option>
     92                        <option value="open_prompt_v4">GPT-4o</option>
    9393                    </select>
    9494                </div>
  • content-bot/trunk/templates/settings.html.php

    r3002162 r3146436  
    3737}
    3838
    39 $cbaiGPT3 = 'selected';
     39$cbaiGPT4Mini = 'selected';
    4040$cbaiGPT4 = '';
    4141
     
    4545
    4646    if($model == 'open_prompt_v4'){
    47         $cbaiGPT3 = '';
     47        $cbaiGPT4Mini = '';
    4848        $cbaiGPT4 = 'selected';
    4949    }
     
    9494                    </td>
    9595                </tr>
    96 
    97                 <?php /*
    98                 <tr>
    99                     <th scope="row"><label for="cbai_model"><?php _e("GPT Model", "wp-content-bot"); ?></label></th>
    100                     <td>
    101                         <select name="cbai_model" id="cbai_model" class="regular-text cbai-input">
    102                             <option value="open_prompt_v2" <?php echo $cbaiGPT3; ?>>GPT-3.5 Turbo</option>
    103                             <option value="open_prompt_v4" <?php echo $cbaiGPT4; ?>>GPT-4</option>
    104                         </select>
    105                         <p class="cbai-input-description" id="model-description">
    106                             <?php _e("This GPT model will be used when generating content throughout your site.", "wp-content-bot"); ?>
    107                         </p>
    108                     </td>
    109                 </tr>
    110                 */ ?>
    11196            </tbody>
    11297        </table>
Note: See TracChangeset for help on using the changeset viewer.