Plugin Directory

Changeset 3381226


Ignore:
Timestamp:
10/20/2025 10:58:44 AM (4 months ago)
Author:
mxchat
Message:
  • 2.4.9 Fix: Resolved pagination links not displaying in Knowledge Base Manager
Location:
mxchat-basic
Files:
103 added
5 edited

Legend:

Unmodified
Added
Removed
  • mxchat-basic/trunk/includes/class-mxchat-addons.php

    r3379814 r3381226  
    191191     */
    192192    public function enqueue_styles() {
    193         $plugin_version = '2.4.8';
     193        $plugin_version = '2.4.9';
    194194
    195195        wp_enqueue_style(
  • mxchat-basic/trunk/includes/class-mxchat-admin.php

    r3379814 r3381226  
    15671567    }
    15681568
    1569 // ================================
    1570 // REPLACE THIS SECTION WITH UNIFIED TABLE LOGIC
    1571 // ================================
    1572 
    1573 // Get bot-specific Pinecone settings
    1574 $pinecone_options = $pinecone_manager->mxchat_get_bot_pinecone_options($current_bot_id);
    1575 $use_pinecone = ($pinecone_options['mxchat_use_pinecone'] ?? '0') === '1';
    1576 $pinecone_api_key = $pinecone_options['mxchat_pinecone_api_key'] ?? '';
    1577 
    1578 //error_log('DEBUG: Bot ' . $current_bot_id . ' - Use Pinecone: ' . ($use_pinecone ? 'YES' : 'NO'));
    1579 //error_log('DEBUG: Bot ' . $current_bot_id . ' - Has API Key: ' . (!empty($pinecone_api_key) ? 'YES' : 'NO'));
    1580 //error_log('DEBUG: Bot ' . $current_bot_id . ' - Host: ' . ($pinecone_options['mxchat_pinecone_host'] ?? 'NOT SET'));
    1581 //error_log('DEBUG: Bot ' . $current_bot_id . ' - Namespace: ' . ($pinecone_options['mxchat_pinecone_namespace'] ?? 'NOT SET'));
    1582 
    1583 if ($use_pinecone && !empty($pinecone_api_key)) {
    1584     //error_log('DEBUG: Using PINECONE data source with bot-specific config');
    1585     // PINECONE DATA SOURCE
    1586     $data_source = 'pinecone';
     1569    // ================================
     1570    // DATA SOURCE CONFIGURATION
     1571    // ================================
     1572
     1573    // Get bot-specific Pinecone settings
     1574    $pinecone_options = $pinecone_manager->mxchat_get_bot_pinecone_options($current_bot_id);
     1575    $use_pinecone = ($pinecone_options['mxchat_use_pinecone'] ?? '0') === '1';
     1576    $pinecone_api_key = $pinecone_options['mxchat_pinecone_api_key'] ?? '';
     1577
     1578    //error_log('DEBUG: Bot ' . $current_bot_id . ' - Use Pinecone: ' . ($use_pinecone ? 'YES' : 'NO'));
     1579    //error_log('DEBUG: Bot ' . $current_bot_id . ' - Has API Key: ' . (!empty($pinecone_api_key) ? 'YES' : 'NO'));
     1580    //error_log('DEBUG: Bot ' . $current_bot_id . ' - Host: ' . ($pinecone_options['mxchat_pinecone_host'] ?? 'NOT SET'));
     1581    //error_log('DEBUG: Bot ' . $current_bot_id . ' - Namespace: ' . ($pinecone_options['mxchat_pinecone_namespace'] ?? 'NOT SET'));
     1582
     1583    if ($use_pinecone && !empty($pinecone_api_key)) {
     1584        //error_log('DEBUG: Using PINECONE data source with bot-specific config');
     1585        // PINECONE DATA SOURCE
     1586        $data_source = 'pinecone';
     1587       
     1588        // IMPORTANT: Pass the bot-specific $pinecone_options, not default options!
     1589        $records = $pinecone_manager->mxchat_fetch_pinecone_records($pinecone_options, $search_query, $current_page, $per_page, $current_bot_id);
     1590
     1591        // TEMPORARY DEBUG - Add this right after the fetch call
     1592        //error_log('=== DEBUG: Bot switching issue ===');
     1593        //error_log('Current bot ID: ' . $current_bot_id);
     1594        //error_log('Use Pinecone: ' . ($use_pinecone ? 'YES' : 'NO'));
     1595        //error_log('Records returned: ' . count($records['data'] ?? []));
     1596        //error_log('Total records: ' . ($records['total'] ?? 0));
     1597
     1598        // Check first few records to see their bot_id
     1599        if (!empty($records['data'])) {
     1600            foreach (array_slice($records['data'], 0, 3) as $i => $record) {
     1601                $record_bot_id = $record->bot_id ?? 'NOT_SET';
     1602                //error_log('Record ' . ($i+1) . ' bot_id: ' . $record_bot_id . ', content preview: ' . substr($record->article_content ?? '', 0, 30) . '...');
     1603            }
     1604        }
     1605        //error_log('=== END DEBUG ===');
     1606
     1607        $total_records = $records['total'] ?? 0;
     1608        $prompts = $records['data'] ?? array();
     1609        $total_in_database = $records['total_in_database'] ?? 0;
     1610        $showing_recent_only = $records['showing_recent_only'] ?? false;
     1611
     1612        $total_pages = ceil($total_records / $per_page);
     1613
     1614    } else {
     1615        //error_log('DEBUG: Using WORDPRESS DB data source');
     1616        // WORDPRESS DB DATA SOURCE (your existing logic)
     1617        $data_source = 'wordpress';
     1618
     1619        // Initialize these variables for WordPress DB
     1620        $total_in_database = 0;
     1621        $showing_recent_only = false;
     1622
     1623        $offset = ($current_page - 1) * $per_page;
     1624
     1625        // Modify query to handle search input
     1626        $sql_search = "";
     1627        if ($search_query) {
     1628            $sql_search = $wpdb->prepare("WHERE article_content LIKE %s", '%' . $wpdb->esc_like($search_query) . '%');
     1629        }
     1630
     1631        // Retrieve total number of prompts, considering search filter
     1632        $count_query = "SELECT COUNT(*) FROM {$table_name} {$sql_search}";
     1633        $total_records = $wpdb->get_var($count_query);
     1634        $total_pages = ceil($total_records / $per_page);
     1635
     1636        // Retrieve prompts from the database
     1637        $prompts_query = $wpdb->prepare(
     1638            "SELECT * FROM {$table_name} {$sql_search} ORDER BY timestamp DESC LIMIT %d OFFSET %d",
     1639            $per_page,
     1640            $offset
     1641        );
     1642
     1643        $prompts = $wpdb->get_results($prompts_query);
     1644    }
     1645
     1646    // ================================
     1647    // PAGINATION GENERATION
     1648    // ================================
    15871649   
    1588     // IMPORTANT: Pass the bot-specific $pinecone_options, not default options!
    1589     $records = $pinecone_manager->mxchat_fetch_pinecone_records($pinecone_options, $search_query, $current_page, $per_page, $current_bot_id);
    1590 
    1591     // TEMPORARY DEBUG - Add this right after the fetch call
    1592     //error_log('=== DEBUG: Bot switching issue ===');
    1593     //error_log('Current bot ID: ' . $current_bot_id);
    1594     //error_log('Use Pinecone: ' . ($use_pinecone ? 'YES' : 'NO'));
    1595     //error_log('Records returned: ' . count($records['data'] ?? []));
    1596     //error_log('Total records: ' . ($records['total'] ?? 0));
    1597 
    1598     // Check first few records to see their bot_id
    1599     if (!empty($records['data'])) {
    1600         foreach (array_slice($records['data'], 0, 3) as $i => $record) {
    1601             $record_bot_id = $record->bot_id ?? 'NOT_SET';
    1602             //error_log('Record ' . ($i+1) . ' bot_id: ' . $record_bot_id . ', content preview: ' . substr($record->article_content ?? '', 0, 30) . '...');
     1650    // Generate pagination links
     1651    if ($total_pages > 1) {
     1652        // Build base URL with necessary parameters
     1653        $base_url = add_query_arg('paged', '%#%');
     1654       
     1655        // Preserve bot_id parameter if multi-bot is active
     1656        if ($multibot_active && !empty($current_bot_id) && $current_bot_id !== 'default') {
     1657            $base_url = add_query_arg('bot_id', $current_bot_id, $base_url);
    16031658        }
    1604     }
    1605     //error_log('=== END DEBUG ===');
    1606 
    1607     $total_records = $records['total'] ?? 0;
    1608     $prompts = $records['data'] ?? array();
    1609     $total_in_database = $records['total_in_database'] ?? 0;
    1610     $showing_recent_only = $records['showing_recent_only'] ?? false;
    1611 
    1612     $total_pages = ceil($total_records / $per_page);
    1613 
    1614 } else {
    1615     //error_log('DEBUG: Using WORDPRESS DB data source');
    1616     // WORDPRESS DB DATA SOURCE (your existing logic)
    1617     $data_source = 'wordpress';
    1618 
    1619     // Initialize these variables for WordPress DB
    1620     $total_in_database = 0;
    1621     $showing_recent_only = false;
    1622 
    1623     $offset = ($current_page - 1) * $per_page;
    1624 
    1625     // Modify query to handle search input
    1626     $sql_search = "";
    1627     if ($search_query) {
    1628         $sql_search = $wpdb->prepare("WHERE article_content LIKE %s", '%' . $wpdb->esc_like($search_query) . '%');
    1629     }
    1630 
    1631     // Retrieve total number of prompts, considering search filter
    1632     $count_query = "SELECT COUNT(*) FROM {$table_name} {$sql_search}";
    1633     $total_records = $wpdb->get_var($count_query);
    1634     $total_pages = ceil($total_records / $per_page);
    1635 
    1636     // Retrieve prompts from the database
    1637     $prompts_query = $wpdb->prepare(
    1638         "SELECT * FROM {$table_name} {$sql_search} ORDER BY timestamp DESC LIMIT %d OFFSET %d",
    1639         $per_page,
    1640         $offset
    1641     );
    1642 
    1643     $prompts = $wpdb->get_results($prompts_query);
    1644 }
     1659       
     1660        // Preserve search query if present
     1661        if ($search_query) {
     1662            $base_url = add_query_arg('search', $search_query, $base_url);
     1663        }
     1664       
     1665        $page_links = paginate_links(array(
     1666            'base' => $base_url,
     1667            'format' => '',
     1668            'prev_text' => __('« Previous', 'mxchat'),
     1669            'next_text' => __('Next »', 'mxchat'),
     1670            'total' => $total_pages,
     1671            'current' => $current_page,
     1672            'type' => 'plain',
     1673        ));
     1674    } else {
     1675        $page_links = '';
     1676    }
    16451677
    16461678    // ================================
    1647     // END OF REPLACEMENT SECTION
     1679    // PROCESSING STATUS RETRIEVAL
    16481680    // ================================
    1649 
     1681   
    16501682    // Retrieve processing statuses
    1651     $pdf_url     = get_transient('mxchat_last_pdf_url');
     1683    $pdf_url = get_transient('mxchat_last_pdf_url');
    16521684    $sitemap_url = get_transient('mxchat_last_sitemap_url');
    1653     $knowledge_manager = MxChat_Knowledge_Manager::get_instance();
    1654     $pdf_status  = $pdf_url ? $knowledge_manager->mxchat_get_pdf_processing_status($pdf_url) : false;
     1685    $pdf_status = $pdf_url ? $knowledge_manager->mxchat_get_pdf_processing_status($pdf_url) : false;
    16551686    $sitemap_status = $sitemap_url ? $knowledge_manager->mxchat_get_sitemap_processing_status($sitemap_url) : false;
    16561687
     
    21132144                        <!-- Completed Status Cards - Handles completed PDF/Sitemap processing -->
    21142145                        <?php
    2115                         $knowledge_manager = MxChat_Knowledge_Manager::get_instance();
    21162146                        echo $knowledge_manager->mxchat_render_completed_status_cards();
    21172147                        ?>
     
    21312161                                    <?php endif; ?>
    21322162                                </span>
    2133                                 <!-- Keep your existing badge code here -->
     2163                                <!-- Data source badge -->
    21342164                                <?php if ($use_pinecone) : ?>
    21352165                                    <span class="mxchat-data-source-badge pinecone" style="display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 12px; font-size: 12px; font-weight: 500; margin-left: 8px; background: #e3f2fd; color: #1976d2;">
     
    21612191                                </form>
    21622192
    2163 <form method="post"
    2164       action="<?php echo esc_url(admin_url('admin-post.php?action=mxchat_delete_all_prompts')); ?>"
    2165       class="mxchat-delete-form"
    2166       onsubmit="return confirm('<?php esc_attr_e('Are you sure you want to delete all knowledge? This action cannot be undone.', 'mxchat'); ?>');">
    2167     <?php wp_nonce_field('mxchat_delete_all_prompts_action', 'mxchat_delete_all_prompts_nonce'); ?>
    2168     <input type="hidden" name="data_source" value="<?php echo esc_attr($data_source); ?>" />
    2169     <!-- Always include bot_id, even if it's 'default' -->
    2170     <input type="hidden" name="bot_id" value="<?php echo esc_attr($current_bot_id); ?>" />
    2171     <button type="submit" name="delete_all_prompts" class="mxchat-button-danger">
    2172         <span class="dashicons dashicons-trash"></span>
    2173         <?php esc_html_e('Delete All', 'mxchat'); ?>
    2174     </button>
    2175 </form>
     2193                                <form method="post"
     2194                                      action="<?php echo esc_url(admin_url('admin-post.php?action=mxchat_delete_all_prompts')); ?>"
     2195                                      class="mxchat-delete-form"
     2196                                      onsubmit="return confirm('<?php esc_attr_e('Are you sure you want to delete all knowledge? This action cannot be undone.', 'mxchat'); ?>');">
     2197                                    <?php wp_nonce_field('mxchat_delete_all_prompts_action', 'mxchat_delete_all_prompts_nonce'); ?>
     2198                                    <input type="hidden" name="data_source" value="<?php echo esc_attr($data_source); ?>" />
     2199                                    <!-- Always include bot_id, even if it's 'default' -->
     2200                                    <input type="hidden" name="bot_id" value="<?php echo esc_attr($current_bot_id); ?>" />
     2201                                    <button type="submit" name="delete_all_prompts" class="mxchat-button-danger">
     2202                                        <span class="dashicons dashicons-trash"></span>
     2203                                        <?php esc_html_e('Delete All', 'mxchat'); ?>
     2204                                    </button>
     2205                                </form>
    21762206                            </div>
    21772207                        </div>
     
    23862416                </div>
    23872417
    2388     <!-- Sync Settings Tab (Initially Hidden) -->
    2389     <div id="mxchat-kb-tab-sync" class="mxchat-kb-tab-content">
    2390 <div class="mxchat-card">
    2391    <!-- Auto-Sync Settings -->
    2392    <div class="mxchat-settings-section">
    2393        <h3><?php esc_html_e('Auto-Sync Settings', 'mxchat'); ?></h3>
    2394        <p class="mxchat-description">
    2395            <?php esc_html_e('Note: Auto-sync works only for newly published content. Existing posts and pages must be imported manually below. Works with Pinecone if enabled', 'mxchat'); ?>
    2396        </p>
    2397        <div class="mxchat-autosave-section">
    2398            <div class="mxchat-toggle-group">
    2399                <div class="mxchat-toggle-container">
    2400                    <label class="mxchat-toggle-switch">
    2401                        <input type="checkbox"
    2402                               name="mxchat_auto_sync_posts"
    2403                               class="mxchat-autosave-field"
    2404                               value="1"
    2405                               data-nonce="<?php echo wp_create_nonce('mxchat_prompts_setting_nonce'); ?>"
    2406                               <?php checked(get_option('mxchat_auto_sync_posts', '0'), '1'); ?>>
    2407                        <span class="mxchat-toggle-slider"></span>
    2408                    </label>
    2409                    <span class="mxchat-toggle-label">
    2410                        <?php esc_html_e('Auto-sync Posts', 'mxchat'); ?>
    2411                    </span>
    2412                </div>
    2413 
    2414                <div class="mxchat-toggle-container">
    2415                    <label class="mxchat-toggle-switch">
    2416                        <input type="checkbox"
    2417                               name="mxchat_auto_sync_pages"
    2418                               class="mxchat-autosave-field"
    2419                               value="1"
    2420                               data-nonce="<?php echo wp_create_nonce('mxchat_prompts_setting_nonce'); ?>"
    2421                               <?php checked(get_option('mxchat_auto_sync_pages', '0'), '1'); ?>>
    2422                        <span class="mxchat-toggle-slider"></span>
    2423                    </label>
    2424                    <span class="mxchat-toggle-label">
    2425                        <?php esc_html_e('Auto-sync Pages', 'mxchat'); ?>
    2426                    </span>
    2427                </div>
    2428 
    2429                <!-- Custom Post Types Section -->
    2430                <div class="mxchat-section-content">
    2431                    <div class="mxchat-custom-post-types-header">
    2432                        <button id="mxchat-custom-post-types-toggle" class="mxchat-button-secondary">
    2433                            <?php esc_html_e('Advanced Custom Post Sync Settings', 'mxchat'); ?>
    2434                            <span class="mxchat-toggle-icon">▼</span>
    2435                        </button>
    2436                    </div>
    2437 
    2438                    <div id="mxchat-custom-post-types-container" class="mxchat-custom-post-types-container" style="display: none;">
    2439                        <h3><?php esc_html_e('Sync Custom Post Types', 'mxchat'); ?></h3>
    2440                        <p><?php esc_html_e('Select additional custom post types to automatically sync with the chatbot.', 'mxchat'); ?></p>
    2441 
    2442                        <div class="mxchat-custom-post-types">
     2418                <!-- Sync Settings Tab (Initially Hidden) -->
     2419                <div id="mxchat-kb-tab-sync" class="mxchat-kb-tab-content">
     2420                    <div class="mxchat-card">
     2421                        <!-- Auto-Sync Settings -->
     2422                        <div class="mxchat-settings-section">
     2423                            <h3><?php esc_html_e('Auto-Sync Settings', 'mxchat'); ?></h3>
     2424                            <p class="mxchat-description">
     2425                                <?php esc_html_e('Note: Auto-sync works only for newly published content. Existing posts and pages must be imported manually below. Works with Pinecone if enabled', 'mxchat'); ?>
     2426                            </p>
     2427                            <div class="mxchat-autosave-section">
     2428                                <div class="mxchat-toggle-group">
     2429                                    <div class="mxchat-toggle-container">
     2430                                        <label class="mxchat-toggle-switch">
     2431                                            <input type="checkbox"
     2432                                                   name="mxchat_auto_sync_posts"
     2433                                                   class="mxchat-autosave-field"
     2434                                                   value="1"
     2435                                                   data-nonce="<?php echo wp_create_nonce('mxchat_prompts_setting_nonce'); ?>"
     2436                                                   <?php checked(get_option('mxchat_auto_sync_posts', '0'), '1'); ?>>
     2437                                            <span class="mxchat-toggle-slider"></span>
     2438                                        </label>
     2439                                        <span class="mxchat-toggle-label">
     2440                                            <?php esc_html_e('Auto-sync Posts', 'mxchat'); ?>
     2441                                        </span>
     2442                                    </div>
     2443
     2444                                    <div class="mxchat-toggle-container">
     2445                                        <label class="mxchat-toggle-switch">
     2446                                            <input type="checkbox"
     2447                                                   name="mxchat_auto_sync_pages"
     2448                                                   class="mxchat-autosave-field"
     2449                                                   value="1"
     2450                                                   data-nonce="<?php echo wp_create_nonce('mxchat_prompts_setting_nonce'); ?>"
     2451                                                   <?php checked(get_option('mxchat_auto_sync_pages', '0'), '1'); ?>>
     2452                                            <span class="mxchat-toggle-slider"></span>
     2453                                        </label>
     2454                                        <span class="mxchat-toggle-label">
     2455                                            <?php esc_html_e('Auto-sync Pages', 'mxchat'); ?>
     2456                                        </span>
     2457                                    </div>
     2458
     2459                                    <!-- Custom Post Types Section -->
     2460                                    <div class="mxchat-section-content">
     2461                                        <div class="mxchat-custom-post-types-header">
     2462                                            <button id="mxchat-custom-post-types-toggle" class="mxchat-button-secondary">
     2463                                                <?php esc_html_e('Advanced Custom Post Sync Settings', 'mxchat'); ?>
     2464                                                <span class="mxchat-toggle-icon">▼</span>
     2465                                            </button>
     2466                                        </div>
     2467
     2468                                        <div id="mxchat-custom-post-types-container" class="mxchat-custom-post-types-container" style="display: none;">
     2469                                            <h3><?php esc_html_e('Sync Custom Post Types', 'mxchat'); ?></h3>
     2470                                            <p><?php esc_html_e('Select additional custom post types to automatically sync with the chatbot.', 'mxchat'); ?></p>
     2471
     2472                                            <div class="mxchat-custom-post-types">
     2473                                                <?php
     2474                                                $post_types = $knowledge_manager->mxchat_get_public_post_types();
     2475                                                // Skip post and page as they're handled separately
     2476                                                unset($post_types['post']);
     2477                                                unset($post_types['page']);
     2478
     2479                                                if (!empty($post_types)) {
     2480                                                    foreach ($post_types as $post_type => $label) {
     2481                                                        $option_name = 'mxchat_auto_sync_' . $post_type;
     2482                                                        $is_enabled = get_option($option_name, '0');
     2483                                                        ?>
     2484                                                        <div class="mxchat-toggle-container">
     2485                                                            <label class="mxchat-toggle-switch">
     2486                                                                <input type="checkbox"
     2487                                                                       name="<?php echo esc_attr($option_name); ?>"
     2488                                                                       class="mxchat-autosave-field"
     2489                                                                       value="1"
     2490                                                                       data-nonce="<?php echo wp_create_nonce('mxchat_prompts_setting_nonce'); ?>"
     2491                                                                       <?php checked($is_enabled, '1'); ?>>
     2492                                                                <span class="mxchat-toggle-slider"></span>
     2493                                                            </label>
     2494                                                            <span class="mxchat-toggle-label">
     2495                                                                <?php echo esc_html($label); ?> (<?php echo esc_html($post_type); ?>)
     2496                                                            </span>
     2497                                                        </div>
     2498                                                        <?php
     2499                                                    }
     2500                                                } else {
     2501                                                    echo '<p>' . esc_html__('No custom post types found.', 'mxchat') . '</p>';
     2502                                                }
     2503                                                ?>
     2504                                            </div>
     2505                                        </div>
     2506                                    </div>
     2507                                </div>
     2508                            </div>
     2509                        </div>
     2510                    </div>
     2511                </div>
     2512
     2513                <!-- Pinecone Settings Tab -->
     2514                <div id="mxchat-kb-tab-pinecone" class="mxchat-kb-tab-content mxchat-autosave-section">
     2515                    <div class="mxchat-card">
     2516                        <h2><?php esc_html_e('Pinecone Vector Database Settings', 'mxchat'); ?></h2>
     2517                        <p class="mxchat-description">
     2518                            <?php echo wp_kses(
     2519                                __('<strong>Pinecone is optional</strong> and not required for MxChat to function. It provides enhanced search performance for larger knowledge bases. When enabled, content will be stored in Pinecone instead of the WordPress database, but you can use MxChat without it.', 'mxchat'),
     2520                                array('strong' => array())
     2521                            ); ?>
     2522                        </p>
     2523
     2524                        <div class="mxchat-pinecone-info-box">
     2525                            <div class="mxchat-info-icon">
     2526                                <span class="dashicons dashicons-info"></span>
     2527                            </div>
     2528                            <div class="mxchat-info-content">
     2529                                <h4><?php esc_html_e('What is Pinecone?', 'mxchat'); ?></h4>
     2530                                <p><?php esc_html_e('Pinecone is a specialized vector database designed for AI applications. It provides faster similarity searches and better scalability compared to traditional databases for AI-powered features.', 'mxchat'); ?></p>
     2531                                <p><a href="https://www.pinecone.io/" target="_blank" rel="noopener noreferrer"><?php esc_html_e('Learn more about Pinecone →', 'mxchat'); ?></a></p>
     2532                            </div>
     2533                        </div>
     2534
     2535                        <div class="mxchat-database-settings-form">
     2536                            <?php
     2537                            $pinecone_options = get_option('mxchat_pinecone_addon_options', array());
     2538                            $use_pinecone = $pinecone_options['mxchat_use_pinecone'] ?? '0';
     2539                            ?>
     2540
     2541                            <div class="mxchat-toggle-container">
     2542                                <label class="mxchat-toggle-switch">
     2543                                    <input type="checkbox"
     2544                                           name="mxchat_pinecone_addon_options[mxchat_use_pinecone]"
     2545                                           value="1"
     2546                                           <?php checked($use_pinecone, '1'); ?>>
     2547                                    <span class="mxchat-toggle-slider"></span>
     2548                                </label>
     2549                                <span class="mxchat-toggle-label">
     2550                                    <?php esc_html_e('Enable Pinecone Database', 'mxchat'); ?>
     2551                                </span>
     2552                            </div>
     2553
     2554                            <div class="mxchat-pinecone-settings" <?php echo $use_pinecone ? '' : 'style="display: none;"'; ?>>
     2555
     2556                                <?php if ($use_pinecone) : ?>
     2557                                    <div class="mxchat-knowledge-warning success">
     2558                                        <p><span class="dashicons dashicons-yes-alt"></span>
     2559                                           <?php esc_html_e('Pinecone is enabled. All new knowledge base content will be stored in Pinecone.', 'mxchat'); ?>
     2560                                        </p>
     2561                                    </div>
     2562                                <?php endif; ?>
     2563
     2564                                <div class="mxchat-form-group">
     2565                                    <label for="mxchat_pinecone_api_key">
     2566                                        <?php esc_html_e('Pinecone API Key', 'mxchat'); ?> <span class="required">*</span>
     2567                                    </label>
     2568                                    <input type="password"
     2569                                           id="mxchat_pinecone_api_key"
     2570                                           name="mxchat_pinecone_addon_options[mxchat_pinecone_api_key]"
     2571                                           value="<?php echo esc_attr($pinecone_options['mxchat_pinecone_api_key'] ?? ''); ?>"
     2572                                           class="regular-text"
     2573                                           placeholder="pcsk_..." />
     2574                                    <p class="description">
     2575                                        <?php esc_html_e('Found in your Pinecone dashboard under API Keys.', 'mxchat'); ?>
     2576                                        <a href="https://app.pinecone.io/" target="_blank" rel="noopener noreferrer"><?php esc_html_e('Open Pinecone Dashboard', 'mxchat'); ?></a>
     2577                                    </p>
     2578                                </div>
     2579
     2580                                <div class="mxchat-form-group">
     2581                                    <label for="mxchat_pinecone_environment">
     2582                                        <?php esc_html_e('Region', 'mxchat'); ?>
     2583                                    </label>
     2584                                    <input type="text"
     2585                                           id="mxchat_pinecone_environment"
     2586                                           name="mxchat_pinecone_addon_options[mxchat_pinecone_environment]"
     2587                                           value="<?php echo esc_attr($pinecone_options['mxchat_pinecone_environment'] ?? ''); ?>"
     2588                                           placeholder="e.g., gcp-starter"
     2589                                           class="regular-text" />
     2590                                    <p class="description">
     2591                                        <?php esc_html_e('Your Pinecone environment/region (e.g., gcp-starter, us-west1-gcp, us-east-1-aws)', 'mxchat'); ?>
     2592                                    </p>
     2593                                </div>
     2594
     2595                                <div class="mxchat-form-group">
     2596                                    <label for="mxchat_pinecone_index">
     2597                                        <?php esc_html_e('Index Name', 'mxchat'); ?> <span class="required">*</span>
     2598                                    </label>
     2599                                    <input type="text"
     2600                                           id="mxchat_pinecone_index"
     2601                                           name="mxchat_pinecone_addon_options[mxchat_pinecone_index]"
     2602                                           value="<?php echo esc_attr($pinecone_options['mxchat_pinecone_index'] ?? ''); ?>"
     2603                                           placeholder="e.g., my-wordpress-vectors"
     2604                                           class="regular-text" />
     2605                                    <p class="description">
     2606                                        <?php esc_html_e('The name of your Pinecone index. Must be created in your Pinecone dashboard first.', 'mxchat'); ?>
     2607                                    </p>
     2608                                </div>
     2609
     2610                                <div class="mxchat-form-group">
     2611                                    <label for="mxchat_pinecone_host">
     2612                                        <?php esc_html_e('Pinecone Host', 'mxchat'); ?> <span class="required">*</span>
     2613                                    </label>
     2614                                    <input type="text"
     2615                                           id="mxchat_pinecone_host"
     2616                                           name="mxchat_pinecone_addon_options[mxchat_pinecone_host]"
     2617                                           value="<?php echo esc_attr($pinecone_options['mxchat_pinecone_host'] ?? ''); ?>"
     2618                                           placeholder="e.g., my-index-xyz123.svc.pinecone.io"
     2619                                           class="regular-text" />
     2620                                    <p class="description">
     2621                                        <?php esc_html_e('The hostname from your Pinecone index URL (exclude https://). Found in your index details.', 'mxchat'); ?>
     2622                                    </p>
     2623                                </div>
     2624
     2625                                <div class="mxchat-setup-steps">
     2626                                    <h3><?php esc_html_e('Setup Instructions', 'mxchat'); ?></h3>
     2627                                    <div class="mxchat-setup-step">
     2628                                        <span class="step-number">1</span>
     2629                                        <div class="step-content">
     2630                                            <h4><?php esc_html_e('Create Account', 'mxchat'); ?></h4>
     2631                                            <p><?php esc_html_e('Create a free account at', 'mxchat'); ?> <a href="https://www.pinecone.io/" target="_blank">pinecone.io</a></p>
     2632                                        </div>
     2633                                    </div>
     2634                                    <div class="mxchat-setup-step">
     2635                                        <span class="step-number">2</span>
     2636                                        <div class="step-content">
     2637                                            <h4><?php esc_html_e('Create Index', 'mxchat'); ?></h4>
     2638                                            <p><?php esc_html_e('Create a new index with these settings:', 'mxchat'); ?></p>
     2639                                            <ul>
     2640                                                <li><?php esc_html_e('Dimensions: Choose based on your embedding model - 1536 (OpenAI Ada 2, TE3 Small), 2048 (Voyage-3 Large), 3072 (TE3 Large, Gemini Embedding), 1536 (Gemini Embedding), or 768 (Gemini Embedding)', 'mxchat'); ?></li>
     2641                                                <li><?php esc_html_e('Metric: Cosine', 'mxchat'); ?></li>
     2642                                                <li><?php esc_html_e('Cloud & Region: Your preferred region', 'mxchat'); ?></li>
     2643                                            </ul>
     2644                                        </div>
     2645                                    </div>
     2646                                    <div class="mxchat-setup-step">
     2647                                        <span class="step-number">3</span>
     2648                                        <div class="step-content">
     2649                                            <h4><?php esc_html_e('Get API Key', 'mxchat'); ?></h4>
     2650                                            <p><?php esc_html_e('Copy your API key from the API Keys section', 'mxchat'); ?></p>
     2651                                        </div>
     2652                                    </div>
     2653                                    <div class="mxchat-setup-step">
     2654                                        <span class="step-number">4</span>
     2655                                        <div class="step-content">
     2656                                            <h4><?php esc_html_e('Get Index Host', 'mxchat'); ?></h4>
     2657                                            <p><?php esc_html_e('Copy your index host URL from the index details', 'mxchat'); ?></p>
     2658                                        </div>
     2659                                    </div>
     2660                                    <div class="mxchat-setup-step">
     2661                                        <span class="step-number">5</span>
     2662                                        <div class="step-content">
     2663                                            <h4><?php esc_html_e('Save Settings', 'mxchat'); ?></h4>
     2664                                            <p><?php esc_html_e('Fill in the form above and save settings', 'mxchat'); ?></p>
     2665                                        </div>
     2666                                    </div>
     2667                                </div>
     2668
     2669                            </div>
     2670
     2671                        </div>
     2672                    </div>
     2673                </div>
     2674
     2675            </div>
     2676
     2677        </div>
     2678    </div>
     2679
     2680    <!-- Content Selector Modal -->
     2681    <div id="mxchat-kb-content-selector-modal" class="mxchat-kb-modal">
     2682        <div class="mxchat-kb-modal-content">
     2683            <div class="mxchat-kb-modal-header">
     2684                <h3>
     2685                    <?php esc_html_e('Select WordPress Content', 'mxchat'); ?><br>
     2686                    <span class="mxchat-kb-header-note"><?php esc_html_e('(Content imported here will be tagged "In Knowledge Base")', 'mxchat'); ?></span>
     2687                </h3>
     2688                <span class="mxchat-kb-modal-close">&times;</span>
     2689            </div>
     2690            <div class="mxchat-kb-modal-filters">
     2691                <div class="mxchat-kb-search-group">
     2692                    <input type="text" id="mxchat-kb-content-search" placeholder="<?php esc_attr_e('Search...', 'mxchat'); ?>">
     2693                </div>
     2694
     2695                <div class="mxchat-kb-filter-group">
     2696                    <select id="mxchat-kb-content-type-filter">
     2697                        <option value="all"><?php esc_html_e('All Content Types', 'mxchat'); ?></option>
     2698                        <option value="post"><?php esc_html_e('Posts', 'mxchat'); ?></option>
     2699                        <option value="page"><?php esc_html_e('Pages', 'mxchat'); ?></option>
    24432700                        <?php
    2444                         $post_types = $knowledge_manager->mxchat_get_public_post_types();
    2445                         // Skip post and page as they're handled separately
    2446                         unset($post_types['post']);
    2447                         unset($post_types['page']);
    2448 
    2449                            if (!empty($post_types)) {
    2450                                foreach ($post_types as $post_type => $label) {
    2451                                    $option_name = 'mxchat_auto_sync_' . $post_type;
    2452                                    $is_enabled = get_option($option_name, '0');
    2453                                    ?>
    2454                                    <div class="mxchat-toggle-container">
    2455                                        <label class="mxchat-toggle-switch">
    2456                                            <input type="checkbox"
    2457                                                   name="<?php echo esc_attr($option_name); ?>"
    2458                                                   class="mxchat-autosave-field"
    2459                                                   value="1"
    2460                                                   data-nonce="<?php echo wp_create_nonce('mxchat_prompts_setting_nonce'); ?>"
    2461                                                   <?php checked($is_enabled, '1'); ?>>
    2462                                            <span class="mxchat-toggle-slider"></span>
    2463                                        </label>
    2464                                        <span class="mxchat-toggle-label">
    2465                                            <?php echo esc_html($label); ?> (<?php echo esc_html($post_type); ?>)
    2466                                        </span>
    2467                                    </div>
    2468                                    <?php
    2469                                }
    2470                            } else {
    2471                                echo '<p>' . esc_html__('No custom post types found.', 'mxchat') . '</p>';
    2472                            }
    2473                            ?>
    2474                        </div>
    2475                    </div>
    2476                </div>
    2477            </div>
    2478        </div>
    2479    </div>
    2480 </div>
    2481 </div>
    2482 
    2483 <!-- NEW PINECONE TAB -->
    2484     <div id="mxchat-kb-tab-pinecone" class="mxchat-kb-tab-content mxchat-autosave-section">
    2485         <div class="mxchat-card">
    2486             <h2><?php esc_html_e('Pinecone Vector Database Settings', 'mxchat'); ?></h2>
    2487             <p class="mxchat-description">
    2488                 <?php echo wp_kses(
    2489                     __('<strong>Pinecone is optional</strong> and not required for MxChat to function. It provides enhanced search performance for larger knowledge bases. When enabled, content will be stored in Pinecone instead of the WordPress database, but you can use MxChat without it.', 'mxchat'),
    2490                     array('strong' => array())
    2491                 ); ?>
    2492             </p>
    2493 
    2494             <div class="mxchat-pinecone-info-box">
    2495                 <div class="mxchat-info-icon">
    2496                     <span class="dashicons dashicons-info"></span>
    2497                 </div>
    2498                 <div class="mxchat-info-content">
    2499                     <h4><?php esc_html_e('What is Pinecone?', 'mxchat'); ?></h4>
    2500                     <p><?php esc_html_e('Pinecone is a specialized vector database designed for AI applications. It provides faster similarity searches and better scalability compared to traditional databases for AI-powered features.', 'mxchat'); ?></p>
    2501                     <p><a href="https://www.pinecone.io/" target="_blank" rel="noopener noreferrer"><?php esc_html_e('Learn more about Pinecone →', 'mxchat'); ?></a></p>
     2701                        // Add other post types dynamically
     2702                        $post_types = get_post_types(array('public' => true), 'objects');
     2703                        foreach ($post_types as $post_type) {
     2704                            // Skip post and page as they're already added
     2705                            if (!in_array($post_type->name, array('post', 'page'))) {
     2706                                echo '<option value="' . esc_attr($post_type->name) . '">' . esc_html($post_type->label) . '</option>';
     2707                            }
     2708                        }
     2709                        ?>
     2710                    </select>
     2711
     2712                    <select id="mxchat-kb-content-status-filter">
     2713                        <option value="publish"><?php esc_html_e('Published', 'mxchat'); ?></option>
     2714                        <option value="draft"><?php esc_html_e('Drafts', 'mxchat'); ?></option>
     2715                        <option value="all"><?php esc_html_e('All Statuses', 'mxchat'); ?></option>
     2716                    </select>
     2717
     2718                    <select id="mxchat-kb-processed-filter">
     2719                        <option value="all"><?php esc_html_e('All Content', 'mxchat'); ?></option>
     2720                        <option value="processed"><?php esc_html_e('In Knowledge Base', 'mxchat'); ?></option>
     2721                        <option value="unprocessed"><?php esc_html_e('Not In Knowledge Base', 'mxchat'); ?></option>
     2722                    </select>
    25022723                </div>
    25032724            </div>
    25042725
    2505             <div class="mxchat-database-settings-form">
    2506                 <!-- REMOVED the WordPress form - we're using AJAX auto-save instead -->
    2507                 <?php
    2508                 $pinecone_options = get_option('mxchat_pinecone_addon_options', array());
    2509                 $use_pinecone = $pinecone_options['mxchat_use_pinecone'] ?? '0';
    2510                 ?>
    2511 
    2512                 <div class="mxchat-toggle-container">
    2513                     <label class="mxchat-toggle-switch">
    2514                         <input type="checkbox"
    2515                                name="mxchat_pinecone_addon_options[mxchat_use_pinecone]"
    2516                                value="1"
    2517                                <?php checked($use_pinecone, '1'); ?>>
    2518                         <span class="mxchat-toggle-slider"></span>
     2726            <div class="mxchat-kb-content-selection">
     2727                <div class="mxchat-kb-selection-header">
     2728                    <label>
     2729                        <input type="checkbox" id="mxchat-kb-select-all">
     2730                        <?php esc_html_e('Select All', 'mxchat'); ?>
    25192731                    </label>
    2520                     <span class="mxchat-toggle-label">
    2521                         <?php esc_html_e('Enable Pinecone Database', 'mxchat'); ?>
    2522                     </span>
     2732                    <span class="mxchat-kb-selection-count">0 <?php esc_html_e('selected', 'mxchat'); ?></span>
    25232733                </div>
    25242734
    2525                 <div class="mxchat-pinecone-settings" <?php echo $use_pinecone ? '' : 'style="display: none;"'; ?>>
    2526 
    2527                     <?php if ($use_pinecone) : ?>
    2528                         <div class="mxchat-knowledge-warning success">
    2529                             <p><span class="dashicons dashicons-yes-alt"></span>
    2530                                <?php esc_html_e('Pinecone is enabled. All new knowledge base content will be stored in Pinecone.', 'mxchat'); ?>
    2531                             </p>
    2532                         </div>
    2533                     <?php endif; ?>
    2534 
    2535                     <div class="mxchat-form-group">
    2536                         <label for="mxchat_pinecone_api_key">
    2537                             <?php esc_html_e('Pinecone API Key', 'mxchat'); ?> <span class="required">*</span>
    2538                         </label>
    2539                         <input type="password"
    2540                                id="mxchat_pinecone_api_key"
    2541                                name="mxchat_pinecone_addon_options[mxchat_pinecone_api_key]"
    2542                                value="<?php echo esc_attr($pinecone_options['mxchat_pinecone_api_key'] ?? ''); ?>"
    2543                                class="regular-text"
    2544                                placeholder="pcsk_..." />
    2545                         <p class="description">
    2546                             <?php esc_html_e('Found in your Pinecone dashboard under API Keys.', 'mxchat'); ?>
    2547                             <a href="https://app.pinecone.io/" target="_blank" rel="noopener noreferrer"><?php esc_html_e('Open Pinecone Dashboard', 'mxchat'); ?></a>
    2548                         </p>
     2735                <div class="mxchat-kb-content-list">
     2736                    <!-- Content will be loaded here via AJAX -->
     2737                    <div class="mxchat-kb-loading">
     2738                        <span class="mxchat-kb-spinner is-active"></span>
     2739                        <?php esc_html_e('Loading content...', 'mxchat'); ?>
    25492740                    </div>
    2550 
    2551                     <div class="mxchat-form-group">
    2552                         <label for="mxchat_pinecone_environment">
    2553                             <?php esc_html_e('Region', 'mxchat'); ?>
    2554                         </label>
    2555                         <input type="text"
    2556                                id="mxchat_pinecone_environment"
    2557                                name="mxchat_pinecone_addon_options[mxchat_pinecone_environment]"
    2558                                value="<?php echo esc_attr($pinecone_options['mxchat_pinecone_environment'] ?? ''); ?>"
    2559                                placeholder="e.g., gcp-starter"
    2560                                class="regular-text" />
    2561                         <p class="description">
    2562                             <?php esc_html_e('Your Pinecone environment/region (e.g., gcp-starter, us-west1-gcp, us-east-1-aws)', 'mxchat'); ?>
    2563                         </p>
    2564                     </div>
    2565 
    2566                     <div class="mxchat-form-group">
    2567                         <label for="mxchat_pinecone_index">
    2568                             <?php esc_html_e('Index Name', 'mxchat'); ?> <span class="required">*</span>
    2569                         </label>
    2570                         <input type="text"
    2571                                id="mxchat_pinecone_index"
    2572                                name="mxchat_pinecone_addon_options[mxchat_pinecone_index]"
    2573                                value="<?php echo esc_attr($pinecone_options['mxchat_pinecone_index'] ?? ''); ?>"
    2574                                placeholder="e.g., my-wordpress-vectors"
    2575                                class="regular-text" />
    2576                         <p class="description">
    2577                             <?php esc_html_e('The name of your Pinecone index. Must be created in your Pinecone dashboard first.', 'mxchat'); ?>
    2578                         </p>
    2579                     </div>
    2580 
    2581                     <div class="mxchat-form-group">
    2582                         <label for="mxchat_pinecone_host">
    2583                             <?php esc_html_e('Pinecone Host', 'mxchat'); ?> <span class="required">*</span>
    2584                         </label>
    2585                         <input type="text"
    2586                                id="mxchat_pinecone_host"
    2587                                name="mxchat_pinecone_addon_options[mxchat_pinecone_host]"
    2588                                value="<?php echo esc_attr($pinecone_options['mxchat_pinecone_host'] ?? ''); ?>"
    2589                                placeholder="e.g., my-index-xyz123.svc.pinecone.io"
    2590                                class="regular-text" />
    2591                         <p class="description">
    2592                             <?php esc_html_e('The hostname from your Pinecone index URL (exclude https://). Found in your index details.', 'mxchat'); ?>
    2593                         </p>
    2594                     </div>
    2595 
    2596 <div class="mxchat-setup-steps">
    2597     <h3><?php esc_html_e('Setup Instructions', 'mxchat'); ?></h3>
    2598     <div class="mxchat-setup-step">
    2599         <span class="step-number">1</span>
    2600         <div class="step-content">
    2601             <h4><?php esc_html_e('Create Account', 'mxchat'); ?></h4>
    2602             <p><?php esc_html_e('Create a free account at', 'mxchat'); ?> <a href="https://www.pinecone.io/" target="_blank">pinecone.io</a></p>
    2603         </div>
    2604     </div>
    2605     <div class="mxchat-setup-step">
    2606         <span class="step-number">2</span>
    2607         <div class="step-content">
    2608             <h4><?php esc_html_e('Create Index', 'mxchat'); ?></h4>
    2609             <p><?php esc_html_e('Create a new index with these settings:', 'mxchat'); ?></p>
    2610             <ul>
    2611                 <li><?php esc_html_e('Dimensions: Choose based on your embedding model - 1536 (OpenAI Ada 2, TE3 Small), 2048 (Voyage-3 Large), 3072 (TE3 Large, Gemini Embedding), 1536 (Gemini Embedding), or 768 (Gemini Embedding)', 'mxchat'); ?></li>
    2612                 <li><?php esc_html_e('Metric: Cosine', 'mxchat'); ?></li>
    2613                 <li><?php esc_html_e('Cloud & Region: Your preferred region', 'mxchat'); ?></li>
    2614             </ul>
    2615         </div>
    2616     </div>
    2617     <div class="mxchat-setup-step">
    2618         <span class="step-number">3</span>
    2619         <div class="step-content">
    2620             <h4><?php esc_html_e('Get API Key', 'mxchat'); ?></h4>
    2621             <p><?php esc_html_e('Copy your API key from the API Keys section', 'mxchat'); ?></p>
    2622         </div>
    2623     </div>
    2624     <div class="mxchat-setup-step">
    2625         <span class="step-number">4</span>
    2626         <div class="step-content">
    2627             <h4><?php esc_html_e('Get Index Host', 'mxchat'); ?></h4>
    2628             <p><?php esc_html_e('Copy your index host URL from the index details', 'mxchat'); ?></p>
    2629         </div>
    2630     </div>
    2631     <div class="mxchat-setup-step">
    2632         <span class="step-number">5</span>
    2633         <div class="step-content">
    2634             <h4><?php esc_html_e('Save Settings', 'mxchat'); ?></h4>
    2635             <p><?php esc_html_e('Fill in the form above and save settings', 'mxchat'); ?></p>
    2636         </div>
    2637     </div>
    2638 </div>
    2639 
    2640 
    2641 
    26422741                </div>
    26432742
    2644 
     2743                <div class="mxchat-kb-pagination">
     2744                    <!-- Pagination will be added here -->
     2745                </div>
     2746            </div>
     2747
     2748            <div class="mxchat-kb-modal-footer">
     2749                <button type="button" id="mxchat-kb-process-selected" class="mxchat-kb-button-primary" disabled>
     2750                    <?php esc_html_e('Process Selected Content', 'mxchat'); ?>
     2751                    <span class="mxchat-kb-selected-count">(0)</span>
     2752                </button>
     2753                <button type="button" class="mxchat-kb-button-secondary mxchat-kb-modal-close">
     2754                    <?php esc_html_e('Cancel', 'mxchat'); ?>
     2755                </button>
    26452756            </div>
    26462757        </div>
    26472758    </div>
    26482759
    2649 </div>
    2650 
    2651 
    2652 
    2653 
    2654 </div>
    2655 </div>
    2656 
    2657 
    2658 <!-- Content Selector Modal -->
    2659 <div id="mxchat-kb-content-selector-modal" class="mxchat-kb-modal">
    2660     <div class="mxchat-kb-modal-content">
    2661 <div class="mxchat-kb-modal-header">
    2662     <h3>
    2663         <?php esc_html_e('Select WordPress Content', 'mxchat'); ?><br>
    2664         <span class="mxchat-kb-header-note"><?php esc_html_e('(Content imported here will be tagged "In Knowledge Base")', 'mxchat'); ?></span>
    2665     </h3>
    2666     <span class="mxchat-kb-modal-close">&times;</span>
    2667 </div>
    2668         <div class="mxchat-kb-modal-filters">
    2669             <div class="mxchat-kb-search-group">
    2670                 <input type="text" id="mxchat-kb-content-search" placeholder="<?php esc_attr_e('Search...', 'mxchat'); ?>">
    2671             </div>
    2672 
    2673             <div class="mxchat-kb-filter-group">
    2674                 <select id="mxchat-kb-content-type-filter">
    2675                     <option value="all"><?php esc_html_e('All Content Types', 'mxchat'); ?></option>
    2676                     <option value="post"><?php esc_html_e('Posts', 'mxchat'); ?></option>
    2677                     <option value="page"><?php esc_html_e('Pages', 'mxchat'); ?></option>
    2678                     <?php
    2679                     // Add other post types dynamically
    2680                     $post_types = get_post_types(array('public' => true), 'objects');
    2681                     foreach ($post_types as $post_type) {
    2682                         // Skip post and page as they're already added
    2683                         if (!in_array($post_type->name, array('post', 'page'))) {
    2684                             echo '<option value="' . esc_attr($post_type->name) . '">' . esc_html($post_type->label) . '</option>';
    2685                         }
    2686                     }
    2687                     ?>
    2688                 </select>
    2689 
    2690                 <select id="mxchat-kb-content-status-filter">
    2691                     <option value="publish"><?php esc_html_e('Published', 'mxchat'); ?></option>
    2692                     <option value="draft"><?php esc_html_e('Drafts', 'mxchat'); ?></option>
    2693                     <option value="all"><?php esc_html_e('All Statuses', 'mxchat'); ?></option>
    2694                 </select>
    2695 
    2696                 <select id="mxchat-kb-processed-filter">
    2697                     <option value="all"><?php esc_html_e('All Content', 'mxchat'); ?></option>
    2698                     <option value="processed"><?php esc_html_e('In Knowledge Base', 'mxchat'); ?></option>
    2699                     <option value="unprocessed"><?php esc_html_e('Not In Knowledge Base', 'mxchat'); ?></option>
    2700                 </select>
    2701             </div>
    2702         </div>
    2703 
    2704         <div class="mxchat-kb-content-selection">
    2705             <div class="mxchat-kb-selection-header">
    2706                 <label>
    2707                     <input type="checkbox" id="mxchat-kb-select-all">
    2708                     <?php esc_html_e('Select All', 'mxchat'); ?>
    2709                 </label>
    2710                 <span class="mxchat-kb-selection-count">0 <?php esc_html_e('selected', 'mxchat'); ?></span>
    2711             </div>
    2712 
    2713             <div class="mxchat-kb-content-list">
    2714                 <!-- Content will be loaded here via AJAX -->
    2715                 <div class="mxchat-kb-loading">
    2716                     <span class="mxchat-kb-spinner is-active"></span>
    2717                     <?php esc_html_e('Loading content...', 'mxchat'); ?>
    2718                 </div>
    2719             </div>
    2720 
    2721             <div class="mxchat-kb-pagination">
    2722                 <!-- Pagination will be added here -->
    2723             </div>
    2724         </div>
    2725 
    2726         <div class="mxchat-kb-modal-footer">
    2727             <button type="button" id="mxchat-kb-process-selected" class="mxchat-kb-button-primary" disabled>
    2728                 <?php esc_html_e('Process Selected Content', 'mxchat'); ?>
    2729                 <span class="mxchat-kb-selected-count">(0)</span>
    2730             </button>
    2731             <button type="button" class="mxchat-kb-button-secondary mxchat-kb-modal-close">
    2732                 <?php esc_html_e('Cancel', 'mxchat'); ?>
    2733             </button>
    2734         </div>
    2735     </div>
    2736 </div>
    2737 
    27382760<?php
    27392761}
     2762
     2763
     2764
     2765
     2766
    27402767
    27412768/**
     
    66216648public function mxchat_enqueue_admin_assets() {
    66226649    // Get plugin version (define this in your main plugin file)
    6623     $version = defined('MXCHAT_VERSION') ? MXCHAT_VERSION : '2.4.8';
     6650    $version = defined('MXCHAT_VERSION') ? MXCHAT_VERSION : '2.4.9';
    66246651
    66256652    // Use file modification time for development (remove in production)
  • mxchat-basic/trunk/includes/class-mxchat-integrator.php

    r3379814 r3381226  
    67016701public function mxchat_enqueue_scripts_styles() {
    67026702    // Define version numbers for the styles and scripts
    6703     $chat_style_version = '2.4.8';
    6704     $chat_script_version = '2.4.8';
     6703    $chat_style_version = '2.4.9';
     6704    $chat_script_version = '2.4.9';
    67056705    // Enqueue the script
    67066706    wp_enqueue_script(
  • mxchat-basic/trunk/mxchat-basic.php

    r3379814 r3381226  
    44 * Plugin URI: https://mxchat.ai/
    55 * Description: AI chatbot for WordPress with OpenAI, Claude, xAI, DeepSeek, live agent, PDF uploads, WooCommerce, and training on website data.
    6  * Version: 2.4.8
     6 * Version: 2.4.9
    77 * Author: MxChat
    88 * Author URI: https://mxchat.ai
     
    1818
    1919// Define plugin version constant for asset versioning
    20 define('MXCHAT_VERSION', '2.4.8');
     20define('MXCHAT_VERSION', '2.4.9');
    2121
    2222function mxchat_load_textdomain() {
  • mxchat-basic/trunk/readme.txt

    r3379814 r3381226  
    66Tested up to: 6.8
    77Requires PHP: 7.2
    8 Stable tag: 2.4.8
     8Stable tag: 2.4.9
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    181181== Changelog ==
    182182
     183= 2.4.9 - October 20, 2025 =
     184- Fix: Resolved pagination links not displaying in Knowledge Base Manager
     185
    183186= 2.4.8 - October 16, 2025 =
    184187- New: OpenRouter integration - access 100+ AI models with a single API key
     
    559562== Upgrade Notice ==
    560563
    561 = 2.4.8 =
    562 Major update: OpenRouter integration with 100+ models and new Claude Sonnet 4.5, Opus 4.1, and Haiku 4.5 support
     564= 2.4.9 =
     565- Fix: Resolved pagination links not displaying in Knowledge Base Manager
    563566
    564567== License & Warranty ==
Note: See TracChangeset for help on using the changeset viewer.