Changeset 3379377
- Timestamp:
- 10/16/2025 10:41:02 AM (4 months ago)
- Location:
- chatbot-ai-free-models
- Files:
-
- 109 added
- 5 edited
-
tags/1.6.7 (added)
-
tags/1.6.7/admin (added)
-
tags/1.6.7/admin/views (added)
-
tags/1.6.7/admin/views/settings-page.php (added)
-
tags/1.6.7/assets (added)
-
tags/1.6.7/assets/css (added)
-
tags/1.6.7/assets/css/chatbot-admin.css (added)
-
tags/1.6.7/assets/css/chatbot.css (added)
-
tags/1.6.7/assets/images (added)
-
tags/1.6.7/assets/images/buymeacoffee.gif (added)
-
tags/1.6.7/assets/images/icon-bot.png (added)
-
tags/1.6.7/assets/images/icon-closed.gif (added)
-
tags/1.6.7/assets/images/icon-open.png (added)
-
tags/1.6.7/assets/images/icon-user.png (added)
-
tags/1.6.7/assets/images/loading.gif (added)
-
tags/1.6.7/assets/images/loading2.gif (added)
-
tags/1.6.7/assets/images/loading3.gif (added)
-
tags/1.6.7/assets/js (added)
-
tags/1.6.7/assets/js/chatbot-admin.js (added)
-
tags/1.6.7/assets/js/chatbot.js (added)
-
tags/1.6.7/assets/js/marked.min.js (added)
-
tags/1.6.7/assets/js/purify.min.js (added)
-
tags/1.6.7/assets/sounds (added)
-
tags/1.6.7/assets/sounds/notification.mp3 (added)
-
tags/1.6.7/includes (added)
-
tags/1.6.7/includes/class-chatbot-admin.php (added)
-
tags/1.6.7/includes/class-chatbot-ajax.php (added)
-
tags/1.6.7/includes/class-chatbot-api.php (added)
-
tags/1.6.7/includes/class-chatbot-frontend.php (added)
-
tags/1.6.7/includes/class-chatbot-install.php (added)
-
tags/1.6.7/includes/class-chatbot-main.php (added)
-
tags/1.6.7/index.html (added)
-
tags/1.6.7/languages (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-de_AT.mo (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-de_AT.po (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-de_BE.mo (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-de_BE.po (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-de_CH.mo (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-de_CH.po (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-de_DE.mo (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-de_DE.po (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-es_AR.mo (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-es_AR.po (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-es_BO.mo (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-es_BO.po (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-es_CL.mo (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-es_CL.po (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-es_CO.mo (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-es_CO.po (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-es_CR.mo (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-es_CR.po (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-es_CU.mo (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-es_CU.po (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-es_DO.mo (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-es_DO.po (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-es_EC.mo (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-es_EC.po (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-es_ES.mo (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-es_ES.po (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-es_GT.mo (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-es_GT.po (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-es_HN.mo (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-es_HN.po (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-es_MX.mo (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-es_MX.po (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-es_PA.mo (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-es_PA.po (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-es_PE.mo (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-es_PE.po (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-es_PY.mo (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-es_PY.po (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-es_SV.mo (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-es_SV.po (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-es_US.mo (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-es_US.po (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-es_UY.mo (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-es_UY.po (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-es_VE.mo (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-es_VE.po (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-fr_BE.mo (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-fr_BE.po (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-fr_CA.mo (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-fr_CA.po (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-fr_CH.mo (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-fr_CH.po (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-fr_DZ.mo (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-fr_DZ.po (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-fr_FR.mo (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-fr_FR.po (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-fr_MA.mo (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-fr_MA.po (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-fr_TN.mo (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-fr_TN.po (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-it_IT.mo (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-it_IT.po (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-pt_BR.mo (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-pt_BR.po (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-pt_PT.mo (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-pt_PT.po (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-ru_RU.mo (added)
-
tags/1.6.7/languages/chatbot-ai-free-models-ru_RU.po (added)
-
tags/1.6.7/languages/chatbot-ai-free-models.pot (added)
-
tags/1.6.7/public (added)
-
tags/1.6.7/public/views (added)
-
tags/1.6.7/public/views/chatbot-display.php (added)
-
tags/1.6.7/readme.txt (added)
-
tags/1.6.7/wp-chatbot.php (added)
-
trunk/assets/css/chatbot.css (modified) (3 diffs)
-
trunk/assets/images/loading2.gif (added)
-
trunk/assets/images/loading3.gif (added)
-
trunk/assets/js/chatbot.js (modified) (8 diffs)
-
trunk/includes/class-chatbot-frontend.php (modified) (5 diffs)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/wp-chatbot.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
chatbot-ai-free-models/trunk/assets/css/chatbot.css
r3378450 r3379377 57 57 } 58 58 59 /* =================================== */ 60 /* == RESTORED FUNCTIONAL HACK == */ 61 /* =================================== */ 62 59 63 .chat-message { 60 64 margin-bottom: 10px; 61 65 display: flex; 62 align-items: flex-start; 66 align-items: flex-start; /* Allinea in alto */ 67 max-width: 100%; 63 68 } 64 69 65 70 .chat-message.user { 66 71 flex-direction: row-reverse; 67 margin-right: -10px; 68 } 69 70 .chat-message.user span { 71 background-color: var(--chatbot-user-message-bg-color, #add8e6); 72 color: var(--chatbot-user-message-text-color, #000); 73 font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; 74 font-size: 15px !important; 75 padding: 10px !important; 76 border-radius: 10px !important; 77 max-width: 90% !important; 78 word-wrap: break-word; 79 margin-right: 10px !important; 80 box-sizing: border-box !important; 81 line-height: 1.4 !important; 72 margin-right: -10px; /* L'hack per tirare a destra */ 82 73 } 83 74 84 75 .chat-message.bot { 85 76 justify-content: flex-start; 86 }87 88 .chat-message.bot span {89 background-color: var(--chatbot-bot-message-bg-color, #ffc0cb);90 color: var(--chatbot-bot-message-text-color, #000);91 font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;92 font-size: 15px !important;93 padding: 10px !important;94 border-radius: 10px !important;95 max-width: 90% !important;96 word-wrap: break-word;97 margin-right: 10px !important;98 box-sizing: border-box !important;99 line-height: 1.4 !important;100 77 } 101 78 … … 104 81 height: 40px; 105 82 border-radius: 50%; 106 margin-right: 10px; 83 flex-shrink: 0; 84 } 85 86 .chat-message .chat-bubble { 87 font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; 88 font-size: 15px; 89 padding: 10px; 90 border-radius: 10px; 91 max-width: 90%; 92 word-wrap: break-word; 93 box-sizing: border-box; 94 line-height: 1.4; 95 } 96 97 .chat-message.user .chat-bubble { 98 background-color: var(--chatbot-user-message-bg-color, #add8e6); 99 color: var(--chatbot-user-message-text-color, #000); 100 margin-right: 10px; /* L'hack per creare lo spazio */ 101 } 102 103 .chat-message.bot .chat-bubble { 104 background-color: var(--chatbot-bot-message-bg-color, #ffc0cb); 105 color: var(--chatbot-bot-message-text-color, #000); 106 margin-left: 10px; 107 } 108 109 #chatbox .chat-message .chat-bubble p { 110 margin: 0; 111 padding: 0; 112 font-size: inherit; 113 line-height: inherit; 107 114 } 108 115 … … 405 412 height: 600px !important; 406 413 width: 100% !important; 407 max-width: 800px!important;408 margin: 0 auto 40px auto!important;414 max-width: 100% !important; 415 margin: 40px 0 !important; 409 416 border: 1px solid #e0e0e0 !important; 410 417 overflow: hidden !important; -
chatbot-ai-free-models/trunk/assets/js/chatbot.js
r3378450 r3379377 16 16 var isAnimating = false; 17 17 18 // --- CHIAVI UNIVOCHE PER SESSIONSTORAGE --- 19 const historyKey = chatbot_params.site_id + '_chatbotHistory'; 20 const convIdKey = chatbot_params.site_id + '_chatbotConvId'; 21 18 22 // --- Funzioni di Gestione della Cronologia (sessionStorage) --- 19 23 function saveHistoryToSessionStorage() { 20 24 try { 21 sessionStorage.setItem( 'newcodebyteChatbotHistory', JSON.stringify(conversationHistory));25 sessionStorage.setItem(historyKey, JSON.stringify(conversationHistory)); 22 26 } catch (e) { 23 27 console.warn('Chatbot: Could not save history to sessionStorage.'); … … 27 31 function loadHistoryFromSessionStorage() { 28 32 try { 29 const storedHistory = sessionStorage.getItem( 'newcodebyteChatbotHistory');33 const storedHistory = sessionStorage.getItem(historyKey); 30 34 if (storedHistory) { 31 35 conversationHistory = JSON.parse(storedHistory); … … 52 56 if (currentConversationId) return currentConversationId; 53 57 try { 54 currentConversationId = sessionStorage.getItem( 'newcodebyteChatbotConversationId');58 currentConversationId = sessionStorage.getItem(convIdKey); 55 59 } catch (e) { 56 console.warn('Chatbot: sessionStorage not accessible.');60 console.warn('Chatbot: Could not read conversation ID from sessionStorage.'); 57 61 } 58 62 return currentConversationId; … … 114 118 currentConversationId = response.data.conversation_id; 115 119 try { 116 sessionStorage.setItem( 'newcodebyteChatbotConversationId', currentConversationId);120 sessionStorage.setItem(convIdKey, currentConversationId); 117 121 } catch (e) {} 118 122 } … … 132 136 133 137 // --- Funzioni di Visualizzazione (Rendering) --- 134 function appendChatMessage(type, avatar, messageContent) {138 function appendChatMessage(type, avatar, messageContent) { 135 139 var avatarImg = $('<img>').attr('src', avatar).attr('alt', type); 136 var message Span = $('<span>');137 140 var messageBubble = $('<div>').addClass('chat-bubble'); 141 138 142 if (type === 'user') { 139 message Span.text(messageContent);143 messageBubble.text(messageContent); 140 144 } else { 141 145 if (typeof marked !== 'undefined' && typeof DOMPurify !== 'undefined') { 142 messageSpan.html(DOMPurify.sanitize(marked.parse(messageContent))); 146 // Inserisci l'HTML generato da marked.js direttamente nel div 147 messageBubble.html(DOMPurify.sanitize(marked.parse(messageContent))); 143 148 } else { 144 message Span.text(messageContent);145 } 146 } 147 148 var newMessage = $('<div>').addClass('chat-message ' + type).append(avatarImg).append(message Span);149 messageBubble.text(messageContent); 150 } 151 } 152 153 var newMessage = $('<div>').addClass('chat-message ' + type).append(avatarImg).append(messageBubble); 149 154 chatboxContent.append(newMessage); 150 155 chatboxContent.stop().animate({ scrollTop: chatboxContent[0].scrollHeight }, 200); … … 169 174 } 170 175 171 // --- LOGICA DI APERTURA/CHIUSURA CORRETTA ---172 176 function toggleChatbox() { 173 177 if (isAnimating) return; … … 190 194 chatboxButtonImg.attr('src', newIcon); 191 195 192 if (!isChatboxOpen) { // Azioni da fare quando si sta per APRIRE196 if (!isChatboxOpen) { 193 197 playNotificationSound(); 194 198 if (conversationHistory.length === 0) { … … 228 232 229 233 if ($('.chatbot-shortcode-wrapper').length === 0 && chatbot_params.enable_proactive === '1' && proactiveBubble.length > 0) { 230 // Logica per il messaggio proattivo234 // (Logica per il messaggio proattivo) 231 235 } 232 236 -
chatbot-ai-free-models/trunk/includes/class-chatbot-frontend.php
r3378450 r3379377 18 18 */ 19 19 public function add_hooks() { 20 add_action('init', [$this, 'load_widget_conditionally']); 20 // Carica SEMPRE gli script e gli stili su ogni pagina del frontend. 21 // Questo è il metodo "primitivo" ma a prova di cache. 22 add_action('wp_enqueue_scripts', [$this, 'enqueue_assets']); 23 24 // Aggiunge l'HTML del widget al footer solo se la modalità è "widget". 25 add_action('wp_footer', [$this, 'render_widget_html']); 26 27 // Registra lo shortcode. 21 28 add_shortcode('newcodebyte_chatbot', [$this, 'render_shortcode']); 22 29 } 23 30 24 31 /** 25 * Conditionally load the widget based on the display mode setting. 32 * Enqueue scripts and styles for the public-facing side of the site. 33 * Questa funzione ora viene eseguita sempre. 26 34 * 27 35 * @since 1.6.5 28 36 */ 29 public function load_widget_conditionally() { 30 $display_mode = get_option('newcodebyte_chatbot_display_mode', 'widget'); 31 if ($display_mode === 'widget' && !is_admin()) { 32 add_action('wp_enqueue_scripts', [$this, 'enqueue_scripts']); 33 add_action('wp_footer', [$this, 'render_chatbox_widget']); 37 public function enqueue_assets() { 38 // Non caricare nulla nel backend. 39 if (is_admin()) { 40 return; 34 41 } 35 }36 42 37 /**38 * Enqueue scripts and styles for the public-facing side of the site.39 *40 * @since 1.6.541 */42 public function enqueue_scripts() {43 43 wp_enqueue_script('chatbot-js', NCB_CHATBOT_PLUGIN_URL . 'assets/js/chatbot.js', ['jquery'], NCB_CHATBOT_VERSION, true); 44 44 wp_enqueue_style('chatbot-style', NCB_CHATBOT_PLUGIN_URL . 'assets/css/chatbot.css', [], NCB_CHATBOT_VERSION); … … 88 88 'enable_proactive' => get_option('newcodebyte_chatbot_enable_proactive_message', '0'), 89 89 'proactive_text' => get_option('newcodebyte_chatbot_proactive_message_text', __("Have a question?\nAsk me!", NCB_CHATBOT_TEXT_DOMAIN)), 90 'proactive_delay' => get_option('newcodebyte_chatbot_proactive_message_delay', '5') 90 'proactive_delay' => get_option('newcodebyte_chatbot_proactive_message_delay', '5'), 91 'site_id' => 'ncb_' . md5(get_home_url()) 91 92 ]); 92 93 … … 98 99 99 100 /** 100 * Render the chatbox widget view.101 * Render the chatbox widget HTML in the footer, only if in widget mode. 101 102 * 102 103 * @since 1.6.5 103 104 */ 104 public function render_chatbox_widget() { 105 $is_widget = true; 106 require_once NCB_CHATBOT_PLUGIN_DIR . 'public/views/chatbot-display.php'; 105 public function render_widget_html() { 106 $display_mode = get_option('newcodebyte_chatbot_display_mode', 'widget'); 107 if ($display_mode === 'widget') { 108 $is_widget = true; 109 require_once NCB_CHATBOT_PLUGIN_DIR . 'public/views/chatbot-display.php'; 110 } 107 111 } 108 112 … … 120 124 } 121 125 122 $this->enqueue_scripts();126 // Gli script sono già caricati globalmente, non serve chiamare enqueue qui. 123 127 124 128 ob_start(); … … 143 147 }); 144 148 </script>"; 149 145 150 return $output; 146 151 } -
chatbot-ai-free-models/trunk/readme.txt
r3378450 r3379377 4 4 Requires PHP: 7.4 5 5 Tested up to: 6.8.3 6 Stable tag: 1.6. 66 Stable tag: 1.6.7 7 7 Tags: ai chatbot, chatbot, live chat, virtual assistant, customer support 8 8 License: GPLv2 or later -
chatbot-ai-free-models/trunk/wp-chatbot.php
r3378450 r3379377 3 3 Plugin Name: Chatbot AI Free Models 4 4 Description: Easily integrate advanced AI chatbots into your WordPress site with a single API key. Use free models like Llama, DeepSeek, Mixtral, and others, or access premium models like ChatGPT and Claude for more power. Simple management, unlimited messages, and all conversations saved for easy review. 5 Version: 1.6. 65 Version: 1.6.7 6 6 Author: NewCodeByte 7 7 Author URI: https://newcodebyte.altervista.org … … 22 22 * Define plugin constants 23 23 */ 24 define('NCB_CHATBOT_VERSION', '1.6. 6');24 define('NCB_CHATBOT_VERSION', '1.6.7'); 25 25 define('NCB_CHATBOT_PLUGIN_FILE', __FILE__); 26 26 define('NCB_CHATBOT_PLUGIN_DIR', plugin_dir_path(__FILE__));
Note: See TracChangeset
for help on using the changeset viewer.