Plugin Directory

Changeset 3345921


Ignore:
Timestamp:
08/17/2025 02:37:55 PM (8 months ago)
Author:
codeapple
Message:

Added: GPT-5 Models
Updated: Other minor bug fixes

Location:
wordai
Files:
49 added
7 edited

Legend:

Unmodified
Added
Removed
  • wordai/trunk/admin/js/sc-wordai-content-generate-script.js

    r3148245 r3345921  
    297297                            scCompleteResponse              = scWordAIProcessGroupOfChunkResponse(scChunkResponse);
    298298                            // console.log( 'Chunk Complete Response:'+ scCompleteResponse );                           
    299                             scWordAIResponseErrorMessage    = ( scCompleteResponse[0] !== undefined && scCompleteResponse[0].error !== undefined )? scCompleteResponse[0].errorData : '';
     299                            if ( ( scCompleteResponse[0] !== undefined && scCompleteResponse[0].error !== undefined && scCompleteResponse[0].errorData !== undefined ) ) {
     300                                scWordAIResponseErrorMessage = scCompleteResponse[0].errorData;
     301                            }
     302                            // scWordAIResponseErrorMessage = ( scCompleteResponse[0] !== undefined && scCompleteResponse[0].error !== undefined )? scCompleteResponse[0].errorData : '';
    300303                            //scCompleteResponse                = scCompleteResponse.replace(/^\"/g, '').replace(/\"$/g, '');
    301                             scCompleteResponse              = (scWordAIResponseErrorMessage.length === 0) ? scCompleteResponse.replace(/^\"/g, '').replace(/\"$/g, '') : '';                           
     304                            // scCompleteResponse               = (scWordAIResponseErrorMessage.length === 0) ? scCompleteResponse.replace(/^\"/g, '').replace(/\"$/g, '') : '';                           
     305                            scCompleteResponse              = (scWordAIResponseErrorMessage.length === 0 && scCompleteResponse.length !== 0 ) ? scCompleteResponse.replace(/^\"/g, '').replace(/\"$/g, '') : '';
    302306                            $('.sc-wordai-generated-title').val( scCompleteResponse );
    303307                        }                 
     
    359363                            // console.log(scChunkResponse);
    360364                            scCompleteResponse              = scWordAIProcessGroupOfChunkResponse(scChunkResponse);                         
    361                             //console.log( scCompleteResponse );                           
    362                             scWordAIResponseErrorMessage    = ( scCompleteResponse[0] !== undefined && scCompleteResponse[0].error !== undefined )? scCompleteResponse[0].errorData : '';
     365                            //console.log( scCompleteResponse );       
     366                            if ( ( scCompleteResponse[0] !== undefined && scCompleteResponse[0].error !== undefined && scCompleteResponse[0].errorData !== undefined ) ) {
     367                                scWordAIResponseErrorMessage = scCompleteResponse[0].errorData;
     368                            }
     369                            // scWordAIResponseErrorMessage = ( scCompleteResponse[0] !== undefined && scCompleteResponse[0].error !== undefined )? scCompleteResponse[0].errorData : '';
    363370                            $('.sc-wordai-generated-content').val( scCompleteResponse );
    364371                            $('.sc-wordai-replace-withbr-response-format-content').val(scCompleteResponse.replace(/\n/g, "<br>") ); 
     
    420427                            //console.log(scChunkResponse);
    421428                            scCompleteResponse              = scWordAIProcessGroupOfChunkResponse(scChunkResponse);                         
    422                             //console.log( scCompleteResponse );                           
    423                             scWordAIResponseErrorMessage    = ( scCompleteResponse[0] !== undefined && scCompleteResponse[0].error !== undefined )? scCompleteResponse[0].errorData : '';
     429                            //console.log( scCompleteResponse );   
     430                            if ( ( scCompleteResponse[0] !== undefined && scCompleteResponse[0].error !== undefined && scCompleteResponse[0].errorData !== undefined ) ) {
     431                                scWordAIResponseErrorMessage = scCompleteResponse[0].errorData;
     432                            }
     433                            // scWordAIResponseErrorMessage = ( scCompleteResponse[0] !== undefined && scCompleteResponse[0].error !== undefined )? scCompleteResponse[0].errorData : '';
    424434                            $('.sc-wordai-generated-excerpt').val( scCompleteResponse );
    425435                            $('.sc-wordai-replace-withbr-response-format-excerpt').val(scCompleteResponse.replace(/\n/g, "<br>") ); 
     
    481491                            scCompleteResponse              = scWordAIProcessGroupOfChunkResponse(scChunkResponse);                         
    482492                            // console.log( scCompleteResponse );                           
    483                             scWordAIResponseErrorMessage    = ( scCompleteResponse[0] !== undefined && scCompleteResponse[0].error !== undefined )? scCompleteResponse[0].errorData : '';
     493                            if ( ( scCompleteResponse[0] !== undefined && scCompleteResponse[0].error !== undefined && scCompleteResponse[0].errorData !== undefined ) ) {
     494                                scWordAIResponseErrorMessage = scCompleteResponse[0].errorData;
     495                            }
     496                            // scWordAIResponseErrorMessage = ( scCompleteResponse[0] !== undefined && scCompleteResponse[0].error !== undefined )? scCompleteResponse[0].errorData : '';
    484497                            $('.sc-wordai-generated-tags').val(scCompleteResponse.replace(/\n/g, "").replace(/\\/, "") );                           
    485498                        }                 
  • wordai/trunk/admin/js/sc-wordai-misc-script.js

    r3072955 r3345921  
    134134                        //console.log('scCompleteResponse: ');
    135135                        //console.log(scCompleteResponse);                     
    136                         scWordAIResponseErrorMessage    = ( scCompleteResponse[0] !== undefined && scCompleteResponse[0].error !== undefined )? scCompleteResponse[0].errorData : '';
     136                        if ( ( scCompleteResponse[0] !== undefined && scCompleteResponse[0].error !== undefined && scCompleteResponse[0].errorData !== undefined ) ) {
     137                            scWordAIResponseErrorMessage = scCompleteResponse[0].errorData;
     138                        }
     139                        // scWordAIResponseErrorMessage = ( scCompleteResponse[0] !== undefined && scCompleteResponse[0].error !== undefined )? scCompleteResponse[0].errorData : '';
    137140                        scListedChunkResponse           = scCompleteResponse.split('\n');
    138141                        //console.log(scListedChunkResponse);
  • wordai/trunk/admin/views/submenus-apisettings.php

    r3148245 r3345921  
    8282                </td>
    8383                <td>                   
    84                     <p class="sc-wordai-settings-text-hints"><?php esc_html_e('GPT-4o mini, most cost-efficient small model. GPT-4o mini is affordable and intelligent small model for fast, lightweight tasks. GPT-4o mini is cheaper and more capable than GPT-3.5 Turbo. GPT-4o mini enables a broad range of tasks with its low cost and latency. GPT-4o is the latest step in pushing the boundaries of deep learning, in the direction of practical usability. GPT-4o is 2x faster, half the price, and has 5x higher rate limits compared to GPT-4 Turbo. GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy than any of previous models. GPT-4 is available in the OpenAI API to paying customers. The difference between GPT-4 and GPT-3.5 models is not significant. However, in more complex reasoning situations, GPT-4 is much more capable than any of OpenAI previous models. GPT-3.5 Turbo is most capable and cost effective model in the GPT-3.5 family.', 'wordai');?></p>
     84                    <p class="sc-wordai-settings-text-hints"><?php esc_html_e('GPT-4o mini, most cost-efficient small model. GPT-4o mini is affordable and intelligent small model for fast, lightweight tasks. GPT-4o mini is cheaper and more capable than GPT-3.5 Turbo. GPT-4o mini enables a broad range of tasks with its low cost and latency. GPT-4o is the latest step in pushing the boundaries of deep learning, in the direction of practical usability. GPT-4o is 2x faster, half the price, and has 5x higher rate limits compared to GPT-4 Turbo. GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy than any of previous models. GPT-4 is available in the OpenAI API to paying customers. The difference between GPT-4 and GPT-3.5 models is not significant. However, in more complex reasoning situations, GPT-4 is much more capable than any of OpenAI previous models. GPT-3.5 Turbo is most capable and cost effective model in the GPT-3.5 family. GPT-5, The best model for coding and agentic tasks across domains. GPT-5 mini, A faster, cost-efficient version of GPT-5 for well-defined tasks. GPT-5 nano Fastest, most cost-efficient version of GPT-5.', 'wordai');?></p>
     85                    <p class="alert-error"><small><?php esc_html_e('If you use GPT-5 / GPT-5-mini model then your organization must be verified to stream this model. Please go to: https://platform.openai.com/settings/organization/general and click on Verify Organization.', 'wordai');?></small></p>
    8586                </td>                   
    8687            </tr>               
     88            <tr>
     89                <td>
     90                    <h4><?php esc_html_e('GPT-5 Model Reasoning Effort', 'wordai');?></h4>
     91                    <?php
     92                        $reasoning_efforts  =   SFTCY_Wordai_OpenAI::openai_reasoning_effort();
     93                        echo '<select id="sc-wordai-openai-reasoning-effort" name="sc-wordai-openai-reasoning-effort">';
     94                        foreach ( $reasoning_efforts as $reasoning_effort_slug => $reasoning_effort_name ) {
     95                            $selected = isset( $data['sc-wordai-openai-reasoning-effort'] ) ? selected( $data['sc-wordai-openai-reasoning-effort'], $reasoning_effort_slug, false) : selected( $reasoning_effort_slug, SFTCY_Wordai_OpenAI::$gpt_5_reasoning_effort );
     96                            echo '<option value="'.  esc_attr( $reasoning_effort_slug ) .'" ' . esc_attr( $selected ) . '>' . esc_html( $reasoning_effort_name ) . '</option>';                         
     97                        }           
     98                        echo '</select>';                   
     99                    ?>                       
     100                </td>
     101                <td>                   
     102                    <p class="sc-wordai-settings-text-hints"><?php echo wp_kses('GPT-5 is great at reasoning through complex tasks. For complex tasks like coding and multi-step planning, use <strong><i>High</i></strong> reasoning effort. <strong><i>Low</strong></i> favored speed and fewer tokens, while high favored more thorough reasoning. The new minimal setting produces very few reasoning tokens for cases where you need the fastest possible time-to-first-token. Better keep it <strong><i>Low</strong></i> when using GPT-5 models if you are just generating contents.', [ 'strong' => [], 'i' => [] ], 'wordai');?></p>                   
     103                </td>                   
     104            </tr>                           
    87105            <tr>
    88106                <td>
  • wordai/trunk/includes/class-sftcy-wordai-openai.php

    r3279831 r3345921  
    1515       
    1616    //public static $MODEL          = 'gpt-4'; 
    17     public static $MODEL            = 'gpt-3.5-turbo';                                  // Default Model
     17    public static $MODEL            = 'gpt-4o-mini';                                    // Default Model
    1818    public static $IMAGE_MODEL      = 'dall-e-2';                                       // Default Dall-E-2
     19    public static $gpt_5_reasoning_effort = 'low';                                      // Default 'low', low | medium | high | minimal
    1920    public static $STREAM           = null;
    2021           
     
    134135        // $openai_params['model'] = $data['sc-wordai-openai-model-slug'];
    135136        $openai_params['model'] = ! isset( $data['sc-wordai-openai-model-slug'] ) || empty( $data['sc-wordai-openai-model-slug'] )? self::$MODEL : trim( $data['sc-wordai-openai-model-slug'] );
    136         $openai_params['max_tokens'] = empty( $data['sc-wordai-max-tokens'] ) ? null : intval( $data['sc-wordai-max-tokens'] ); // Ref: https://platform.openai.com/docs/api-reference/chat/create#chat-create-max_tokens
    137         $openai_params['temperature'] = floatval( $data['sc-wordai-temperature'] );
    138         $openai_params['top_p'] =  floatval( $data['sc-wordai-top-p'] );
     137
     138        // $openai_params['max_tokens'] = empty( $data['sc-wordai-max-tokens'] ) ? null : intval( $data['sc-wordai-max-tokens'] ); // Ref: https://platform.openai.com/docs/api-reference/chat/create#chat-create-max_tokens
     139        // $openai_params['temperature'] = floatval( $data['sc-wordai-temperature'] );
     140        // $openai_params['top_p'] =  floatval( $data['sc-wordai-top-p'] );
     141        // GPT-5 Models require 'max_completion_tokens', not supporting 'max_tokens' parameter
     142        if ( in_array( $openai_params['model'], [ 'gpt-5', 'gpt-5-mini', 'gpt-5-nano' ] ) ) {
     143            $openai_params['max_completion_tokens'] = empty( $data['sc-wordai-max-tokens'] ) ? null : intval( $data['sc-wordai-max-tokens'] ); // Ref: https://platform.openai.com/docs/api-reference/chat/create#chat_create-max_completion_tokens
     144            // In GPT-5 models 'temperature' only support 1 as default value
     145            $openai_params['temperature'] = 1;
     146            // GPT-5 models can use only 'reasoning_effort' parameter for response speed - Ref: https://platform.openai.com/docs/guides/latest-model#minimal-reasoning-effort
     147            $openai_params['reasoning_effort'] = $data['sc-wordai-openai-reasoning-effort'];
     148        }
     149        else {
     150            $openai_params['max_tokens'] = empty( $data['sc-wordai-max-tokens'] ) ? null : intval( $data['sc-wordai-max-tokens'] ); // Ref: https://platform.openai.com/docs/api-reference/chat/create#chat-create-max_tokens
     151            $openai_params['temperature'] = floatval( $data['sc-wordai-temperature'] );
     152            // 'top_p' is not supported in GPT-5 Models
     153            $openai_params['top_p'] =  floatval( $data['sc-wordai-top-p'] );
     154        }               
     155
    139156        $openai_params['presence_penalty'] = floatval( $data['sc-wordai-presence-penalty-input'] );
    140157        $openai_params['frequency_penalty'] = floatval( $data['sc-wordai-frequency-penalty-input'] );
     
    757774            'gpt-4o'          => 'GPT-4o',
    758775            'gpt-4o-mini'     => 'GPT-4o-mini',
    759             'gpt-4.1'         => 'GPT-4.1'
     776            'gpt-4.1'         => 'GPT-4.1',
     777            'gpt-5'           => 'GPT-5',
     778            'gpt-5-mini'      => 'GPT-5 mini',
     779            'gpt-5-nano'      => 'GPT-5 nano'
    760780        ];
    761781       
     
    763783    }
    764784   
     785    /**
     786     * OpenAI GPT-5 reasoning effort
     787     * GPT-5 models can use only 'reasoning_effort' parameter for response speed - Ref: https://platform.openai.com/docs/guides/latest-model#minimal-reasoning-effort
     788     * @since 1.0.0
     789     */
     790    public static function openai_reasoning_effort() {
     791        $reasoning_effort   =   [
     792            'low'     => 'Low',
     793            'medium'  => 'Medium',
     794            'high'    => 'High',
     795            'minimal' => 'Minimal'
     796        ];
     797       
     798        return $reasoning_effort;
     799    }
     800
    765801    /**
    766802     * OpenAI Image Models
  • wordai/trunk/includes/class-sftcy-wordai.php

    r3148245 r3345921  
    282282               
    283283        $settings_data['sc-wordai-openai-model-slug'] = isset( $options_data['sc-wordai-openai-model-slug'] )? sanitize_text_field( $options_data['sc-wordai-openai-model-slug'] ) : SFTCY_Wordai_OpenAI::$MODEL;
     284        // GPT-5 models can use only 'reasoning_effort' parameter for response speed - Ref: https://platform.openai.com/docs/guides/latest-model#minimal-reasoning-effort
     285        $settings_data['sc-wordai-openai-reasoning-effort'] = isset( $options_data['sc-wordai-openai-reasoning-effort'] )? sanitize_text_field( $options_data['sc-wordai-openai-reasoning-effort'] ) : SFTCY_Wordai_OpenAI::$gpt_5_reasoning_effort;
    284286        // Initial streaming true as default if not set
    285287        $options_data['sc-wordai-streaming'] = ( ! isset( $options_data['sc-wordai-streaming'] ) )? $default['sc-wordai-streaming'] : ( ( isset( $options_data['sc-wordai-streaming'] ) && $options_data['sc-wordai-streaming'] == 1 )? 1 : 0 );
  • wordai/trunk/readme.txt

    r3279831 r3345921  
    66Tested up to: 6.8
    77Requires PHP: 7.2
    8 Stable tag: 1.0.5
     8Stable tag: 1.0.6
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3333* Supports All Major Languages - Content can be written in any language
    3434* Different Content Writing Styles
    35 * Diffrent Content Writing Tones
    36 * Different OpenAI supported image sizes selection options
     35* Different Content Writing Tones
     36* Different Open AI supported image sizes selection options
    3737* WooCommerce product Title / Description / Short Description Generation
    3838* WooCommerce product images Generation
     
    45451. Install 'WordAI' Auto Content Writer by uploading the plugin to the '/wp-content/plugins/' directory inside.
    46462. Activate the plugin through the 'Plugins' menu in WordPress.
    47 3. First put your openAI [API key](https://platform.openai.com/account/api-keys) through 'API Settings' page of the plugin.
    48 4. Then you are ready to generate auto content / HD images for your Wordpress!
     473. First put your open AI [API key](https://platform.openai.com/account/api-keys) through 'API Settings' page of the plugin.
     484. Then you are ready to generate auto content / HD images for your WordPress!
    4949
    5050
     
    9696== Changelog ==
    9797
     98= 1.0.6 =
     99* Added GPT-5 models ( GPT-5, GPT-5-mini, GPT-5-nano )
     100* Other minor bug fixes
     101
    98102= 1.0.5 =
    99103* Added GPT-4.1 model
  • wordai/trunk/wordai.php

    r3279831 r3345921  
    44 * Plugin URI:  https://softcoy.com
    55 * Description: AI driven humanlike SEO friendly content writing with HD images generation based on OpenAI. Automatize your Post / Page / Product content writing tasks.
    6  * Version:     1.0.5
     6 * Version:     1.0.6
    77 * Author:      softcoy
    88 * Author URI:  https://softcoy.com/
     
    3636 
    3737if ( ! defined( 'SFTCY_WORDAI_VERSION') ) {
    38   define( 'SFTCY_WORDAI_VERSION', '1.0.5' );
     38  define( 'SFTCY_WORDAI_VERSION', '1.0.6' );
    3939}
    4040if ( ! defined( 'SFTCY_WORDAI_MINIMUM_PHP_VERSION') ) {
Note: See TracChangeset for help on using the changeset viewer.