PluginProbe
MxChat – AI Chatbot & Content Generation for WordPress / 3.2.25
MxChat – AI Chatbot & Content Generation for WordPress v3.2.25
3.2.25 3.2.24 3.2.23 3.2.22 3.2.21 3.2.20 3.2.19 3.2.18 3.2.17 3.2.16 3.2.15 3.2.14 3.2.12 3.2.13 3.2.11 3.2.10 3.2.9 3.2.8 3.2.7 3.2.6 3.2.5 3.2.4 3.2.3 3.2.2 3.2.1 All 156 releases
← All changes | js/knowledge-processing.js +51 -21 3.2.14 → 3.2.25 View file →
@@ -1086,12 +1086,11 @@
1086 1086 $(this).remove();
1087 1087 // Update entry count displays (header and sidebar)
1088 1088 var $countSpan = $('#mxchat-entry-count');
1089 1089 if ($countSpan.length) {
1090 - var currentText = $countSpan.text();
1091 - var match = currentText.match(/\((\d+)\)/);
1092 - if (match) {
1093 - var newCount = Math.max(0, parseInt(match[1]) - 1);
1090 + var currentCount = readEntryCount($countSpan);
1091 + if (!isNaN(currentCount)) {
1092 + var newCount = Math.max(0, currentCount - 1);
1094 1093 updateEntryCount(newCount);
1095 1094 }
1096 1095 }
1097 1096 });
@@ -1150,12 +1149,11 @@
1150 1149 $(this).remove();
1151 1150 // Update entry count displays (header and sidebar)
1152 1151 var $countSpan = $('#mxchat-entry-count');
1153 1152 if ($countSpan.length) {
1154 - var currentText = $countSpan.text();
1155 - var match = currentText.match(/\((\d+)\)/);
1156 - if (match) {
1157 - var newCount = Math.max(0, parseInt(match[1]) - 1);
1153 + var currentCount = readEntryCount($countSpan);
1154 + if (!isNaN(currentCount)) {
1155 + var newCount = Math.max(0, currentCount - 1);
1158 1156 updateEntryCount(newCount);
1159 1157 }
1160 1158 }
1161 1159 });
@@ -1351,12 +1349,11 @@
1351 1349 // Update entry count displays (header and sidebar)
1352 1350 if (successCount > 0) {
1353 1351 var $countSpan = $('#mxchat-entry-count');
1354 1352 if ($countSpan.length) {
1355 - var currentText = $countSpan.text();
1356 - var match = currentText.match(/\((\d+)\)/);
1357 - if (match) {
1358 - var newCount = Math.max(0, parseInt(match[1]) - successCount);
1353 + var currentCount = readEntryCount($countSpan);
1354 + if (!isNaN(currentCount)) {
1355 + var newCount = Math.max(0, currentCount - successCount);
1359 1356 updateEntryCount(newCount);
1360 1357 }
1361 1358 }
1362 1359 }
@@ -1529,9 +1526,9 @@
1529 1526 }
1530 1527
1531 1528 // Update the count display
1532 1529 if (response.data.total_count !== undefined) {
1533 - updateEntryCount(response.data.total_count);
1530 + updateEntryCount(response.data.total_count, response.data.count_unit);
1534 1531 }
1535 1532
1536 1533 // Show success feedback
1537 1534 showNotification('success', 'Entries refreshed successfully!');
@@ -1744,9 +1741,9 @@
1744 1741 success: function(response) {
1745 1742 if (response.success && response.data) {
1746 1743 // Update count
1747 1744 if (response.data.total_count !== undefined) {
1748 - updateEntryCount(response.data.total_count);
1745 + updateEntryCount(response.data.total_count, response.data.count_unit);
1749 1746 }
1750 1747
1751 1748 // Handle Pinecone data source differently
1752 1749 if (response.data.data_source === 'pinecone') {
@@ -1819,14 +1816,32 @@
1819 1816 }
1820 1817 });
1821 1818 }
1822 1819
1823 - // Update the entry count display
1824 - function updateEntryCount(count) {
1820 + // Read the heading's count from its data attribute, not from the text: the
1821 + // text now carries a thousands separator and a unit ("(1,240 vectors)") on
1822 + // the Pinecone cursor path (plan dd6e10).
1823 + function readEntryCount($countSpan) {
1824 + var stored = parseInt($countSpan.attr('data-count'), 10);
1825 + if (!isNaN(stored)) {
1826 + return stored;
1827 + }
1828 + var match = $countSpan.text().match(/\(([\d,]+)/);
1829 + return match ? parseInt(match[1].replace(/,/g, ''), 10) : NaN;
1830 + }
1831 +
1832 + // Update the entry count display. `unit` is 'vectors' on the Pinecone
1833 + // cursor path and '' otherwise; omitted = keep whatever the span carries.
1834 + function updateEntryCount(count, unit) {
1825 1835 // Update main table count
1826 1836 const $countSpan = $('#mxchat-entry-count');
1827 1837 if ($countSpan.length) {
1828 - $countSpan.text('(' + count + ')');
1838 + if (unit === undefined) {
1839 + unit = $countSpan.attr('data-unit') || '';
1840 + }
1841 + var shown = Number(count).toLocaleString();
1842 + $countSpan.attr('data-count', count).attr('data-unit', unit);
1843 + $countSpan.text('(' + shown + (unit === 'vectors' ? ' vectors' : '') + ')');
1829 1844
1830 1845 // Flash animation to indicate update
1831 1846 $countSpan.addClass('mxchat-count-updated');
1832 1847 setTimeout(function() {
@@ -1893,9 +1908,9 @@
1893 1908 }
1894 1909
1895 1910 // Update count display
1896 1911 if (response.data.total_count !== undefined) {
1897 - updateEntryCount(response.data.total_count);
1912 + updateEntryCount(response.data.total_count, response.data.count_unit);
1898 1913 }
1899 1914 }
1900 1915 },
1901 1916 error: function(xhr, status, error) {
@@ -1925,13 +1940,16 @@
1925 1940 if ($tbody.find('tr[data-entry-id="' + entry.id + '"]').length > 0) {
1926 1941 return;
1927 1942 }
1928 1943
1929 - const sourceHtml = entry.has_link
1944 + // The Source cell comes from the server (plan b339c0): a link for a
1945 + // web source, the file name for an uploaded file, the muted label
1946 + // for manual content. The old two-way build stays as the fallback.
1947 + const sourceHtml = entry.source_html || (entry.has_link
1930 1948 ? '<a href="' + entry.source_url + '" target="_blank" style="color: var(--mxch-primary); text-decoration: none;"><span class="dashicons dashicons-external" style="font-size: 14px;"></span> View</a>'
1931 - : '<span style="color: var(--mxch-text-muted);">Manual</span>';
1949 + : '<span style="color: var(--mxch-text-muted);">Manual</span>');
1932 1950
1933 - const deleteUrl = mxchatAdmin.admin_url + 'admin-post.php?action=mxchat_delete_prompt&id=' + entry.id + '&_wpnonce=' + entry.delete_nonce;
1951 + const deleteUrl = mxchatAdmin.admin_url + 'admin-post.php?action=mxchat_delete_prompt&id=' + entry.id + '&bot_id=' + encodeURIComponent(mxchatAdmin.bot_id || 'default') + '&_wpnonce=' + entry.delete_nonce;
1934 1952
1935 1953 // Check if content needs expand button (content longer than preview)
1936 1954 const needsExpand = entry.content_length > entry.preview_length;
1937 1955
@@ -2383,5 +2401,17 @@
2383 2401 $chip.find('.mxchat-meta-chip-tick').text('✓ Added');
2384 2402 }
2385 2403 });
2386 2404 })();
2405 +
2406 + // ========================================
2407 + // VIDEO CARDS — threshold follows the master switch (plan f52492)
2408 + // ========================================
2409 + // Presentation only. The server gate does NOT consult the threshold when
2410 + // the switch is off, so hiding the field never changes behavior — it just
2411 + // stops the page offering a number that is currently inert. Mirrors the
2412 + // YouTube import form's own show/hide idiom on this same page. Autosave is
2413 + // untouched: both fields keep their own change handler in mxchat-admin.js.
2414 + $('#mxchat_video_embed_enabled').on('change', function() {
2415 + $('#mxchat-video-embed-threshold-field').toggle($(this).is(':checked'));
2416 + });
2387 2417 });