| @@ -29,19 +29,14 @@ | ||
| 29 | 29 | 'chat_input_font_color' => '#212121', |
| 30 | 30 | 'mode_indicator_bg_color' => '#212121', |
| 31 | 31 | 'mode_indicator_font_color' => '#fff', |
| 32 | 32 | 'api_key' => '', |
| 33 | - 'system_prompt_instructions' => __( | |
| 34 | - '[EXAMPLE INSTRUCTIONS] You are an AI Chatbot assistant for this website. The primary subject you should focus on is [insert proper subject here]. Your main goal is to assist visitors with questions related to this specific topic. Here are some key things to keep in mind: | |
| 35 | - - Your name is [Chatbot Name]. Always introduce yourself as this name when appropriate. | |
| 36 | - - Stay focused on topics related to [insert proper subject here]. If a visitor asks about an unrelated topic, politely redirect the conversation to how you can assist them with this subject. If there is an exception topic (e.g., "parking") that you should assist with, you may do so if instructed. | |
| 37 | - - When appropriate, highlight the benefits of [insert proper subject here]. Offer to guide visitors to relevant pages or provide them with more information. | |
| 38 | - - If a visitor asks for a purchase link or further information, provide them with this link: [Insert Purchase Link Here]. Always ensure that the link is relevant and directly related to the website\'s offerings. | |
| 39 | - - Keep your responses short, concise, and to the point. Provide clear and direct answers suitable for a chatbot interaction. | |
| 40 | - - If you reference specific content, provide a hyperlink to the relevant page using hypertext. Avoid including links that do not directly relate to the content or answer the visitor\'s query. | |
| 41 | - - Provide answers based on the knowledge available to you. If you do not have an answer to a specific question, let the visitor know that you don’t have the information and suggest where they might find it or offer to help with something else.', | |
| 42 | - 'mxchat' | |
| 43 | - ), | |
| 33 | + 'system_prompt_instructions' => esc_html__('[EXAMPLE INSTRUCTIONS] You are an AI Chatbot assistant for this website. The primary subject you should focus on is [insert proper subject here]. Your main goal is to assist visitors with questions related to this specific topic. Here are some key things to keep in mind: | |
| 34 | + - Your name is [Chatbot Name]. | |
| 35 | + - Stay focused on topics related to [insert proper subject here]. If a visitor asks about an unrelated topic, politely redirect the conversation to how you can assist them with this subject. | |
| 36 | + - Do not make up links to pages. Only use specific links you see in your knowledgebase from [insert your domain]. Do not make assumptions or make up URLs. | |
| 37 | + - Keep your responses short, concise, and to the point. Provide clear and direct answers suitable for a chatbot interaction. | |
| 38 | + - Provide answers based on the knowledge available to you. If you do not have an answer to a specific question, let the visitor know that you don’t have the information.', 'mxchat'), | |
| 44 | 39 | 'model' => 'gpt-3.5-turbo', |
| 45 | 40 | 'rate_limit' => '100', |
| 46 | 41 | 'rate_limit_message' => esc_html__('Rate limit exceeded. Please try again later.', 'mxchat'), |
| 47 | 42 | 'top_bar_title' => esc_html__('MxChat: Basic', 'mxchat'), |
| @@ -192,12 +187,12 @@ | ||
| 192 | 187 | } |
| 193 | 188 | |
| 194 | 189 | echo ' <div id="chat-container" style="' . ($enable_email_block ? 'display: none;' : '') . '">'; |
| 195 | 190 | echo ' <div id="chat-box">'; |
| 196 | - echo ' <div class="bot-message" style="background: ' | |
| 197 | - . esc_attr($bot_message_bg_color) . '; color: ' | |
| 198 | - . esc_attr($bot_message_font_color) . ';">'; | |
| 199 | - echo nl2br(esc_html($intro_message)); | |
| 191 | + echo ' <div class="bot-message" style="background: ' . esc_attr($bot_message_bg_color) . ';">'; | |
| 192 | + echo ' <div style="color: ' . esc_attr($bot_message_font_color) . ';">'; | |
| 193 | + echo nl2br(esc_html($intro_message)); | |
| 194 | + echo ' </div>'; | |
| 200 | 195 | echo ' </div>'; |
| 201 | 196 | echo ' </div>'; // end #chat-box |
| 202 | 197 | |
| 203 | 198 | // Add the popular questions section |
| @@ -233,23 +228,34 @@ | ||
| 233 | 228 | echo ' <path d="M498.1 5.6c10.1 7 15.4 19.1 13.5 31.2l-64 416c-1.5 9.7-7.4 18.2-16 23s-18.9 5.4-28 1.6L284 427.7l-68.5 74.1c-8.9 9.7-22.9 12.9-35.2 8.1S160 493.2 160 480V396.4c0-4 1.5-7.8 4.2-10.7L331.8 202.8c5.8-6.3 5.6-16-.4-22s-15.7-6.4-22-.7L106 360.8 17.7 316.6C7.1 311.3 .3 300.7 0 288.9s5.9-22.8 16.1-28.7l448-256c10.7-6.1 23.9-5.5 34 1.4z"/>'; |
| 234 | 229 | echo ' </svg>'; |
| 235 | 230 | echo ' </button>'; |
| 236 | 231 | echo ' </div>'; |
| 232 | + | |
| 237 | 233 | echo ' <div class="chat-toolbar">'; |
| 238 | - echo ' <input type="file" id="pdf-upload" accept=".pdf" style="display: none;">'; | |
| 239 | - echo ' <button id="pdf-upload-btn" class="toolbar-btn" title="' . esc_attr__('Upload PDF', 'mxchat') . '">'; | |
| 240 | - echo ' <!-- Icon from Font Awesome Free: https://fontawesome.com/license/free -->'; | |
| 241 | - echo ' <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" stroke="currentColor">'; | |
| 242 | - echo ' <path d="M64 464l48 0 0 48-48 0c-35.3 0-64-28.7-64-64L0 64C0 28.7 28.7 0 64 0L229.5 0c17 0 33.3 6.7 45.3 18.7l90.5 90.5c12 12 18.7 28.3 18.7 45.3L384 304l-48 0 0-144-80 0c-17.7 0-32-14.3-32-32l0-80L64 48c-8.8 0-16 7.2-16 16l0 384c0 8.8 7.2 16 16 16zM176 352l32 0c30.9 0 56 25.1 56 56s-25.1 56-56 56l-16 0 0 32c0 8.8-7.2 16-16 16s-16-7.2-16-16l0-48 0-80c0-8.8 7.2-16 16-16zm32 80c13.3 0 24-10.7 24-24s-10.7-24-24-24l-16 0 0 48 16 0zm96-80l32 0c26.5 0 48 21.5 48 48l0 64c0 26.5-21.5 48-48 48l-32 0c-8.8 0-16-7.2-16-16l0-128c0-8.8 7.2-16 16-16zm32 128c8.8 0 16-7.2 16-16l0-64c0-8.8-7.2-16-16-16l-16 0 0 96 16 0zm80-112c0-8.8 7.2-16 16-16l48 0c8.8 0 16 7.2 16 16s-7.2 16-16 16l-32 0 0 32 32 0c8.8 0 16 7.2 16 16s-7.2 16-16 16l-32 0 0 48c0 8.8-7.2 16-16 16s-16-7.2-16-16l0-64 0-64z"></path>'; | |
| 243 | - echo ' </svg>'; | |
| 244 | - echo ' </button>'; | |
| 245 | 234 | |
| 246 | - echo ' <input type="file" id="word-upload" accept=".docx" style="display: none;">'; | |
| 247 | - echo ' <button id="word-upload-btn" class="toolbar-btn" title="' . esc_attr__('Upload Word Document', 'mxchat') . '">'; | |
| 248 | - echo ' <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512" stroke="currentColor">'; | |
| 249 | - echo ' <path d="M48 448L48 64c0-8.8 7.2-16 16-16l160 0 0 80c0 17.7 14.3 32 32 32l80 0 0 288c0 8.8-7.2 16-16 16L64 464c-8.8 0-16-7.2-16-16zM64 0C28.7 0 0 28.7 0 64L0 448c0 35.3 28.7 64 64 64l256 0c35.3 0 64-28.7 64-64l0-293.5c0-17-6.7-33.3-18.7-45.3L274.7 18.7C262.7 6.7 246.5 0 229.5 0L64 0zm55 241.1c-3.8-12.7-17.2-19.9-29.9-16.1s-19.9 17.2-16.1 29.9l48 160c3 10.2 12.4 17.1 23 17.1s19.9-7 23-17.1l25-83.4 25 83.4c3 10.2 12.4 17.1 23 17.1s19.9-7 23-17.1l48-160c3.8-12.7-3.4-26.1-16.1-29.9s-26.1 3.4-29.9 16.1l-25 83.4-25-83.4c-3-10.2-12.4-17.1-23-17.1s-19.9 7-23 17.1l-25 83.4-25-83.4z"/></svg>'; | |
| 250 | - echo ' </button>'; | |
| 235 | + // PDF Upload Button - wrapped in conditional | |
| 236 | + $show_pdf_button = isset($this->options['show_pdf_upload_button']) ? $this->options['show_pdf_upload_button'] : 'on'; | |
| 237 | + if ($show_pdf_button === 'on') { | |
| 238 | + echo ' <input type="file" id="pdf-upload" accept=".pdf" style="display: none;">'; | |
| 239 | + echo ' <button id="pdf-upload-btn" class="toolbar-btn" title="' . esc_attr__('Upload PDF', 'mxchat') . '">'; | |
| 240 | + echo ' <!-- Icon from Font Awesome Free: https://fontawesome.com/license/free -->'; | |
| 241 | + echo ' <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" stroke="currentColor">'; | |
| 242 | + echo ' <path d="M64 464l48 0 0 48-48 0c-35.3 0-64-28.7-64-64L0 64C0 28.7 28.7 0 64 0L229.5 0c17 0 33.3 6.7 45.3 18.7l90.5 90.5c12 12 18.7 28.3 18.7 45.3L384 304l-48 0 0-144-80 0c-17.7 0-32-14.3-32-32l0-80L64 48c-8.8 0-16 7.2-16 16l0 384c0 8.8 7.2 16 16 16zM176 352l32 0c30.9 0 56 25.1 56 56s-25.1 56-56 56l-16 0 0 32c0 8.8-7.2 16-16 16s-16-7.2-16-16l0-48 0-80c0-8.8 7.2-16 16-16zm32 80c13.3 0 24-10.7 24-24s-10.7-24-24-24l-16 0 0 48 16 0zm96-80l32 0c26.5 0 48 21.5 48 48l0 64c0 26.5-21.5 48-48 48l-32 0c-8.8 0-16-7.2-16-16l0-128c0-8.8 7.2-16 16-16zm32 128c8.8 0 16-7.2 16-16l0-64c0-8.8-7.2-16-16-16l-16 0 0 96 16 0zm80-112c0-8.8 7.2-16 16-16l48 0c8.8 0 16 7.2 16 16s-7.2 16-16 16l-32 0 0 32 32 0c8.8 0 16 7.2 16 16s-7.2 16-16 16l-32 0 0 48c0 8.8-7.2 16-16 16s-16-7.2-16-16l0-64 0-64z"></path>'; | |
| 243 | + echo ' </svg>'; | |
| 244 | + echo ' </button>'; | |
| 245 | + } | |
| 246 | + | |
| 247 | + // Word Upload Button - wrapped in conditional | |
| 248 | + $show_word_button = isset($this->options['show_word_upload_button']) ? $this->options['show_word_upload_button'] : 'on'; | |
| 249 | + if ($show_word_button === 'on') { | |
| 250 | + echo ' <input type="file" id="word-upload" accept=".docx" style="display: none;">'; | |
| 251 | + echo ' <button id="word-upload-btn" class="toolbar-btn" title="' . esc_attr__('Upload Word Document', 'mxchat') . '">'; | |
| 252 | + echo ' <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512" stroke="currentColor">'; | |
| 253 | + echo ' <path d="M48 448L48 64c0-8.8 7.2-16 16-16l160 0 0 80c0 17.7 14.3 32 32 32l80 0 0 288c0 8.8-7.2 16-16 16L64 464c-8.8 0-16-7.2-16-16zM64 0C28.7 0 0 28.7 0 64L0 448c0 35.3 28.7 64 64 64l256 0c35.3 0 64-28.7 64-64l0-293.5c0-17-6.7-33.3-18.7-45.3L274.7 18.7C262.7 6.7 246.5 0 229.5 0L64 0zm55 241.1c-3.8-12.7-17.2-19.9-29.9-16.1s-19.9 17.2-16.1 29.9l48 160c3 10.2 12.4 17.1 23 17.1s19.9-7 23-17.1l25-83.4 25 83.4c3 10.2 12.4 17.1 23 17.1s19.9-7 23-17.1l48-160c3.8-12.7-3.4-26.1-16.1-29.9s-26.1 3.4-29.9 16.1l-25 83.4-25-83.4c-3-10.2-12.4-17.1-23-17.1s-19.9 7-23 17.1l-25 83.4-25-83.4z"/></svg>'; | |
| 254 | + echo ' </button>'; | |
| 255 | + } | |
| 251 | 256 | |
| 257 | + // File containers (unchanged) | |
| 252 | 258 | echo ' <div id="active-pdf-container" class="active-pdf-container" style="display: none;">'; |
| 253 | 259 | echo ' <span id="active-pdf-name" class="active-pdf-name"></span>'; |
| 254 | 260 | echo ' <button id="remove-pdf-btn" class="remove-pdf-btn" title="' . esc_attr__('Remove PDF', 'mxchat') . '">'; |
| 255 | 261 | echo ' <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="12" height="12" fill="none" stroke="currentColor" stroke-width="2">'; |
| @@ -267,9 +273,20 @@ | ||
| 267 | 273 | echo ' <line x1="6" y1="6" x2="18" y2="18"></line>'; |
| 268 | 274 | echo ' </svg>'; |
| 269 | 275 | echo ' </button>'; |
| 270 | 276 | echo ' </div>'; |
| 277 | + | |
| 278 | + // Perplexity Button (unchanged except for the conditional) | |
| 279 | + if (apply_filters('mxchat_perplexity_should_show_logo', true)) { | |
| 280 | + echo ' <button id="perplexity-search-btn" class="toolbar-btn" title="' . esc_attr__('Search with Perplexity', 'mxchat-perplexity') . '">'; | |
| 281 | + echo ' <svg fill="currentColor" height="1em" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg">'; | |
| 282 | + echo ' <path d="M19.785 0v7.272H22.5V17.62h-2.935V24l-7.037-6.194v6.145h-1.091v-6.152L4.392 24v-6.465H1.5V7.188h2.884V0l7.053 6.494V.19h1.09v6.49L19.786 0zm-7.257 9.044v7.319l5.946 5.234V14.44l-5.946-5.397zm-1.099-.08l-5.946 5.398v7.235l5.946-5.234V8.965zm8.136 7.58h1.844V8.349H13.46l6.105 5.54v2.655zm-8.982-8.28H2.59v8.195h1.8v-2.576l6.192-5.62zM5.475 2.476v4.71h5.115l-5.115-4.71zm13.219 0l-5.115 4.71h5.115v-4.71z"></path>'; | |
| 283 | + echo ' </svg>'; | |
| 284 | + echo ' </button>'; | |
| 285 | + } | |
| 286 | + | |
| 271 | 287 | echo ' </div>'; |
| 288 | + | |
| 272 | 289 | echo ' <div class="chatbot-footer">'; |
| 273 | 290 | |
| 274 | 291 | // Output the privacy notice if enabled |
| 275 | 292 | if ($privacy_toggle && !empty($privacy_text)) { |