From 7b998276ffb2a2f435644a65b4f5e616c2356974 Mon Sep 17 00:00:00 2001 From: Damo Date: Sun, 14 Dec 2025 20:29:27 +0800 Subject: [PATCH 1/2] chunk conditions and group buttons fixes --- ui/chunk-visualizer.js | 54 +++++++++++++++++++++++++++++++++--------- 1 file changed, 43 insertions(+), 11 deletions(-) diff --git a/ui/chunk-visualizer.js b/ui/chunk-visualizer.js index 750120b..e546fe0 100644 --- a/ui/chunk-visualizer.js +++ b/ui/chunk-visualizer.js @@ -145,6 +145,15 @@ function updateChunkData(hash, updates) { const existing = pendingChanges.get(hash) || {}; pendingChanges.set(hash, { ...existing, ...updates }); hasUnsavedChanges = true; + // refresh the chunk data + allChunks.forEach(chunk => { + if (chunk.hash === hash) { + // merge pending changes into the chunk for fresh data if chunks end up with same hash somehow. + const stored = getChunkMetadata(hash) || {}; + const pending = pendingChanges.get(hash) || {}; + chunk.data = { ...chunk.data, ...pending }; + } + }); } async function saveAllChanges() { @@ -856,7 +865,7 @@ function renderGroupsTab() { ${stats.exclusiveGroups} exclusive` : '' ); - + bindGroupsTabEvents(); if (groups.length === 0) { container.html(`
@@ -877,9 +886,7 @@ function renderGroupsTab() {
Select a group to view details
`); - - renderGroupList(); - bindGroupsTabEvents(); + renderGroupList(); } /** @@ -1088,11 +1095,11 @@ function openAddMemberDialog() { }); // Click to add - $(document).on('click.addmember', '.vecthare-member-option', function() { + overlay.on('click', '.vecthare-member-option', function (e) { + e.stopPropagation(); // Prevent overlay close const hash = $(this).data('hash'); addMemberToGroup(String(hash)); overlay.remove(); - $(document).off('click.addmember'); }); } @@ -1568,13 +1575,38 @@ function renderDetailPanel() { function formatConditionRule(rule) { if (!rule || !rule.type) return 'Unknown condition'; + const negation = rule.negated ? 'NOT ' : ''; + const value = rule.settings?.value || rule.value || ''; // Support both formats + switch (rule.type) { - case 'messageCount': return `${negation}messageCount ${rule.operator || '>='} ${rule.value}`; - case 'emotion': return `${negation}emotion: ${rule.value}`; - case 'isGroupChat': return `${negation}isGroupChat`; - case 'speaker': return `${negation}speaker: ${rule.value}`; - default: return `${negation}${rule.type}: ${rule.value || ''}`; + case 'pattern': + return `${negation}Pattern: "${value}"`; + case 'speaker': + return `${negation}Speaker: ${value || 'undefined'}`; + case 'messageCount': + // Extract operator and number if value is like ">=100" or just "100" + const match = value.match(/^([><=!]+)?(\d+)$/); + if (match) { + const operator = match[1] || '>='; + const count = match[2]; + return `${negation}Message Count ${operator} ${count}`; + } + return `${negation}Message Count: ${value}`; + case 'emotion': + return `${negation}Emotion: ${value}`; + case 'isGroupChat': + return `${negation}Is Group Chat`; + case 'timeOfDay': + // Handle different time formats + if (!value) return `${negation}Time of Day: (no time set)`; + return `${negation}Time of Day: ${value}`; + case 'randomChance': + // Value should be a percentage + const percent = value || rule.settings?.percent || '50'; + return `${negation}Random Chance: ${percent}%`; + default: + return `${negation}${rule.type}: ${value || '(empty)'}`; } } From 24e68b5eb56b64894e2a16451e5d2b156f4f811a Mon Sep 17 00:00:00 2001 From: Damo Date: Wed, 17 Dec 2025 19:08:31 +0800 Subject: [PATCH 2/2] added a fix to allow Qdrant to use queryVector or searchText, depending on backend requirements --- backends/qdrant.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/backends/qdrant.js b/backends/qdrant.js index 218a145..d987883 100644 --- a/backends/qdrant.js +++ b/backends/qdrant.js @@ -384,6 +384,16 @@ export class QdrantBackend extends VectorBackend { model: getModelFromSettings(settings), }; + //Use queryVector if provided, otherwise searchText + if (queryVector) { + body.queryVector = queryVector; + } else if (searchText?.trim()) { + body.searchText = searchText; + } else { + console.warn('[Qdrant] No queryVector or searchText provided'); + return { hashes: [], metadata: [] }; + } + // Add content_type filter for multitenancy mode if (settings.qdrant_multitenancy) { body.filter = { @@ -436,6 +446,18 @@ export class QdrantBackend extends VectorBackend { model: getModelFromSettings(settings), }; + + // Use queryVector if provided, otherwise searchText + if (queryVector) { + body.queryVector = queryVector; + } else if (searchText?.trim()) { + body.searchText = searchText; + } else { + console.warn(`[Qdrant] No queryVector or searchText for ${collectionId}`); + results[collectionId] = { hashes: [], metadata: [] }; + continue; + } + // Add content_type filter for multitenancy mode if (settings.qdrant_multitenancy) { body.filter = {