| @@ -410,10 +410,10 @@ | ||
| 410 | 410 | <?php endif; ?> |
| 411 | 411 | |
| 412 | 412 | <div class="mxchat-agents-banner"> |
| 413 | 413 | <p> |
| 414 | - <strong><?php echo esc_html__('The MxChat Add-Ons Platform', 'mxchat'); ?></strong><?php echo esc_html__(' is here! Pro users get unlimited access to our growing collection of powerful add-ons. ', 'mxchat'); ?><a href="<?php echo admin_url('admin.php?page=mxchat-addons'); ?>"><?php echo esc_html__('Explore all add-ons', 'mxchat'); ?></a><?php echo esc_html__(' including Forms Builder, Theme Customizer, Content Moderation, and more – all included with your lifetime Pro license!', 'mxchat'); ?> | |
| 415 | - </p> | |
| 414 | + <?php echo esc_html__('Pro users get exclusive access to', 'mxchat'); ?> <a href="https://mxchat.ai/agents/" target="_blank"><?php echo esc_html__('MxChat AI Agents', 'mxchat'); ?></a> <?php echo esc_html__('– our groundbreaking platform to test, refine, and deploy your chatbot with confidence. Take your AI assistant to the next level!', 'mxchat'); ?> | |
| 415 | + </p> | |
| 416 | 416 | </div> |
| 417 | 417 | |
| 418 | 418 | <h2 class="mxchat-nav-tab-wrapper"> |
| 419 | 419 | <a href="#chatbot" class="mxchat-nav-tab mxchat-nav-tab-active" data-tab="chatbot"><?php echo esc_html__('Chatbot', 'mxchat'); ?></a> |
| @@ -2663,123 +2663,83 @@ | ||
| 2663 | 2663 | <th><?php esc_html_e('Similarity Threshold', 'mxchat'); ?></th> |
| 2664 | 2664 | <th><?php esc_html_e('Actions', 'mxchat'); ?></th> |
| 2665 | 2665 | </tr> |
| 2666 | 2666 | </thead> |
| 2667 | - <tbody> | |
| 2668 | - <?php if ($intents) : | |
| 2669 | - foreach ($intents as $intent) : | |
| 2670 | - $callback_function = $intent->callback_function; | |
| 2671 | - $callback_label = isset($available_callbacks[$callback_function]['label']) | |
| 2672 | - ? $available_callbacks[$callback_function]['label'] | |
| 2673 | - : $callback_function; | |
| 2674 | - $threshold_value = isset($intent->similarity_threshold) | |
| 2675 | - ? round($intent->similarity_threshold * 100) | |
| 2676 | - : 85; | |
| 2677 | - | |
| 2678 | - // Check if this is a form intent (its intent_label starts with "Form ") | |
| 2679 | - $is_form_intent = strpos($intent->intent_label, 'Form ') === 0; | |
| 2680 | - ?> | |
| 2681 | - <tr<?php echo $is_form_intent ? ' class="mxchat-form-intent"' : ''; ?>> | |
| 2682 | - <td> | |
| 2683 | - <?php | |
| 2684 | - if ($is_form_intent) { | |
| 2685 | - // Attempt to extract the form ID from the intent_label. | |
| 2686 | - preg_match('/Form (\d+)/', $intent->intent_label, $matches); | |
| 2687 | - $form_id = isset($matches[1]) ? intval($matches[1]) : 0; | |
| 2688 | - if ($form_id) { | |
| 2689 | - global $wpdb; | |
| 2690 | - $forms_table = $wpdb->prefix . 'mxchat_forms'; | |
| 2691 | - $form = $wpdb->get_row($wpdb->prepare("SELECT title FROM $forms_table WHERE id = %d", $form_id)); | |
| 2692 | - if ($form && !empty($form->title)) { | |
| 2693 | - echo esc_html($form->title); | |
| 2694 | - } else { | |
| 2695 | - echo esc_html($intent->intent_label); | |
| 2696 | - } | |
| 2697 | - } else { | |
| 2698 | - echo esc_html($intent->intent_label); | |
| 2699 | - } | |
| 2700 | - echo ' <span class="mxchat-badge">Form Intent</span>'; | |
| 2701 | - } else { | |
| 2702 | - echo esc_html($intent->intent_label); | |
| 2703 | - } | |
| 2704 | - ?> | |
| 2705 | - </td> | |
| 2706 | - <td class="mxchat-content-cell"> | |
| 2707 | - <?php echo esc_html($intent->phrases); ?> | |
| 2708 | - </td> | |
| 2709 | - <td><?php echo esc_html($callback_label); ?></td> | |
| 2710 | - <td> | |
| 2711 | - <!-- Similarity threshold adjustment (shown for all intents) --> | |
| 2712 | - <form method="post" | |
| 2713 | - action="<?php echo esc_url(admin_url('admin-post.php')); ?>" | |
| 2714 | - class="mxchat-threshold-form"> | |
| 2715 | - <?php wp_nonce_field('mxchat_update_intent_threshold_nonce'); ?> | |
| 2716 | - <input type="hidden" name="action" | |
| 2717 | - value="mxchat_update_intent_threshold"> | |
| 2718 | - <input type="hidden" name="intent_id" | |
| 2719 | - value="<?php echo esc_attr($intent->id); ?>"> | |
| 2720 | - <div class="mxchat-slider-group"> | |
| 2721 | - <input type="range" | |
| 2722 | - name="intent_threshold" | |
| 2723 | - id="intent_threshold_<?php echo esc_attr($intent->id); ?>" | |
| 2724 | - min="70" | |
| 2725 | - max="95" | |
| 2726 | - value="<?php echo esc_attr($threshold_value); ?>" | |
| 2727 | - class="mxchat-intent-slider" | |
| 2728 | - oninput="document.getElementById('threshold_output_<?php echo esc_attr($intent->id); ?>').value = this.value + '%'"> | |
| 2729 | - <output id="threshold_output_<?php echo esc_attr($intent->id); ?>" | |
| 2730 | - class="mxchat-intent-output"> | |
| 2731 | - <?php echo esc_html($threshold_value); ?>% | |
| 2732 | - </output> | |
| 2733 | - </div> | |
| 2734 | - <button type="submit" class="mxchat-button-icon"> | |
| 2735 | - <span class="dashicons dashicons-saved"></span> | |
| 2736 | - </button> | |
| 2737 | - </form> | |
| 2738 | - </td> | |
| 2739 | - <td class="mxchat-actions-cell"> | |
| 2740 | - <?php if (!$is_form_intent) : ?> | |
| 2741 | - <!-- Standard intents: allow edit and delete --> | |
| 2742 | - <button type="button" | |
| 2743 | - class="mxchat-button-icon mxchat-edit-button" | |
| 2744 | - data-intent-id="<?php echo esc_attr($intent->id); ?>" | |
| 2745 | - data-phrases="<?php echo esc_attr($intent->phrases); ?>"> | |
| 2746 | - <span class="dashicons dashicons-edit"></span> | |
| 2747 | - </button> | |
| 2748 | - <form method="post" | |
| 2749 | - action="<?php echo esc_url(admin_url('admin-post.php')); ?>" | |
| 2750 | - class="mxchat-delete-form" | |
| 2751 | - onsubmit="return confirm('<?php esc_attr_e('Are you sure you want to delete this intent?', 'mxchat'); ?>');"> | |
| 2752 | - <?php wp_nonce_field('mxchat_delete_intent_nonce'); ?> | |
| 2753 | - <input type="hidden" name="action" value="mxchat_delete_intent"> | |
| 2754 | - <input type="hidden" name="intent_id" | |
| 2755 | - value="<?php echo esc_attr($intent->id); ?>"> | |
| 2756 | - <button type="submit" class="mxchat-button-icon"> | |
| 2757 | - <span class="dashicons dashicons-trash"></span> | |
| 2758 | - </button> | |
| 2759 | - </form> | |
| 2760 | - <?php else : ?> | |
| 2761 | - <!-- Form intents: show manage in forms button --> | |
| 2762 | - <?php | |
| 2763 | - preg_match('/Form (\d+)/', $intent->intent_label, $matches); | |
| 2764 | - $form_id = isset($matches[1]) ? $matches[1] : ''; | |
| 2765 | - ?> | |
| 2766 | - <a href="<?php echo esc_url(admin_url('admin.php?page=mxchat-forms&action=edit&form_id=' . $form_id)); ?>" | |
| 2767 | - class="mxchat-button-secondary"> | |
| 2768 | - <?php esc_html_e('Manage in Forms', 'mxchat'); ?> | |
| 2769 | - </a> | |
| 2770 | - <?php endif; ?> | |
| 2771 | - </td> | |
| 2772 | - </tr> | |
| 2773 | - <?php endforeach; | |
| 2774 | - else : ?> | |
| 2667 | + <tbody> | |
| 2668 | + <?php if ($intents) : | |
| 2669 | + foreach ($intents as $intent) : | |
| 2670 | + $callback_function = $intent->callback_function; | |
| 2671 | + $callback_label = isset($available_callbacks[$callback_function]['label']) | |
| 2672 | + ? $available_callbacks[$callback_function]['label'] | |
| 2673 | + : $callback_function; | |
| 2674 | + $threshold_value = isset($intent->similarity_threshold) | |
| 2675 | + ? round($intent->similarity_threshold * 100) | |
| 2676 | + : 85; | |
| 2677 | + ?> | |
| 2775 | 2678 | <tr> |
| 2776 | - <td colspan="5" class="mxchat-no-records"> | |
| 2777 | - <?php esc_html_e('No intents found.', 'mxchat'); ?> | |
| 2679 | + <td><?php echo esc_html($intent->intent_label); ?></td> | |
| 2680 | + <td class="mxchat-content-cell"> | |
| 2681 | + <?php echo esc_html($intent->phrases); ?> | |
| 2778 | 2682 | </td> |
| 2683 | + <td><?php echo esc_html($callback_label); ?></td> | |
| 2684 | + <td> | |
| 2685 | + <form method="post" | |
| 2686 | + action="<?php echo esc_url(admin_url('admin-post.php')); ?>" | |
| 2687 | + class="mxchat-threshold-form"> | |
| 2688 | + <?php wp_nonce_field('mxchat_update_intent_threshold_nonce'); ?> | |
| 2689 | + <input type="hidden" name="action" | |
| 2690 | + value="mxchat_update_intent_threshold"> | |
| 2691 | + <input type="hidden" name="intent_id" | |
| 2692 | + value="<?php echo esc_attr($intent->id); ?>"> | |
| 2693 | + <div class="mxchat-slider-group"> | |
| 2694 | + <input type="range" | |
| 2695 | + name="intent_threshold" | |
| 2696 | + id="intent_threshold_<?php echo esc_attr($intent->id); ?>" | |
| 2697 | + min="70" | |
| 2698 | + max="95" | |
| 2699 | + value="<?php echo esc_attr($threshold_value); ?>" | |
| 2700 | + class="mxchat-intent-slider" | |
| 2701 | + oninput="document.getElementById('threshold_output_<?php echo esc_attr($intent->id); ?>').value = this.value + '%'"> | |
| 2702 | + <output id="threshold_output_<?php echo esc_attr($intent->id); ?>" | |
| 2703 | + class="mxchat-intent-output"> | |
| 2704 | + <?php echo esc_html($threshold_value); ?>% | |
| 2705 | + </output> | |
| 2706 | + </div> | |
| 2707 | + <button type="submit" class="mxchat-button-icon"> | |
| 2708 | + <span class="dashicons dashicons-saved"></span> | |
| 2709 | + </button> | |
| 2710 | + </form> | |
| 2711 | + </td> | |
| 2712 | + <td class="mxchat-actions-cell"> | |
| 2713 | + <button type="button" | |
| 2714 | + class="mxchat-button-icon mxchat-edit-button" | |
| 2715 | + data-intent-id="<?php echo esc_attr($intent->id); ?>" | |
| 2716 | + data-phrases="<?php echo esc_attr($intent->phrases); ?>"> | |
| 2717 | + <span class="dashicons dashicons-edit"></span> | |
| 2718 | + </button> | |
| 2719 | + <form method="post" | |
| 2720 | + action="<?php echo esc_url(admin_url('admin-post.php')); ?>" | |
| 2721 | + class="mxchat-delete-form" | |
| 2722 | + onsubmit="return confirm('<?php esc_attr_e('Are you sure you want to delete this intent?', 'mxchat'); ?>');"> | |
| 2723 | + <?php wp_nonce_field('mxchat_delete_intent_nonce'); ?> | |
| 2724 | + <input type="hidden" name="action" value="mxchat_delete_intent"> | |
| 2725 | + <input type="hidden" name="intent_id" | |
| 2726 | + value="<?php echo esc_attr($intent->id); ?>"> | |
| 2727 | + <button type="submit" class="mxchat-button-icon"> | |
| 2728 | + <span class="dashicons dashicons-trash"></span> | |
| 2729 | + </button> | |
| 2730 | + </form> | |
| 2731 | + </td> | |
| 2779 | 2732 | </tr> |
| 2780 | - <?php endif; ?> | |
| 2781 | - </tbody> | |
| 2733 | + <?php endforeach; | |
| 2734 | + else : ?> | |
| 2735 | + <tr> | |
| 2736 | + <td colspan="5" class="mxchat-no-records"> | |
| 2737 | + <?php esc_html_e('No intents found.', 'mxchat'); ?> | |
| 2738 | + </td> | |
| 2739 | + </tr> | |
| 2740 | + <?php endif; ?> | |
| 2741 | + </tbody> | |
| 2782 | 2742 | </table> |
| 2783 | 2743 | </div> |
| 2784 | 2744 | |
| 2785 | 2745 | <?php if ($total_pages > 1) : ?> |
| @@ -3975,15 +3935,15 @@ | ||
| 3975 | 3935 | echo '</div>'; |
| 3976 | 3936 | } |
| 3977 | 3937 | public function claude_api_key_callback() { |
| 3978 | 3938 | // Check if the feature is activated (paid feature) |
| 3979 | - $disabled = $this->is_activated ? '' : 'disabled'; | |
| 3980 | - $class = $this->is_activated ? 'pro-feature-wrapper active' : 'pro-feature-wrapper inactive'; | |
| 3981 | - | |
| 3982 | - // Retrieve the Claude API key value directly like the others | |
| 3939 | + $disabled = $this->is_activated ? '' : 'disabled'; // Disable input if not activated | |
| 3940 | + $class = $this->is_activated ? 'pro-feature-wrapper active' : 'pro-feature-wrapper inactive'; // CSS class to style the wrapper based on activation status | |
| 3941 | + | |
| 3942 | + // Retrieve the Claude API key value | |
| 3983 | 3943 | $claudeApiKey = isset($this->options['claude_api_key']) ? esc_attr($this->options['claude_api_key']) : ''; |
| 3984 | - | |
| 3985 | - // Use direct name field like the other working API keys | |
| 3944 | + | |
| 3945 | + // Render the input field for the Claude API key | |
| 3986 | 3946 | echo '<div class="' . esc_attr($class) . '">'; |
| 3987 | 3947 | printf( |
| 3988 | 3948 | '<input type="password" id="claude_api_key" name="claude_api_key" value="%s" class="regular-text" %s />', |
| 3989 | 3949 | $claudeApiKey, |
| @@ -3989,14 +3949,16 @@ | ||
| 3989 | 3949 | $claudeApiKey, |
| 3990 | 3950 | $disabled |
| 3991 | 3951 | ); |
| 3992 | 3952 | echo '<button type="button" id="toggleClaudeApiKeyVisibility">' . esc_html__('Show', 'mxchat') . '</button>'; |
| 3993 | - | |
| 3953 | + | |
| 3954 | + // If the feature is not activated, show the overlay with a "Pro Only" message | |
| 3994 | 3955 | if (!$this->is_activated) { |
| 3995 | 3956 | echo '<div class="pro-feature-overlay">'; |
| 3996 | 3957 | echo '<a href="https://mxchat.ai/" target="_blank"><img src="' . plugin_dir_url(__FILE__) . '../images/pro-only-dark.png" alt="' . esc_attr__('Pro Only', 'mxchat') . '" /></a>'; |
| 3997 | 3958 | echo '</div>'; |
| 3998 | 3959 | } |
| 3960 | + | |
| 3999 | 3961 | echo '</div>'; |
| 4000 | 3962 | } |
| 4001 | 3963 | public function deepseek_api_key_callback() { |
| 4002 | 3964 | // Retrieve from your stored 'deepseek_api_key' in the mxchat_options array |
| @@ -5440,9 +5402,9 @@ | ||
| 5440 | 5402 | public function mxchat_enqueue_admin_assets() { |
| 5441 | 5403 | wp_enqueue_style('wp-color-picker'); |
| 5442 | 5404 | |
| 5443 | 5405 | // Get the plugin version or file modification time for cache busting |
| 5444 | - $plugin_version = '2.0.3'; // Replace this with your plugin's version | |
| 5406 | + $plugin_version = '2.0.2'; // Replace this with your plugin's version | |
| 5445 | 5407 | |
| 5446 | 5408 | // File paths |
| 5447 | 5409 | $color_picker_js_path = plugin_dir_path(__FILE__) . '../js/my-color-picker.js'; |
| 5448 | 5410 | $embedding_check_js_path = plugin_dir_path(__FILE__) . '../js/embedding-check.js'; |