| @@ -896,9 +896,10 @@ | ||
| 896 | 896 | <div class="mxch-card"> |
| 897 | 897 | <div class="mxch-card-header"> |
| 898 | 898 | <h3 class="mxch-card-title"> |
| 899 | 899 | <?php esc_html_e('Knowledge Entries', 'mxchat'); ?> |
| 900 | - <span id="mxchat-entry-count" style="font-weight: normal; color: var(--mxch-text-secondary);">(<?php echo esc_html($total_records); ?>)</span> | |
| 900 | + <?php $count_unit = $count_unit ?? ''; ?> | |
| 901 | + <span id="mxchat-entry-count" style="font-weight: normal; color: var(--mxch-text-secondary);" data-count="<?php echo esc_attr($total_records); ?>" data-unit="<?php echo esc_attr($count_unit); ?>"<?php if ($count_unit === 'vectors') : ?> title="<?php esc_attr_e('Pinecone reports vectors, not documents; a long entry is stored as several vectors.', 'mxchat'); ?>"<?php endif; ?>>(<?php echo esc_html(number_format_i18n($total_records)); ?><?php if ($count_unit === 'vectors') : ?> <?php esc_html_e('vectors', 'mxchat'); ?><?php endif; ?>)</span> | |
| 901 | 902 | <?php if (!empty($use_vectorstore)) : ?> |
| 902 | 903 | <span 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: #fff3e0; color: #e65100;"> |
| 903 | 904 | <span class="dashicons dashicons-database" style="font-size: 14px;"></span> |
| 904 | 905 | <?php esc_html_e('Not in use', 'mxchat'); ?> |
| @@ -1275,10 +1276,21 @@ | ||
| 1275 | 1276 | </table> |
| 1276 | 1277 | </div> |
| 1277 | 1278 | |
| 1278 | 1279 | <!-- Pagination wrapper - always present so JS can populate it after processing --> |
| 1279 | - <div id="mxchat-kb-pagination" class="mxchat-kb-pagination-wrapper" style="<?php echo $total_pages > 1 ? 'padding: 16px; border-top: 1px solid var(--mxch-card-border); text-align: center;' : ''; ?>" data-current-page="<?php echo esc_attr($current_page); ?>" data-total-pages="<?php echo esc_attr($total_pages); ?>" data-search="<?php echo esc_attr($search_query); ?>" data-content-type="<?php echo esc_attr($content_type_filter); ?>"> | |
| 1280 | - <?php if ($total_pages > 1) : ?> | |
| 1280 | + <?php | |
| 1281 | + // Plan dd6e10: Pinecone's list endpoint is a cursor — there is no | |
| 1282 | + // random access to page N, so over 500 vectors the screen offers | |
| 1283 | + // Previous / Next only. The same markup is built for AJAX page | |
| 1284 | + // loads by MxChat_Knowledge_Manager::mxchat_cursor_pagination_html(). | |
| 1285 | + $cursor_pagination = !empty($cursor_pagination); | |
| 1286 | + $has_next = !empty($has_next); | |
| 1287 | + $show_pagination = $cursor_pagination ? ($current_page > 1 || $has_next) : ($total_pages > 1); | |
| 1288 | + ?> | |
| 1289 | + <div id="mxchat-kb-pagination" class="mxchat-kb-pagination-wrapper" style="<?php echo $show_pagination ? 'padding: 16px; border-top: 1px solid var(--mxch-card-border); text-align: center;' : ''; ?>" data-current-page="<?php echo esc_attr($current_page); ?>" data-total-pages="<?php echo esc_attr($total_pages); ?>" data-search="<?php echo esc_attr($search_query); ?>" data-content-type="<?php echo esc_attr($content_type_filter); ?>"> | |
| 1290 | + <?php if ($cursor_pagination) : ?> | |
| 1291 | + <?php echo MxChat_Knowledge_Manager::mxchat_cursor_pagination_html($current_page, $has_next, $search_query, $content_type_filter); // phpcs:ignore WordPress.Security.EscapeOutput -- escaped inside ?> | |
| 1292 | + <?php elseif ($total_pages > 1) : ?> | |
| 1281 | 1293 | <div class="mxchat-ajax-pagination" data-current-page="<?php echo esc_attr($current_page); ?>" data-total-pages="<?php echo esc_attr($total_pages); ?>"> |
| 1282 | 1294 | <?php if ($current_page > 1) : ?> |
| 1283 | 1295 | <a href="#" class="mxchat-page-link" data-page="<?php echo ($current_page - 1); ?>"><?php esc_html_e('« Previous', 'mxchat'); ?></a> |
| 1284 | 1296 | <?php endif; ?> |
| @@ -1459,12 +1471,12 @@ | ||
| 1459 | 1471 | <label class="mxchat-toggle-switch"> |
| 1460 | 1472 | <input type="checkbox" name="mxchat_hybrid_keyword_toggle" id="mxchat_hybrid_keyword_toggle" class="mxchat-autosave-field" value="on" <?php checked(get_option('mxchat_hybrid_keyword_toggle', 'off'), 'on'); ?>> |
| 1461 | 1473 | <span class="mxchat-toggle-slider"></span> |
| 1462 | 1474 | </label> |
| 1463 | - <span style="font-weight: 500;"><?php esc_html_e('Hybrid keyword boost (WP-DB knowledge base)', 'mxchat'); ?></span> | |
| 1475 | + <span style="font-weight: 500;"><?php esc_html_e('Hybrid keyword boost (WordPress database and Pinecone document indexes)', 'mxchat'); ?></span> | |
| 1464 | 1476 | </div> |
| 1465 | - <p class="mxch-field-description" style="margin-top: 8px;"><?php esc_html_e('Combines keyword matching with vector similarity when searching your WordPress-database knowledge base. Helps exact-token questions — product codes, SKUs, error codes, names — find the right document even when semantic similarity alone would miss it.', 'mxchat'); ?></p> | |
| 1466 | - <p class="mxch-field-hint"><?php esc_html_e('Only affects the WordPress-database knowledge base; Pinecone is unaffected. Changes which sources are retrieved on existing installs, so test after enabling. The Transcripts sources panel labels how each match was found while this is on.', 'mxchat'); ?></p> | |
| 1477 | + <p class="mxch-field-description" style="margin-top: 8px;"><?php esc_html_e('Combines keyword matching with vector similarity when searching your WordPress-database knowledge base or a Pinecone document index. Helps exact-token questions — product codes, SKUs, error codes, names — find the right document even when semantic similarity alone would miss it.', 'mxchat'); ?></p> | |
| 1478 | + <p class="mxch-field-hint"><?php esc_html_e('Applies to the WordPress-database knowledge base and to Pinecone when the index type is Document index with full-text search; a classic Pinecone vector index is unaffected. Changes which sources are retrieved on existing installs, so test after enabling. The Transcripts sources panel labels how each match was found while this is on.', 'mxchat'); ?></p> | |
| 1467 | 1479 | </div> |
| 1468 | 1480 | </div> |
| 1469 | 1481 | </div> |
| 1470 | 1482 | |
| @@ -1523,22 +1535,22 @@ | ||
| 1523 | 1535 | /** |
| 1524 | 1536 | * Render Role Restrictions Section |
| 1525 | 1537 | */ |
| 1526 | 1538 | function mxchat_render_role_restrictions_section($knowledge_manager) { |
| 1527 | - $role_options = array( | |
| 1528 | - 'public' => __('Public (Everyone)', 'mxchat'), | |
| 1529 | - 'logged_in' => __('Logged In Users', 'mxchat'), | |
| 1530 | - 'subscriber' => __('Subscribers & Above', 'mxchat'), | |
| 1531 | - 'contributor' => __('Contributors & Above', 'mxchat'), | |
| 1532 | - 'author' => __('Authors & Above', 'mxchat'), | |
| 1533 | - 'editor' => __('Editors & Above', 'mxchat'), | |
| 1534 | - 'administrator' => __('Administrators Only', 'mxchat') | |
| 1535 | - ); | |
| 1539 | + // Same source as the per-entry dropdown, so the two selectors cannot drift | |
| 1540 | + // and both offer the site's custom roles (plan 6ab002). This screen used to | |
| 1541 | + // hold its own hardcoded copy of the five built-ins. | |
| 1542 | + $role_options = (is_object($knowledge_manager) && method_exists($knowledge_manager, 'mxchat_get_role_options')) | |
| 1543 | + ? $knowledge_manager->mxchat_get_role_options() | |
| 1544 | + : array( | |
| 1545 | + 'public' => __('Public (Everyone)', 'mxchat'), | |
| 1546 | + 'logged_in' => __('Logged In Users', 'mxchat'), | |
| 1547 | + ); | |
| 1536 | 1548 | ?> |
| 1537 | 1549 | <div id="role-restrictions" class="mxch-section"> |
| 1538 | 1550 | <div class="mxch-content-header"> |
| 1539 | 1551 | <h1 class="mxch-content-title"><?php esc_html_e('Role-Based Content Restrictions', 'mxchat'); ?></h1> |
| 1540 | - <p class="mxch-content-subtitle"><?php esc_html_e('Automatically restrict content access based on WordPress tags.', 'mxchat'); ?></p> | |
| 1552 | + <p class="mxch-content-subtitle"><?php esc_html_e('Automatically restrict tagged posts by role. Pages and untagged content are restricted per entry in the Knowledge list.', 'mxchat'); ?></p> | |
| 1541 | 1553 | </div> |
| 1542 | 1554 | |
| 1543 | 1555 | <div class="mxch-card"> |
| 1544 | 1556 | <div class="mxch-card-body"> |
| @@ -1543,9 +1555,9 @@ | ||
| 1543 | 1555 | <div class="mxch-card"> |
| 1544 | 1556 | <div class="mxch-card-body"> |
| 1545 | 1557 | <div class="mxch-notice mxch-notice-info" style="margin-bottom: 20px;"> |
| 1546 | 1558 | <svg class="mxch-notice-icon" xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><line x1="12" y1="16" x2="12" y2="12"/><line x1="12" y1="8" x2="12.01" y2="8"/></svg> |
| 1547 | - <span><strong><?php esc_html_e('How it works:', 'mxchat'); ?></strong> <?php esc_html_e('Add a tag below and select which role should have access. Content with that tag will be restricted to that role level.', 'mxchat'); ?></span> | |
| 1559 | + <span><strong><?php esc_html_e('How it works:', 'mxchat'); ?></strong> <?php esc_html_e('Add a tag below and select which role should have access. Content with that tag will be restricted to that role level. Tags apply to posts — pages and other content have no tags, so restrict those from the role dropdown on the entry itself in the Knowledge list. Any role on this site can be chosen, including custom ones.', 'mxchat'); ?></span> | |
| 1548 | 1560 | </div> |
| 1549 | 1561 | |
| 1550 | 1562 | <h4 style="margin: 0 0 16px 0;"><?php esc_html_e('Add Tag-Role Mapping', 'mxchat'); ?></h4> |
| 1551 | 1563 | <div style="display: flex; gap: 15px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 24px;"> |
| @@ -1837,8 +1849,55 @@ | ||
| 1837 | 1849 | <a href="https://app.pinecone.io/" target="_blank"><?php esc_html_e('Open Pinecone Dashboard', 'mxchat'); ?></a> |
| 1838 | 1850 | </p> |
| 1839 | 1851 | </div> |
| 1840 | 1852 | |
| 1853 | + <?php | |
| 1854 | + // Index type (plan 362c31): the classic vector index (default) or a | |
| 1855 | + // document index with full-text search. Same key, host and namespace. | |
| 1856 | + $pc_index_type = (($pinecone_options['mxchat_pinecone_index_type'] ?? 'vector') === 'document') ? 'document' : 'vector'; | |
| 1857 | + $pc_docs_cloud = $pinecone_options['mxchat_pinecone_docs_cloud'] ?? 'aws'; | |
| 1858 | + $pc_docs_region = $pinecone_options['mxchat_pinecone_docs_region'] ?? 'us-east-1'; | |
| 1859 | + $pc_docs_lang = $pinecone_options['mxchat_pinecone_docs_language'] ?? 'en'; | |
| 1860 | + $pc_verified = $pinecone_options['mxchat_pinecone_docs_verified_host'] ?? ''; | |
| 1861 | + $pc_vector_host = $pinecone_options['mxchat_pinecone_vector_host'] ?? ''; | |
| 1862 | + $pc_current_host = $pinecone_options['mxchat_pinecone_host'] ?? ''; | |
| 1863 | + $pc_docs_class = class_exists('MxChat_Pinecone_Documents'); | |
| 1864 | + $pc_expected_dim = $pc_docs_class ? MxChat_Pinecone_Documents::expected_dimension() : 1536; | |
| 1865 | + $pc_migration = $pc_docs_class ? MxChat_Pinecone_Documents::migration_get() : array(); | |
| 1866 | + $pc_host_verified = ($pc_current_host !== '' && strtolower(trim($pc_current_host, '/')) === strtolower($pc_verified)); | |
| 1867 | + $pc_clouds = $pc_docs_class ? MxChat_Pinecone_Documents::clouds() : array('aws' => 'AWS'); | |
| 1868 | + $pc_languages = $pc_docs_class ? MxChat_Pinecone_Documents::languages() : array('en' => 'English'); | |
| 1869 | + ?> | |
| 1870 | + <div class="mxch-field" id="mxchat-pinecone-index-type-field"> | |
| 1871 | + <span class="mxch-field-label"><?php esc_html_e('Index type', 'mxchat'); ?></span> | |
| 1872 | + <div style="display: flex; flex-direction: column; gap: 6px; margin-top: 8px;"> | |
| 1873 | + <label style="display: flex; align-items: baseline; gap: 8px; cursor: pointer;"> | |
| 1874 | + <input type="radio" name="mxchat_pinecone_addon_options[mxchat_pinecone_index_type]" class="mxchat-pinecone-index-type" value="vector" <?php checked($pc_index_type, 'vector'); ?>> | |
| 1875 | + <span> | |
| 1876 | + <strong><?php esc_html_e('Vector index (current)', 'mxchat'); ?></strong> | |
| 1877 | + <span class="mxch-field-description" style="display: block; margin: 2px 0 0;"><?php esc_html_e('The classic Pinecone index. Nothing changes for existing setups.', 'mxchat'); ?></span> | |
| 1878 | + </span> | |
| 1879 | + </label> | |
| 1880 | + <label style="display: flex; align-items: baseline; gap: 8px; cursor: pointer;"> | |
| 1881 | + <input type="radio" name="mxchat_pinecone_addon_options[mxchat_pinecone_index_type]" class="mxchat-pinecone-index-type" value="document" <?php checked($pc_index_type, 'document'); ?>> | |
| 1882 | + <span> | |
| 1883 | + <strong><?php esc_html_e('Document index with full-text search (new)', 'mxchat'); ?></strong> | |
| 1884 | + <span class="mxch-field-description" style="display: block; margin: 2px 0 0;"><?php esc_html_e('A Pinecone document index keeps a keyword index of your content next to the vectors, so questions with part numbers, SKUs and codes find the exact record. It is a new index: create one below and copy your existing index into it, no re-embedding needed. Turn on the Hybrid keyword boost under Retrieval to use it.', 'mxchat'); ?></span> | |
| 1885 | + </span> | |
| 1886 | + </label> | |
| 1887 | + </div> | |
| 1888 | + </div> | |
| 1889 | + <script type="application/json" id="mxchat-pinecone-docs-state"><?php echo wp_json_encode(array( | |
| 1890 | + 'verified_host' => $pc_verified, | |
| 1891 | + 'expected_dimension' => (int) $pc_expected_dim, | |
| 1892 | + 'migration' => $pc_migration, | |
| 1893 | + // 3e83e4: what the LIVE chatbot is on right now, so the | |
| 1894 | + // page can tell a copy-in-progress from a switch. | |
| 1895 | + 'index_type' => $pc_index_type, | |
| 1896 | + 'stored_host' => strtolower(trim((string) $pc_current_host, '/')), | |
| 1897 | + 'stored_index' => (string) ($pinecone_options['mxchat_pinecone_index'] ?? ''), | |
| 1898 | + )); ?></script> | |
| 1899 | + | |
| 1841 | 1900 | <div class="mxch-field"> |
| 1842 | 1901 | <label class="mxch-field-label" for="mxchat_pinecone_environment"><?php esc_html_e('Region', 'mxchat'); ?></label> |
| 1843 | 1902 | <input type="text" id="mxchat_pinecone_environment" name="mxchat_pinecone_addon_options[mxchat_pinecone_environment]" value="<?php echo esc_attr($pinecone_options['mxchat_pinecone_environment'] ?? ''); ?>" class="mxch-input" placeholder="e.g., gcp-starter"> |
| 1844 | 1903 | <p class="mxch-field-description"><?php esc_html_e('Your Pinecone environment/region (e.g., gcp-starter, us-west1-gcp)', 'mxchat'); ?></p> |
| @@ -1859,8 +1918,82 @@ | ||
| 1859 | 1918 | <input type="text" id="mxchat_pinecone_host" name="mxchat_pinecone_addon_options[mxchat_pinecone_host]" value="<?php echo esc_attr($pinecone_options['mxchat_pinecone_host'] ?? ''); ?>" class="mxch-input" placeholder="e.g., my-index-xyz123.svc.pinecone.io"> |
| 1860 | 1919 | <p class="mxch-field-description"><?php esc_html_e('The hostname from your Pinecone index URL (exclude https://). Found in index details.', 'mxchat'); ?></p> |
| 1861 | 1920 | </div> |
| 1862 | 1921 | |
| 1922 | + <div class="mxchat-pinecone-docs-settings" <?php echo $pc_index_type === 'document' ? '' : 'style="display: none;"'; ?>> | |
| 1923 | + <div class="mxch-notice <?php echo $pc_host_verified ? 'mxch-notice-success' : 'mxch-notice-warning'; ?>" id="mxchat-pinecone-docs-status" style="margin-bottom: 20px;"> | |
| 1924 | + <svg class="mxch-notice-icon" xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><line x1="12" y1="16" x2="12" y2="12"/><line x1="12" y1="8" x2="12.01" y2="8"/></svg> | |
| 1925 | + <span id="mxchat-pinecone-docs-status-text"><?php | |
| 1926 | + if ($pc_host_verified) { | |
| 1927 | + printf(esc_html__('Document index checked: %1$s (%2$d dimensions).', 'mxchat'), esc_html($pc_verified), (int) $pc_expected_dim); | |
| 1928 | + } else { | |
| 1929 | + esc_html_e('Not checked yet. Create a document index below, or enter its host above and click Check index. The index type only saves once the host has been checked.', 'mxchat'); | |
| 1930 | + } | |
| 1931 | + ?></span> | |
| 1932 | + </div> | |
| 1933 | + | |
| 1934 | + <div class="mxch-field"> | |
| 1935 | + <label class="mxch-field-label" for="mxchat_pinecone_docs_cloud"><?php esc_html_e('Cloud and region for a new index', 'mxchat'); ?></label> | |
| 1936 | + <div style="display: flex; gap: 8px; flex-wrap: wrap;"> | |
| 1937 | + <select id="mxchat_pinecone_docs_cloud" name="mxchat_pinecone_addon_options[mxchat_pinecone_docs_cloud]" class="mxch-select" style="max-width: 160px;"> | |
| 1938 | + <?php foreach ($pc_clouds as $pc_cloud_key => $pc_cloud_label) : ?> | |
| 1939 | + <option value="<?php echo esc_attr($pc_cloud_key); ?>" <?php selected($pc_docs_cloud, $pc_cloud_key); ?>><?php echo esc_html($pc_cloud_label); ?></option> | |
| 1940 | + <?php endforeach; ?> | |
| 1941 | + </select> | |
| 1942 | + <input type="text" id="mxchat_pinecone_docs_region" name="mxchat_pinecone_addon_options[mxchat_pinecone_docs_region]" value="<?php echo esc_attr($pc_docs_region); ?>" class="mxch-input" style="max-width: 220px;" placeholder="us-east-1"> | |
| 1943 | + <select id="mxchat_pinecone_docs_language" name="mxchat_pinecone_addon_options[mxchat_pinecone_docs_language]" class="mxch-select" style="max-width: 200px;"> | |
| 1944 | + <?php foreach ($pc_languages as $pc_lang_key => $pc_lang_label) : ?> | |
| 1945 | + <option value="<?php echo esc_attr($pc_lang_key); ?>" <?php selected($pc_docs_lang, $pc_lang_key); ?>><?php echo esc_html($pc_lang_label); ?></option> | |
| 1946 | + <?php endforeach; ?> | |
| 1947 | + </select> | |
| 1948 | + </div> | |
| 1949 | + <p class="mxch-field-description"><?php printf(esc_html__('Create index for me makes a new document index named after the Index Name field (a free name ending in -docs is suggested when you switch to this type), sized for your embedding model (%d dimensions, cosine), with full-text search on the content in the chosen language, then fills in the host. Check index confirms the host above points at a document index MxChat can use. Neither moves your chatbot — that happens when you save.', 'mxchat'), (int) $pc_expected_dim); ?></p> | |
| 1950 | + </div> | |
| 1951 | + | |
| 1952 | + <div class="mxch-field" style="display: flex; gap: 8px; flex-wrap: wrap;"> | |
| 1953 | + <button type="button" class="mxch-btn mxch-btn-secondary" id="mxchat-pinecone-docs-create"><?php esc_html_e('Create index for me', 'mxchat'); ?></button> | |
| 1954 | + <button type="button" class="mxch-btn mxch-btn-secondary" id="mxchat-pinecone-docs-check"><?php esc_html_e('Check index', 'mxchat'); ?></button> | |
| 1955 | + </div> | |
| 1956 | + <div id="mxchat-pinecone-docs-result" style="display: none;"></div> | |
| 1957 | + <p class="mxch-field-hint" id="mxchat-pinecone-docs-gate" style="display: none;"><?php esc_html_e('Check the document index host before saving.', 'mxchat'); ?></p> | |
| 1958 | + <div class="mxch-field" id="mxchat-pinecone-docs-switch-gate" style="display: none;"> | |
| 1959 | + <p class="mxch-field-hint" id="mxchat-pinecone-docs-switch-gate-text"></p> | |
| 1960 | + <label class="mxch-field-hint" style="display: flex; align-items: center; gap: 8px; cursor: pointer;"> | |
| 1961 | + <input type="checkbox" id="mxchat_pinecone_docs_switch_anyway" name="mxchat_pinecone_addon_options[mxchat_pinecone_docs_switch_anyway]" value="1"> | |
| 1962 | + <span><?php esc_html_e('Switch anyway — point the chatbot at the document index now and copy the rest afterwards', 'mxchat'); ?></span> | |
| 1963 | + </label> | |
| 1964 | + </div> | |
| 1965 | + | |
| 1966 | + <div class="mxch-field" style="margin-top: 20px;"> | |
| 1967 | + <label class="mxch-field-label" for="mxchat_pinecone_vector_host"><?php esc_html_e('Copy from vector index host', 'mxchat'); ?></label> | |
| 1968 | + <input type="text" id="mxchat_pinecone_vector_host" name="mxchat_pinecone_addon_options[mxchat_pinecone_vector_host]" value="<?php echo esc_attr($pc_vector_host); ?>" class="mxch-input" placeholder="my-index-xyz123.svc.pinecone.io"> | |
| 1969 | + <p class="mxch-field-description"><?php esc_html_e('Migrate copies every record of that index into the document index above — text, vector and metadata, same ids — with no embedding calls. It runs while your chatbot keeps answering from the vector index; save the Pinecone settings afterwards to switch. Safe to run again: records already copied are simply replaced, and an interrupted copy continues where it stopped. Both indexes must use the same embedding dimension.', 'mxchat'); ?></p> | |
| 1970 | + </div> | |
| 1971 | + <div class="mxch-field" style="display: flex; gap: 12px; align-items: center; flex-wrap: wrap;"> | |
| 1972 | + <button type="button" class="mxch-btn mxch-btn-secondary" id="mxchat-pinecone-docs-migrate"><?php esc_html_e('Migrate', 'mxchat'); ?></button> | |
| 1973 | + <?php /* e50d2e: offered only when the source index holds records in more than one namespace (the JS shows it from the start response). No name attribute — it is not a saved setting. */ ?> | |
| 1974 | + <label class="mxch-toggle" id="mxchat-pinecone-docs-all-namespaces" style="display: none;" title="<?php esc_attr_e('Copy the records of every namespace of the vector index, each into the same-named namespace of the document index, in one run.', 'mxchat'); ?>"> | |
| 1975 | + <input type="checkbox" class="mxch-toggle-input" id="mxchat_pinecone_docs_all_namespaces" value="1"> | |
| 1976 | + <span class="mxch-toggle-switch"></span> | |
| 1977 | + <span class="mxch-toggle-label"><?php esc_html_e('Copy every namespace', 'mxchat'); ?></span> | |
| 1978 | + </label> | |
| 1979 | + <span id="mxchat-pinecone-docs-migrate-counts" class="mxch-field-description"></span> | |
| 1980 | + </div> | |
| 1981 | + <div id="mxchat-pinecone-docs-migrate-progress" style="display: none; margin-bottom: 16px;"> | |
| 1982 | + <div class="mxch-progress-bar"><div class="mxch-progress-bar-fill" style="width: 0%;"></div></div> | |
| 1983 | + <div class="mxch-progress-label"></div> | |
| 1984 | + </div> | |
| 1985 | + | |
| 1986 | + <div class="mxch-field" id="mxchat-pinecone-docs-delete-old" style="display: none;"> | |
| 1987 | + <label class="mxch-field-label" for="mxchat_pinecone_docs_delete_confirm"><?php esc_html_e('Delete old index', 'mxchat'); ?></label> | |
| 1988 | + <p class="mxch-field-description"><?php esc_html_e('Available once the copy count matches. Type the old index name to confirm. This deletes the whole vector index at Pinecone and cannot be undone.', 'mxchat'); ?></p> | |
| 1989 | + <div style="display: flex; gap: 8px; flex-wrap: wrap;"> | |
| 1990 | + <input type="text" id="mxchat_pinecone_docs_delete_confirm" class="mxch-input" style="max-width: 320px;" placeholder="<?php esc_attr_e('old index name', 'mxchat'); ?>" autocomplete="off"> | |
| 1991 | + <button type="button" class="mxch-btn mxch-btn-danger" id="mxchat-pinecone-docs-delete-old-btn"><?php esc_html_e('Delete old index', 'mxchat'); ?></button> | |
| 1992 | + </div> | |
| 1993 | + </div> | |
| 1994 | + </div> | |
| 1995 | + | |
| 1863 | 1996 | <div class="mxch-field"> |
| 1864 | 1997 | <label class="mxch-field-label" for="mxchat_pinecone_top_k"> |
| 1865 | 1998 | <?php esc_html_e('Results Per Query (topK)', 'mxchat'); ?> |
| 1866 | 1999 | </label> |
| @@ -2143,8 +2276,20 @@ | ||
| 2143 | 2276 | <option value="processed"><?php esc_html_e('In Knowledge Base', 'mxchat'); ?></option> |
| 2144 | 2277 | <option value="unprocessed"><?php esc_html_e('Not In Knowledge Base', 'mxchat'); ?></option> |
| 2145 | 2278 | </select> |
| 2146 | 2279 | </div> |
| 2280 | + </div> | |
| 2281 | + <?php | |
| 2282 | + // Shown only while Media is the selected type (plan 01010a). Media lists | |
| 2283 | + // just the files whose text MxChat can read; saying so here is clearer | |
| 2284 | + // than listing images and audio as rows that cannot be selected. | |
| 2285 | + ?> | |
| 2286 | + <div class="mxchat-kb-filter-note" id="mxchat-kb-media-note" hidden> | |
| 2287 | + <svg class="mxchat-kb-filter-note-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> | |
| 2288 | + <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path> | |
| 2289 | + <path d="M14 2v6h6"></path> | |
| 2290 | + </svg> | |
| 2291 | + <span><?php esc_html_e('Media lists PDF, Word, text and Markdown files — the types MxChat can read text from. Images, audio and video are not shown.', 'mxchat'); ?></span> | |
| 2147 | 2292 | </div> |
| 2148 | 2293 | <div class="mxchat-kb-content-selection"> |
| 2149 | 2294 | <div class="mxchat-kb-selection-header"> |
| 2150 | 2295 | <label> |