Changeset 3778598
- Timestamp:
- 11/01/2026 09:58:19 PM (2 hours ago)
- Location:
- chatbot-chatgpt/trunk
- Files:
-
- 10 edited
-
CHANGELOG.md (modified) (1 diff)
-
SECURITY.md (modified) (1 diff)
-
chatbot-chatgpt.php (modified) (3 diffs)
-
documentation/overview.md (modified) (1 diff)
-
documentation/specs/functional-details.md (modified) (2 diffs)
-
documentation/updates/updates.md (modified) (1 diff)
-
includes/chatbot-call-anthropic-api.php (modified) (3 diffs)
-
includes/settings/chatbot-settings-api-test.php (modified) (3 diffs)
-
includes/utilities/chatbot-models.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
chatbot-chatgpt/trunk/CHANGELOG.md
r3773130 r3778598 6 6 7 7 --- 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. 8 19 9 20 = 2.5.3 - Released 2026-10-29 = -
chatbot-chatgpt/trunk/SECURITY.md
r3776949 r3778598 5 5 | Version | Supported | 6 6 |-----------|--------------------| 7 | 2.5. 4| :white_check_mark: |8 | < 2.5. 4| :x: |7 | 2.5.5 | :white_check_mark: | 8 | < 2.5.5 | :x: | 9 9 10 10 ## Reporting a Vulnerability -
chatbot-chatgpt/trunk/chatbot-chatgpt.php
r3776949 r3778598 5 5 * Plugin URI: https://github.com/kognetiks/kognetiks-chatbot 6 6 * Description: This simple plugin adds an AI powered chatbot to your WordPress website. 7 * Version: 2.5. 47 * Version: 2.5.5 8 8 * Author: Kognetiks.com 9 9 * Author URI: https://www.kognetiks.com … … 30 30 * 31 31 * @package chatbot-chatgpt 32 * @version 2.5. 432 * @version 2.5.5 33 33 * @author Kognetiks.com 34 34 */ … … 85 85 // Plugin version 86 86 global $chatbot_chatgpt_plugin_version; 87 $chatbot_chatgpt_plugin_version = '2.5. 4';87 $chatbot_chatgpt_plugin_version = '2.5.5'; 88 88 // Plugin directory path 89 89 global $chatbot_chatgpt_plugin_dir_path; -
chatbot-chatgpt/trunk/documentation/overview.md
r3776949 r3778598 45 45 The **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. 46 46 47 ## What's new in Version 2.5. 4 - Released TBD47 ## What's new in Version 2.5.5 - Released 2026-11-01 48 48 49 49 ### 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 51 53 52 54 * Information about past updates can be found [here](updates/updates.md). -
chatbot-chatgpt/trunk/documentation/specs/functional-details.md
r3776949 r3778598 5 5 The **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. 6 6 7 **Version:** 2.5. 47 **Version:** 2.5.5 8 8 **License:** GPLv3 or later 9 9 **WordPress Compatibility:** Tested up to WordPress 7.1 … … 566 566 ## Version History 567 567 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 568 579 ## What's new in Version 2.5.3 - Released 2026-10-29 569 580 570 581 ### Bug Fixes 571 582 * **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 TBD574 575 ### Bug Fixes576 * **TBD**: TBD577 583 578 584 ## What's new in Version 2.5.2 - Released 2026-10-28 -
chatbot-chatgpt/trunk/documentation/updates/updates.md
r3776949 r3778598 1 1 # Past Updates 2 2 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. 7 14 8 15 ## What's new in Version 2.5.3 - Released 2026-10-29 -
chatbot-chatgpt/trunk/includes/chatbot-call-anthropic-api.php
r3776949 r3778598 74 74 $kchat_settings['model'] = $model; 75 75 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 ); 78 81 79 82 // Build conversation context using standardized function - Ver 2.3.9+ … … 195 198 196 199 // 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( 199 203 'model' => $model, 200 204 'max_tokens' => $max_tokens, 201 205 'system' => $system_message, // Top-level parameter for system message 202 206 '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); 204 213 205 214 $timeout = esc_attr(get_option('chatbot_anthropic_timeout_setting', 240 )); … … 267 276 } 268 277 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) { 270 282 // Handle the response from the chat engine 271 283 // Context History - Ver 1.6.1 272 addEntry('chatbot_chatgpt_context_history', $re sponse_body['content'][0]['text']);284 addEntry('chatbot_chatgpt_context_history', $reply); 273 285 // Clear locks on success 274 286 // Lock clearing removed - main send function handles locking 275 return $re sponse_body['content'][0]['text'];287 return $reply; 276 288 } 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 } 277 296 // FIXME - Decide what to return here - it's an error 278 297 if (get_locale() !== "en_US") { -
chatbot-chatgpt/trunk/includes/settings/chatbot-settings-api-test.php
r3776949 r3778598 297 297 ); 298 298 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. 300 301 $body = array( 301 302 'model' => $model, 302 'max_tokens' => 100,303 'max_tokens' => chatbot_anthropic_output_token_cap($model, 100), 303 304 'system' => 'You are a helpful assistant.', 304 305 'messages' => array( … … 309 310 ) 310 311 ); 312 $thinking = chatbot_anthropic_thinking_config($model); 313 if (is_array($thinking)) { 314 $body['thinking'] = $thinking; 315 } 311 316 312 317 // Encode the body … … 344 349 $updated_status = 'API Error Type: ' . $error_type . ' Message: ' . $error_message; 345 350 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. 353 354 $updated_status = 'Success: Connection to the ' . $chatbot_ai_platform_choice . ' API was successful!'; 354 355 355 356 } else { 356 357 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 } 359 366 360 367 } -
chatbot-chatgpt/trunk/includes/utilities/chatbot-models.php
r3776949 r3778598 728 728 729 729 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. 735 function 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. 756 function 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. 765 function 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. 781 function 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. 795 function 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 ) ); 730 823 731 824 } -
chatbot-chatgpt/trunk/readme.txt
r3776949 r3778598 6 6 Tested up to: 7.1.4 7 7 Requires PHP: 8.0 8 Stable tag: 2.5. 48 Stable tag: 2.5.5 9 9 License: GPLv3 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 194 194 == Changelog == 195 195 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. 200 206 201 207 = 2.5.3 - Released 2026-10-29 =
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)