Plugin Directory

Changeset 3778598


Ignore:
Timestamp:
11/01/2026 09:58:19 PM (2 hours ago)
Author:
kognetiks
Message:

2.5.5 - Released 2026-11-01

### Bug Fixes

  • Anthropic replies: Current Claude models can return a thinking block before the answer. The plugin read only the first block, so a successful reply was replaced with a generic API error. Replies are now taken from the text blocks. Haiku 5.5, Sonnet 5, and Opus 5 turn thinking off so the token cap is available for the answer. Sonnet 5.5 uses between-tools thinking, which does not spend that cap before a normal chat reply.
  • Anthropic output limit: Opus 5.5 and Fable keep thinking on, and those thinking tokens count against the max tokens setting. A setting below 4,000 is sent as 4,000 for those models. If the model still uses the whole cap before it writes a reply, the chatbot names the model and asks you to increase the Anthropic max tokens setting.
Location:
chatbot-chatgpt/trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • chatbot-chatgpt/trunk/CHANGELOG.md

    r3773130 r3778598  
    66
    77---
     8
     9= 2.5.5 - Released 2026-11-01 =
     10
     11### Bug Fixes
     12* **Anthropic replies**: Current Claude models can return a thinking block before the answer. The plugin read only the first block, so a successful reply was replaced with a generic API error. Replies are now taken from the text blocks. Haiku 5.5, Sonnet 5, and Opus 5 turn thinking off so the token cap is available for the answer. Sonnet 5.5 uses between-tools thinking, which does not spend that cap before a normal chat reply.
     13* **Anthropic output limit**: Opus 5.5 and Fable keep thinking on, and those thinking tokens count against the max tokens setting. A setting below 4,000 is sent as 4,000 for those models. If the model still uses the whole cap before it writes a reply, the chatbot names the model and asks you to increase the Anthropic max tokens setting.
     14
     15= 2.5.4 - Released 2026-10-31 =
     16
     17### Bug Fixes
     18* **Anthropic model list**: The Anthropic model list had become stale. It is now refreshed from the API.
    819
    920= 2.5.3 - Released 2026-10-29 =
  • chatbot-chatgpt/trunk/SECURITY.md

    r3776949 r3778598  
    55| Version   | Supported          |
    66|-----------|--------------------|
    7 |   2.5.4   | :white_check_mark: |
    8 | < 2.5.4   | :x:                |
     7|   2.5.5   | :white_check_mark: |
     8| < 2.5.5   | :x:                |
    99
    1010## Reporting a Vulnerability
  • chatbot-chatgpt/trunk/chatbot-chatgpt.php

    r3776949 r3778598  
    55 * Plugin URI:  https://github.com/kognetiks/kognetiks-chatbot
    66 * Description: This simple plugin adds an AI powered chatbot to your WordPress website.
    7  * Version:     2.5.4
     7 * Version:     2.5.5
    88 * Author:      Kognetiks.com
    99 * Author URI:  https://www.kognetiks.com
    … …  
    3030 *
    3131 * @package chatbot-chatgpt
    32  * @version 2.5.4
     32 * @version 2.5.5
    3333 * @author Kognetiks.com
    3434 */
    … …  
    8585    // Plugin version
    8686    global $chatbot_chatgpt_plugin_version;
    87     $chatbot_chatgpt_plugin_version = '2.5.4';
     87    $chatbot_chatgpt_plugin_version = '2.5.5';
    8888    // Plugin directory path
    8989    global $chatbot_chatgpt_plugin_dir_path;
  • chatbot-chatgpt/trunk/documentation/overview.md

    r3776949 r3778598  
    4545The **Kognetiks Chatbot** plugin now includes a novel feature: the Sentential Context Model.  This new **beta feature** allows the chatbot to generate intelligent responses by leveraging your website's content - no AI platform connection required.  It's perfect for localized use or content-focused applications, this feature makes the chatbot more versatile than ever.
    4646
    47 ## What's new in Version 2.5.4 - Released TBD
     47## What's new in Version 2.5.5 - Released 2026-11-01
    4848
    4949### Bug Fixes
    50 * **TBD**: TBD
     50* **Anthropic replies**: Current Claude models can return a thinking block before the answer. The plugin read only the first block, so a successful reply was replaced with a generic API error. Replies are now taken from the text blocks. Haiku 5.5, Sonnet 5, and Opus 5 turn thinking off so the token cap is available for the answer. Sonnet 5.5 uses between-tools thinking, which does not spend that cap before a normal chat reply.
     51* **Anthropic output limit**: Opus 5.5 and Fable keep thinking on, and those thinking tokens count against the max tokens setting. A setting below 4,000 is sent as 4,000 for those models. If the model still uses the whole cap before it writes a reply, the chatbot names the model and asks you to increase the Anthropic max tokens setting.
     52
    5153
    5254* Information about past updates can be found [here](updates/updates.md).
  • chatbot-chatgpt/trunk/documentation/specs/functional-details.md

    r3776949 r3778598  
    55The **Kognetiks Chatbot** is a comprehensive WordPress plugin that integrates advanced AI capabilities into WordPress websites. It provides intelligent conversational experiences through multiple AI platforms, offering both cloud-based and local AI solutions for enhanced visitor engagement, customer support, and interactive assistance.
    66
    7 **Version:** 2.5.4
     7**Version:** 2.5.5
    88**License:** GPLv3 or later 
    99**WordPress Compatibility:** Tested up to WordPress 7.1
    … …  
    566566## Version History
    567567
     568## What's new in Version 2.5.5 - Released 2026-11-01
     569
     570### Bug Fixes
     571* **Anthropic replies**: Current Claude models can return a thinking block before the answer. The plugin read only the first block, so a successful reply was replaced with a generic API error. Replies are now taken from the text blocks. Haiku 5.5, Sonnet 5, and Opus 5 turn thinking off so the token cap is available for the answer. Sonnet 5.5 uses between-tools thinking, which does not spend that cap before a normal chat reply.
     572* **Anthropic output limit**: Opus 5.5 and Fable keep thinking on, and those thinking tokens count against the max tokens setting. A setting below 4,000 is sent as 4,000 for those models. If the model still uses the whole cap before it writes a reply, the chatbot names the model and asks you to increase the Anthropic max tokens setting.
     573
     574## What's new in Version 2.5.4 - Released 2026-10-31
     575
     576### Bug Fixes
     577* **Anthropic model list**: The Anthropic model list had become stale. It is now refreshed from the API.
     578
    568579## What's new in Version 2.5.3 - Released 2026-10-29
    569580
    570581### Bug Fixes
    571582* **Transcript download**: Download Transcript now saves a text file in the browser from the conversation shown in that chatbot.
    572 
    573 ## What's new in Version 2.5.4 - Released TBD
    574 
    575 ### Bug Fixes
    576 * **TBD**: TBD
    577583
    578584## What's new in Version 2.5.2 - Released 2026-10-28
  • chatbot-chatgpt/trunk/documentation/updates/updates.md

    r3776949 r3778598  
    11# Past Updates
    22
    3 ## What's new in Version 2.5.4 - Released TBD
    4 
    5 ### Bug Fixes
    6 * **TBD**: TBD
     3## What's new in Version 2.5.5 - Released 2026-11-01
     4
     5### Bug Fixes
     6* **Anthropic replies**: Current Claude models can return a thinking block before the answer. The plugin read only the first block, so a successful reply was replaced with a generic API error. Replies are now taken from the text blocks. Haiku 5.5, Sonnet 5, and Opus 5 turn thinking off so the token cap is available for the answer. Sonnet 5.5 uses between-tools thinking, which does not spend that cap before a normal chat reply.
     7* **Anthropic output limit**: Opus 5.5 and Fable keep thinking on, and those thinking tokens count against the max tokens setting. A setting below 4,000 is sent as 4,000 for those models. If the model still uses the whole cap before it writes a reply, the chatbot names the model and asks you to increase the Anthropic max tokens setting.
     8
     9
     10## What's new in Version 2.5.4 - Released 2026-10-31
     11
     12### Bug Fixes
     13* **Anthropic model list**: The Anthropic model list had become stale. It is now refreshed from the API.
    714
    815## What's new in Version 2.5.3 - Released 2026-10-29
  • chatbot-chatgpt/trunk/includes/chatbot-call-anthropic-api.php

    r3776949 r3778598  
    7474    $kchat_settings['model'] = $model;
    7575 
    76     // Max tokens
    77     $max_tokens = intval(esc_attr(get_option('chatbot_anthropic_max_tokens_setting', '1000')));
     76    // Max tokens. Models that keep thinking on need room for thinking and the reply.
     77    $max_tokens = chatbot_anthropic_output_token_cap(
     78        $model,
     79        intval(esc_attr(get_option('chatbot_anthropic_max_tokens_setting', '1000')))
     80    );
    7881
    7982    // Build conversation context using standardized function - Ver 2.3.9+
    … …  
    195198
    196199    // Define the request body - Ver 2.3.9+
    197     // Use Anthropic's native 'system' parameter and structured 'messages' array
    198     $body = json_encode(array(
     200    // Use Anthropic's native 'system' parameter and structured 'messages' array.
     201    // max_tokens covers thinking and text, so up-front thinking is turned off for models that support it.
     202    $body = array(
    199203        'model' => $model,
    200204        'max_tokens' => $max_tokens,
    201205        'system' => $system_message, // Top-level parameter for system message
    202206        'messages' => $messages,
    203     ));
     207    );
     208    $thinking = chatbot_anthropic_thinking_config($model);
     209    if (is_array($thinking)) {
     210        $body['thinking'] = $thinking;
     211    }
     212    $body = json_encode($body);
    204213
    205214    $timeout = esc_attr(get_option('chatbot_anthropic_timeout_setting', 240 ));
    … …  
    267276    }
    268277
    269     if (isset($response_body['content'][0]['text']) && !empty($response_body['content'][0]['text'])) {
     278    // Current models can return thinking blocks before the reply. Read text blocks by type.
     279    // A reply that reaches max_tokens is still the reply, so that text is returned.
     280    $reply = chatbot_anthropic_response_text($response_body);
     281    if ('' !== $reply) {
    270282        // Handle the response from the chat engine
    271283        // Context History - Ver 1.6.1
    272         addEntry('chatbot_chatgpt_context_history', $response_body['content'][0]['text']);
     284        addEntry('chatbot_chatgpt_context_history', $reply);
    273285        // Clear locks on success
    274286        // Lock clearing removed - main send function handles locking
    275         return $response_body['content'][0]['text'];
     287        return $reply;
    276288    } else {
     289        $stop_reason = (is_array($response_body) && isset($response_body['stop_reason']) && is_string($response_body['stop_reason'])) ? sanitize_text_field($response_body['stop_reason']) : '';
     290        $logged_model = chatbot_anthropic_model_id_is_valid($model) ? $model : 'unknown';
     291        prod_trace('ERROR', 'No valid Anthropic text block. model=' . $logged_model . ' max_tokens=' . intval($max_tokens) . ('' !== $stop_reason ? ' stop_reason=' . $stop_reason : ''));
     292        $limit_message = chatbot_anthropic_empty_reply_message($model, $stop_reason);
     293        if ('' !== $limit_message) {
     294            return $limit_message;
     295        }
    277296        // FIXME - Decide what to return here - it's an error
    278297        if (get_locale() !== "en_US") {
  • chatbot-chatgpt/trunk/includes/settings/chatbot-settings-api-test.php

    r3776949 r3778598  
    297297            );
    298298
    299             // Set the body
     299            // Set the body. max_tokens covers thinking and text, so up-front thinking is turned off.
     300            // Models that keep thinking on use at least 4000 so the test reply is not crowded out.
    300301            $body = array(
    301302                'model' => $model,
    302                 'max_tokens' => 100,
     303                'max_tokens' => chatbot_anthropic_output_token_cap($model, 100),
    303304                'system' => 'You are a helpful assistant.',
    304305                'messages' => array(
    … …  
    309310                )
    310311            );
     312            $thinking = chatbot_anthropic_thinking_config($model);
     313            if (is_array($thinking)) {
     314                $body['thinking'] = $thinking;
     315            }
    311316
    312317            // Encode the body
    … …  
    344349                $updated_status = 'API Error Type: ' . $error_type . ' Message: ' . $error_message;
    345350           
    346             } elseif (isset($response_data['type']) && $response_data['type'] === 'message') {
    347 
    348                 // Handle successful response
    349                 $content_type = $response_data['content'][0]['type'] ?? 'Unknown Content Type';
    350                 $content_text = $response_data['content'][0]['text'] ?? 'No content available.';
    351            
    352                 // Handle successful response
     351            } elseif (isset($response_data['type']) && $response_data['type'] === 'message' && '' !== chatbot_anthropic_response_text($response_data)) {
     352
     353                // Handle successful response. Text may follow a thinking block.
    353354                $updated_status = 'Success: Connection to the ' . $chatbot_ai_platform_choice . ' API was successful!';
    354355
    355356            } else {
    356357
    357                 // Handle unexpected response structure
    358                 $updated_status = 'Error: Unexpected response format from the ' . $chatbot_ai_platform_choice . ' API. Please check Settings for a valid API key or your ' . $chatbot_ai_platform_choice . ' account for additional information.';
     358                $stop_reason = (is_array($response_data) && isset($response_data['stop_reason']) && is_string($response_data['stop_reason'])) ? sanitize_text_field($response_data['stop_reason']) : '';
     359                $limit_message = chatbot_anthropic_empty_reply_message($model, $stop_reason);
     360                if ('' !== $limit_message) {
     361                    $updated_status = $limit_message;
     362                } else {
     363                    // Handle unexpected response structure
     364                    $updated_status = 'Error: Unexpected response format from the ' . $chatbot_ai_platform_choice . ' API. Please check Settings for a valid API key or your ' . $chatbot_ai_platform_choice . ' account for additional information.';
     365                }
    359366
    360367            }
  • chatbot-chatgpt/trunk/includes/utilities/chatbot-models.php

    r3776949 r3778598  
    728728
    729729    return $normalized;
     730
     731}
     732
     733// Turn off up-front thinking so the token budget is available for the reply.
     734// Sonnet 5.5 rejects "disabled". Haiku 5.5 rejects "between_tools". Other models keep the request unchanged.
     735function chatbot_anthropic_thinking_config( $model ) {
     736
     737    $id = strtolower( (string) $model );
     738
     739    if ( false !== strpos( $id, 'sonnet-5-5' ) ) {
     740        return array( 'type' => 'between_tools' );
     741    }
     742
     743    if ( false !== strpos( $id, 'haiku-5-5' ) || false !== strpos( $id, 'sonnet-5' ) ) {
     744        return array( 'type' => 'disabled' );
     745    }
     746
     747    if ( false !== strpos( $id, 'opus-5' ) && false === strpos( $id, 'opus-5-5' ) ) {
     748        return array( 'type' => 'disabled' );
     749    }
     750
     751    return null;
     752
     753}
     754
     755// Opus 5.5 and Fable keep adaptive thinking, and those tokens count toward max_tokens.
     756function chatbot_anthropic_thinking_stays_on( $model ) {
     757
     758    $id = strtolower( (string) $model );
     759
     760    return ( false !== strpos( $id, 'opus-5-5' ) || false !== strpos( $id, 'fable-5' ) );
     761
     762}
     763
     764// A cap sized for a reply alone can be spent before any text exists on models that keep thinking on.
     765function chatbot_anthropic_output_token_cap( $model, $max_tokens ) {
     766
     767    $cap = intval( $max_tokens );
     768    if ( $cap < 1 ) {
     769        $cap = 1000;
     770    }
     771
     772    if ( chatbot_anthropic_thinking_stays_on( $model ) && $cap < 4000 ) {
     773        return 4000;
     774    }
     775
     776    return $cap;
     777
     778}
     779
     780// Shown when thinking uses the whole output cap and no reply text is returned.
     781function chatbot_anthropic_empty_reply_message( $model, $stop_reason ) {
     782
     783    $stop_reason = is_string( $stop_reason ) ? $stop_reason : '';
     784    if ( 'max_tokens' !== $stop_reason ) {
     785        return '';
     786    }
     787
     788    $name = chatbot_anthropic_model_id_is_valid( $model ) ? $model : 'The selected model';
     789
     790    return $name . ' used its output limit before it wrote a reply. Increase the Anthropic max tokens setting.';
     791
     792}
     793
     794// Join text blocks and skip thinking blocks that precede them.
     795function chatbot_anthropic_response_text( $response_body ) {
     796
     797    if ( ! is_array( $response_body ) || empty( $response_body['content'] ) || ! is_array( $response_body['content'] ) ) {
     798        return '';
     799    }
     800
     801    $parts = array();
     802
     803    foreach ( $response_body['content'] as $block ) {
     804
     805        if ( ! is_array( $block ) ) {
     806            continue;
     807        }
     808
     809        $type = isset( $block['type'] ) ? $block['type'] : 'text';
     810        if ( 'text' !== $type || ! isset( $block['text'] ) || ! is_string( $block['text'] ) ) {
     811            continue;
     812        }
     813
     814        if ( '' === trim( $block['text'] ) ) {
     815            continue;
     816        }
     817
     818        $parts[] = $block['text'];
     819
     820    }
     821
     822    return trim( implode( "\n", $parts ) );
    730823
    731824}
  • chatbot-chatgpt/trunk/readme.txt

    r3776949 r3778598  
    66Tested up to: 7.1.4
    77Requires PHP: 8.0
    8 Stable tag: 2.5.4
     8Stable tag: 2.5.5
    99License: GPLv3 or later
    1010License URI: https://www.gnu.org/licenses/gpl-3.0.html
    … …  
    194194== Changelog ==
    195195
    196 = 2.5.4 - Released TBD =
    197 
    198 ### Bug Fixes
    199 * **TBD**: TBD
     196= 2.5.5 - Released 2026-11-01 =
     197
     198### Bug Fixes
     199* **Anthropic replies**: Current Claude models can return a thinking block before the answer. The plugin read only the first block, so a successful reply was replaced with a generic API error. Replies are now taken from the text blocks. Haiku 5.5, Sonnet 5, and Opus 5 turn thinking off so the token cap is available for the answer. Sonnet 5.5 uses between-tools thinking, which does not spend that cap before a normal chat reply.
     200* **Anthropic output limit**: Opus 5.5 and Fable keep thinking on, and those thinking tokens count against the max tokens setting. A setting below 4,000 is sent as 4,000 for those models. If the model still uses the whole cap before it writes a reply, the chatbot names the model and asks you to increase the Anthropic max tokens setting.
     201
     202= 2.5.4 - Released 2026-10-31 =
     203
     204### Bug Fixes
     205* **Anthropic model list**: The Anthropic model list had become stale. It is now refreshed from the API.
    200206
    201207= 2.5.3 - Released 2026-10-29 =
Note: See TracChangeset for help on using the changeset viewer.