From 3c39506b06af6ae657c688b88aeba305d96f6c9b Mon Sep 17 00:00:00 2001 From: Santosh Bhavani Date: Sat, 25 Oct 2025 14:10:37 -0700 Subject: [PATCH] Fix query mode grouping in performance metrics MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add queryMode field to QueryLogSummary interface - Update getQueryLogs to group by both query AND queryMode - Use composite key (query|||queryMode) for proper separation - Enables separate tracking of Pure RAG vs Graph Search queries Previously, queries with the same text but different modes were merged together, causing metrics to only show one aggregate value. Now each mode's performance is tracked independently. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- nvidia/txt2kg/assets/frontend/lib/query-logger.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/nvidia/txt2kg/assets/frontend/lib/query-logger.ts b/nvidia/txt2kg/assets/frontend/lib/query-logger.ts index bc308d9..7957913 100644 --- a/nvidia/txt2kg/assets/frontend/lib/query-logger.ts +++ b/nvidia/txt2kg/assets/frontend/lib/query-logger.ts @@ -17,6 +17,7 @@ export interface QueryLogEntry { export interface QueryLogSummary { query: string; + queryMode: 'traditional' | 'vector-search' | 'pure-rag'; count: number; firstQueried: string; lastQueried: string; @@ -148,9 +149,10 @@ export class QueryLoggerService { return []; } - // Group logs by query + // Group logs by query AND queryMode const querySummaries = new Map(); logs.forEach(entry => { - const existing = querySummaries.get(entry.query) || { + // Use composite key: query + mode + const key = `${entry.query}|||${entry.queryMode}`; + const existing = querySummaries.get(key) || { query: entry.query, + queryMode: entry.queryMode, count: 0, timestamps: [], executionTimes: [], @@ -180,12 +185,13 @@ export class QueryLoggerService { if (entry.metrics.recall !== undefined) existing.recalls.push(entry.metrics.recall); existing.resultCounts.push(entry.metrics.resultCount); - querySummaries.set(entry.query, existing); + querySummaries.set(key, existing); }); // Convert to array and format const result: QueryLogSummary[] = Array.from(querySummaries.values()).map(summary => ({ query: summary.query, + queryMode: summary.queryMode, count: summary.count, firstQueried: summary.timestamps[0], lastQueried: summary.timestamps[summary.timestamps.length - 1],