Plugin Directory

Changeset 3464145


Ignore:
Timestamp:
02/18/2026 09:56:39 AM (6 weeks ago)
Author:
wpiko
Message:

1.1.2

  • Improve: Sound notifications
  • Improve: Added sound preloading for faster playback response
Location:
wpiko-chatbot
Files:
75 added
2 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • wpiko-chatbot/trunk/admin/sections/ai-configuration-section.php

    r3454700 r3464145  
    266266                                                        ?></textarea>
    267267                                                    <p class="description">Edit knowledge-related system instructions for
    268                                                         your assistant only if necessary. These instructions help the AI
     268                                                        your assistant. These instructions help the AI
    269269                                                        understand how to use uploaded files and knowledge base.</p>
    270270                                                </td>
  • wpiko-chatbot/trunk/includes/sound-functions.php

    r3324106 r3464145  
    1111        wp_enqueue_script('wpiko-chatbot-sound', WPIKO_CHATBOT_PLUGIN_URL . 'js/chatbot-sound.js', array('howler'), '1.0', true);
    1212       
    13         $sound_url = WPIKO_CHATBOT_PLUGIN_URL . 'sounds/message-notification.wav';
    14         $error_sound_url = WPIKO_CHATBOT_PLUGIN_URL . 'sounds/error-notification.wav';
     13        $sound_url = WPIKO_CHATBOT_PLUGIN_URL . 'sounds/message-notification.mp3';
     14        $error_sound_url = WPIKO_CHATBOT_PLUGIN_URL . 'sounds/error-notification.mp3';
     15        $clear_chat_sound_url = WPIKO_CHATBOT_PLUGIN_URL . 'sounds/clear-chat-notification.mp3';
    1516        wp_localize_script('wpiko-chatbot-sound', 'wpikoChatbotSound', array(
    1617            'messageReceivedSound' => $sound_url,
    1718            'errorSound' => $error_sound_url,
     19            'clearChatSound' => $clear_chat_sound_url,
    1820        ));
    1921    }
  • wpiko-chatbot/trunk/js/chatbot-sound.js

    r3324106 r3464145  
    1 document.addEventListener('DOMContentLoaded', function() {
     1document.addEventListener('DOMContentLoaded', function () {
     2    /**
     3     * Calibrated volume levels for consistent perceived loudness
     4     *
     5     * These values are tuned to balance the different audio files:
     6     * - Message notification: Base reference volume (0.5)
     7     * - Error notification: Reduced to match message notification level (0.35)
     8     * - Clear chat notification: Reduced significantly as this file is inherently louder (0.25)
     9     *
     10     * Adjust these values if sounds still seem inconsistent on different devices.
     11     */
     12    const VOLUME_LEVELS = {
     13        message: 0.8,      // Base reference - gentle notification chime
     14        error: 0.6,       // Error alert - calibrated to match message volume
     15        clearChat: 0.9    // Clear chat confirmation - calibrated to match message volume
     16    };
     17
     18    // Initialize all sound instances with calibrated volumes
    219    const messageReceivedSound = new Howl({
    320        src: [wpikoChatbotSound.messageReceivedSound],
    4         volume: 0.5
     21        volume: VOLUME_LEVELS.message,
     22        preload: true
    523    });
    624
    725    const errorSound = new Howl({
    826        src: [wpikoChatbotSound.errorSound],
    9         volume: 0.5
     27        volume: VOLUME_LEVELS.error,
     28        preload: true
    1029    });
    1130
    12     document.addEventListener('wpiko-chatbot-message-received', function(event) {
     31    const clearChatSound = new Howl({
     32        src: [wpikoChatbotSound.clearChatSound],
     33        volume: VOLUME_LEVELS.clearChat,
     34        preload: true
     35    });
     36
     37    // Event listeners for sound triggers
     38    document.addEventListener('wpiko-chatbot-message-received', function (event) {
    1339        if (event.detail.isSoundEnabled) {
    1440            messageReceivedSound.play();
     
    1642    });
    1743
    18     document.addEventListener('wpiko-chatbot-error', function(event) {
     44    document.addEventListener('wpiko-chatbot-error', function (event) {
    1945        if (event.detail.isSoundEnabled) {
    2046            errorSound.play();
    2147        }
    2248    });
     49
     50    document.addEventListener('wpiko-chatbot-clear', function (event) {
     51        if (event.detail.isSoundEnabled) {
     52            clearChatSound.play();
     53        }
     54    });
    2355});
  • wpiko-chatbot/trunk/js/wpiko-chatbot.js

    r3454700 r3464145  
    223223    // Function to clears the chat
    224224    function clearChat() {
     225        // Trigger sound immediately when clear chat is confirmed
     226        if (isSoundEnabled) {
     227            const clearChatEvent = new CustomEvent('wpiko-chatbot-clear', {
     228                detail: { isSoundEnabled: true }
     229            });
     230            document.dispatchEvent(clearChatEvent);
     231        }
     232
    225233        messagesContainer.innerHTML = '';
    226234        sessionStorage.removeItem('wpiko_chatbot_messages');
     
    235243        const welcomeMessage = getWelcomeMessage();
    236244        if (welcomeMessage) {
    237             appendMessage('bot', welcomeMessage, 'general_error', true);
     245            appendMessage('bot', welcomeMessage, 'general_error', true, true);
    238246        }
    239247
     
    241249        showPreMadeQuestions();
    242250    }
     251
    243252
    244253    // Clear chat button
     
    574583
    575584    // Append Message
    576     function appendMessage(type, content, errorType = 'general_error', skipStoring = false) {
     585    function appendMessage(type, content, errorType = 'general_error', skipStoring = false, suppressSound = false) {
    577586        if (content === null || content === '') return;
    578587        const messageElement = document.createElement('div');
     
    590599
    591600            // Sound functionality (bot response)
    592             if (isSoundEnabled) {
     601            if (isSoundEnabled && !suppressSound) {
    593602                const messageReceivedEvent = new CustomEvent('wpiko-chatbot-message-received', {
    594603                    detail: { isSoundEnabled: true }
  • wpiko-chatbot/trunk/readme.txt

    r3454700 r3464145  
    44Requires at least: 6.0
    55Tested up to: 6.9
    6 Stable tag: 1.1.1
     6Stable tag: 1.1.2
    77Requires PHP: 7.0
    88License: GPL-2.0+
     
    123123== Changelog ==
    124124
     125= 1.1.2 =
     126* Improve: Sound notifications
     127* Improve: Added sound preloading for faster playback response
     128
    125129= 1.1.1 =
    126130* Feature: Add Reasoning Effort and Verbosity controls for GPT-5 models
     
    193197== Upgrade Notice ==
    194198
     199= 1.1.2 =
     200Improved sound notification system with consistent volume levels and immediate playback response.
     201
    195202= 1.1.1 =
    196203Adds Reasoning Effort/Verbosity controls, customizable Error Messages system, and new Debug Log page for easier troubleshooting.
  • wpiko-chatbot/trunk/wpiko-chatbot.php

    r3454700 r3464145  
    44 * Plugin URI: https://wpiko.com/chatbot
    55 * Description: A WordPress plugin that integrates OpenAI's AI models to create an intelligent chatbot for WordPress websites.
    6  * Version: 1.1.1
     6 * Version: 1.1.2
    77 * Author: WPiko
    88 * Author URI: https://wpiko.com
     
    2020define('WPIKO_CHATBOT_PLUGIN_DIR', plugin_dir_path(__FILE__));
    2121define('WPIKO_CHATBOT_PLUGIN_URL', plugin_dir_url(__FILE__));
    22 define('WPIKO_CHATBOT_VERSION', '1.1.1');
     22define('WPIKO_CHATBOT_VERSION', '1.1.2');
    2323
    2424// Ensures that the default options is set
Note: See TracChangeset for help on using the changeset viewer.