Plugin Directory

Changeset 3405838


Ignore:
Timestamp:
11/29/2025 03:06:12 PM (3 months ago)
Author:
rhapsodyplugins
Message:

1.1.6 - 2025-11-29

  • Added: Test chatbot feature with instructions.
  • Added: Instructions added for training chatbot.
  • Update: Improved chat conversion system message.
Location:
helpmate-ai-chatbot
Files:
240 added
72 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • helpmate-ai-chatbot/trunk/README.txt

    r3401246 r3405838  
    55Requires PHP: 7.4
    66Tested up to: 6.8
    7 Stable tag: 1.1.5
     7Stable tag: 1.1.6
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3636- [Sales-based social proof notifications boost website conversions by 98%](https://rhapsodyplugins.com/helpmate-landing/?utm_source=wp_org&utm_medium=wp_readme&utm_campaign=free_user&#social-proof) - WiserNotify, 2025
    3737
    38 https://www.youtube.com/watch?v=5i4c7bjnxB8
     38https://www.youtube.com/watch?v=qMXFyZg6SUw
    3939
    4040---
     
    285285== Version Update Logs ==
    286286
     287= 1.1.6 - 2025-11-29 =
     288
     289- Added: Test chatbot feature with instructions.
     290- Added: Instructions added for training chatbot.
     291- Update: Improved chat conversion system message.
     292
    287293= 1.1.5 - 2025-11-23 =
    288294
     
    325331
    326332== Changelog ==
     333
     334= 1.1.6 - 2025-11-29 =
     335
     336- Added: Test chatbot feature with instructions.
     337- Added: Instructions added for training chatbot.
     338- Update: Improved chat conversion system message.
    327339
    328340= 1.1.5 - 2025-11-23 =
  • helpmate-ai-chatbot/trunk/admin/class-helpmate-admin.php

    r3389140 r3405838  
    241241        add_submenu_page(
    242242            'helpmate',
     243            'Test Chatbot',
     244            'Test Chatbot',
     245            'manage_options',
     246            'helpmate&tab=test-chatbot',
     247            array($this, 'display_plugin_setup_page')
     248        );
     249
     250        add_submenu_page(
     251            'helpmate',
    243252            'App Center',
    244253            'App Center',
     
    298307    public function redirect_to_support()
    299308    {
     309        // phpcs:ignore WordPress.Security.SafeRedirect.wp_redirect_wp_redirect -- Safe hardcoded redirect to plugin support page
    300310        wp_redirect('https://rhapsodyplugins.com/contact');
    301311        exit;
     
    309319    public function redirect_to_pricing()
    310320    {
     321        // phpcs:ignore WordPress.Security.SafeRedirect.wp_redirect_wp_redirect -- Safe hardcoded redirect to plugin pricing page
    311322        wp_redirect('https://rhapsodyplugins.com/helpmate/#pricing');
    312323        exit;
  • helpmate-ai-chatbot/trunk/helpmate-ai-chatbot.php

    r3401246 r3405838  
    1717 * Plugin URI:        https://rhapsodyplugins.com/helpmate
    1818 * Description:       Helpmate is an AI-powered WooCommerce chatbot that boosts sales, automates support, and engages customers 24/7 with smart, human-like chat.
    19  * Version:           1.1.5
     19 * Version:           1.1.6
    2020 * Author:            Rhapsody Plugins
    2121 * Author URI:        https://rhapsodyplugins.com/
    2222 * Requires at least: 5.0
    2323 * Tested up to:      6.8.2
    24  * Stable tag:        1.1.5
     24 * Stable tag:        1.1.6
    2525 * Requires PHP:      7.4
    2626 * License:           GPL-2.0+
     
    3838 * Rename this for your plugin and update it as you release new versions.
    3939 */
    40 define('HELPMATE_VERSION', '1.1.5');
     40define('HELPMATE_VERSION', '1.1.6');
    4141
    4242/**
     
    7979 * This action is documented in includes/class-helpmate-activator.php
    8080 */
     81// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Function is prefixed with plugin name
    8182function activate_helpmate()
    8283{
     
    8990 * This action is documented in includes/class-helpmate-deactivator.php
    9091 */
     92// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Function is prefixed with plugin name
    9193function deactivate_helpmate()
    9294{
     
    124126 * @since    1.0.0
    125127 */
     128// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Function is prefixed with plugin name
    126129function run_helpmate()
    127130{
  • helpmate-ai-chatbot/trunk/includes/chat/class-helpmate-chat-database.php

    r3373236 r3405838  
    4747        );
    4848
    49         foreach ($messages as $message) {
     49        foreach ($messages as &$message) {
    5050            $message['metadata'] = json_decode($message['metadata'], true);
    5151        }
     
    7070            $offset = ($page - 1) * $per_page;
    7171
    72             // Get total count
     72            // Get total count (excluding debug sessions)
    7373            $total_count = $wpdb->get_var( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
    74                 "SELECT COUNT(DISTINCT session_id) FROM {$wpdb->prefix}helpmate_chat_history"
    75             );
    76 
    77             // Get paginated sessions
     74                "SELECT COUNT(DISTINCT session_id)
     75                FROM {$wpdb->prefix}helpmate_chat_history
     76                WHERE session_id NOT IN (
     77                    SELECT DISTINCT session_id
     78                    FROM {$wpdb->prefix}helpmate_chat_history
     79                    WHERE JSON_EXTRACT(metadata, '$.debug') = true
     80                )"
     81            );
     82
     83            // Get paginated sessions (excluding debug sessions)
    7884            $sessions = $wpdb->get_results( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
    7985                $wpdb->prepare(
     
    8591                        MAX(timestamp) as last_activity
    8692                    FROM {$wpdb->prefix}helpmate_chat_history
     93                    WHERE session_id NOT IN (
     94                        SELECT DISTINCT session_id
     95                        FROM {$wpdb->prefix}helpmate_chat_history
     96                        WHERE JSON_EXTRACT(metadata, '$.debug') = true
     97                    )
    8798                    GROUP BY session_id
    8899                    ORDER BY last_activity DESC
     
    95106
    96107            foreach ($sessions as &$session) {
    97                 $session['start_time'] = gmdate('Y-m-d H:i:s', $session['start_time']);
    98                 $session['last_activity'] = gmdate('Y-m-d H:i:s', $session['last_activity']);
     108                $session['start_time'] = (int) $session['start_time'];
     109                $session['last_activity'] = (int) $session['last_activity'];
    99110                $session['message_count'] = (int) $session['message_count'];
    100111                $session['total_tokens'] = (int) $session['total_tokens'];
  • helpmate-ai-chatbot/trunk/includes/chat/class-helpmate-chat-helpers.php

    r3387220 r3405838  
    575575                    foreach ($chat_history as $message) {
    576576                        $assistant_message = isset(json_decode($message['message'], true)['text']) ? json_decode($message['message'], true) : null;
    577                         $context = isset(json_decode($message['metadata'], true)['rag_context']) ? json_decode($message['metadata'], true)['rag_context'] : '';
     577                        $context = isset($message['metadata']['rag_context']) ? $message['metadata']['rag_context'] : '';
    578578                        $messages[] = [
    579579                            'role' => $message['role'],
  • helpmate-ai-chatbot/trunk/includes/chat/class-helpmate-chat-response-generator.php

    r3379655 r3405838  
    7272     * @param string $session_id The session ID.
    7373     * @param string $custom_system_message The custom system message.
    74      * @param array $rag_context The RAG context.
    7574     * @param string $image_url The image URL.
     75     * @param bool $debug Whether to enable debug mode.
    7676     * @return array The chat response.
    7777     */
    78     public function get_chat_response($prompt, $messages, $session_id, $custom_system_message = '', $image_url = '')
     78    public function get_chat_response($prompt, $messages, $session_id, $custom_system_message = '', $image_url = '', $debug = false)
    7979    {
    8080
     
    122122                'temperature' => $temperature,
    123123                'similarity_threshold' => $similarity_threshold,
    124                 'modules' => $this->modules_in_use()
     124                'modules' => $this->modules_in_use(),
     125                'debug' => $debug
    125126            ]),
    126127            'timeout' => 60,
     
    147148     * @param string $product_id Optional product ID.
    148149     * @param Helpmate_Chat_Helpers $helpers The helpers instance.
     150     * @param bool $debug Whether to enable debug mode.
    149151     * @return array The response with session_id.
    150152     */
    151     public function generate_response(string $prompt, array $context = [], string $session_id = '', string $image_url = '', $product_id = '', $helpers = null): array
     153    public function generate_response(string $prompt, array $context = [], string $session_id = '', string $image_url = '', $product_id = '', $helpers = null, $debug = false): array
    152154    {
    153155        // Initialize session if needed
     
    166168        }
    167169
    168         $data = $this->get_chat_response($prompt, $messages, $session_id, '', $image_url);
     170        $data = $this->get_chat_response($prompt, $messages, $session_id, '', $image_url, $debug);
    169171
    170172        $data = $this->execute_tool_call($data);
     
    177179                ],
    178180                'session_id' => $session_id,
    179                 'rag_context' => ''
     181                'rag_context' => '',
     182                'training_instructions' => ''
    180183            ];
    181184        }
     
    188191                ],
    189192                'session_id' => $session_id,
    190                 'rag_context' => isset($data['rag_context']) ? $data['rag_context'] : ''
     193                'rag_context' => isset($data['rag_context']) ? $data['rag_context'] : '',
     194                'training_instructions' => isset($data['training_instructions']) ? $data['training_instructions'] : ''
    191195            ];
    192196        }
     
    208212                'response' => $reply,
    209213                'session_id' => $session_id,
    210                 'rag_context' => isset($data['rag_context']) ? $data['rag_context'] : ''
     214                'rag_context' => isset($data['rag_context']) ? $data['rag_context'] : '',
     215                'training_instructions' => isset($data['training_instructions']) ? $data['training_instructions'] : ''
    211216            ];
    212217        } else {
     
    217222                ],
    218223                'session_id' => $session_id,
    219                 'rag_context' => isset($data['rag_context']) ? $data['rag_context'] : ''
     224                'rag_context' => isset($data['rag_context']) ? $data['rag_context'] : '',
     225                'training_instructions' => isset($data['training_instructions']) ? $data['training_instructions'] : ''
    220226            ];
    221227        }
  • helpmate-ai-chatbot/trunk/includes/chat/class-helpmate-chat.php

    r3373236 r3405838  
    112112        $image_url = $params['image_url'];
    113113        $product_id = $params['product_id'];
     114        $debug = isset($params['debug']) ? $params['debug'] : false;
    114115
    115116        if (empty($message)) {
     
    122123        try {
    123124            // Let the AI decide if it needs RAG context through the Two-Step Tool Call system
    124             $result = $this->response_generator->generate_response($message, [], $session_id, $image_url, $product_id, $this->helpers);
     125            $result = $this->response_generator->generate_response($message, [], $session_id, $image_url, $product_id, $this->helpers, $debug);
     126
     127            // Prepare metadata
     128            $metadata = ['rag_context' => $result['rag_context']];
     129            if (!empty($debug)) {
     130                $metadata['debug'] = true;
     131            }
     132            if (isset($result['training_instructions'])) {
     133                $metadata['training_instructions'] = $result['training_instructions'];
     134            }
    125135
    126136            // Store the messages using helpers
    127             $message_ids = $this->helpers->store_messages($result['session_id'], $message, json_encode($result['response']), (object) ['usage' => (object) ['totalTokens' => 0]], ['rag_context' => $result['rag_context']]);
     137            $message_ids = $this->helpers->store_messages($result['session_id'], $message, json_encode($result['response']), (object) ['usage' => (object) ['totalTokens' => 0]], $metadata);
    128138
    129139            return new WP_REST_Response([
     
    131141                'reply' => $result['response'],
    132142                'message_ids' => $message_ids,
    133                 'session_id' => $result['session_id']
     143                'session_id' => $result['session_id'],
     144                'rag_context' => isset($result['rag_context']) ? $result['rag_context'] : '',
     145                'training_instructions' => isset($result['training_instructions']) ? $result['training_instructions'] : ''
    134146            ]);
    135147        } catch (Exception $e) {
     
    314326     * @param string $session_id The session ID.
    315327     * @param string $custom_system_message The custom system message.
     328     * @param string $image_url The image URL.
     329     * @param bool $debug Whether to enable debug mode.
    316330     * @return array The chat response.
    317331     */
    318     public function get_chat_response($prompt, $messages, $session_id, $custom_system_message = '')
    319     {
    320         return $this->response_generator->get_chat_response($prompt, $messages, $session_id, $custom_system_message);
     332    public function get_chat_response($prompt, $messages, $session_id, $custom_system_message = '', $image_url = '', $debug = false)
     333    {
     334        return $this->response_generator->get_chat_response($prompt, $messages, $session_id, $custom_system_message, $image_url, $debug);
    321335    }
    322336}
  • helpmate-ai-chatbot/trunk/includes/class-helpmate-backend-routes.php

    r3389140 r3405838  
    7575            'methods' => 'GET',
    7676            'callback' => function () {
     77                // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Using WordPress core filter
    7778                $is_installed = in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins')));
    7879                try {
  • helpmate-ai-chatbot/trunk/includes/class-helpmate-database.php

    r3379655 r3405838  
    245245                'tone' => 'friendly',
    246246                'language' => 'default',
    247                 'similarity_threshold' => 0.5,
     247                'similarity_threshold' => 0.3,
    248248            ],
    249249            'behavior' => [
Note: See TracChangeset for help on using the changeset viewer.