diff --git a/nvidia/txt2kg/assets/frontend/app/rag/page.tsx b/nvidia/txt2kg/assets/frontend/app/rag/page.tsx index c5226a6..1806ba8 100644 --- a/nvidia/txt2kg/assets/frontend/app/rag/page.tsx +++ b/nvidia/txt2kg/assets/frontend/app/rag/page.tsx @@ -235,11 +235,18 @@ export default function RagPage() { } const data = await response.json(); - - // Log the retrieved triples for debugging - console.log('📊 Retrieved Triples:', data.triples); - console.log('🤖 LLM-Generated Answer:', data.answer); + + // Log sample of retrieved triples for debugging + console.log('📊 Retrieved Triples (sample):', data.triples.slice(0, 3)); + console.log('🤖 LLM-Generated Answer (preview):', data.answer?.substring(0, 200) + '...'); console.log('📈 Triple Count:', data.count); + + // DEBUG: Check if depth/pathLength are present in received data + if (data.triples && data.triples.length > 0) { + console.log('🔍 First triple structure:', JSON.stringify(data.triples[0], null, 2)); + console.log('🔍 Has depth?', 'depth' in data.triples[0]); + console.log('🔍 Has pathLength?', 'pathLength' in data.triples[0]); + } // Update the results with the triples (for display) setResults(data.triples || []); @@ -247,18 +254,11 @@ export default function RagPage() { relevanceScore = 0; // No relevance score for traditional search // Store the LLM answer for display - console.log('🔍 Checking answer:', { - hasAnswer: !!data.answer, - answerLength: data.answer?.length, - answerPreview: data.answer?.substring(0, 100) - }); - if (data.answer) { - console.log('💬 Full Answer:', data.answer); - console.log('✅ Setting llmAnswer state'); + console.log('✅ Setting llmAnswer state (length:', data.answer.length, 'chars)'); setLlmAnswer(data.answer); } else { - console.log('⚠️ No answer in response, setting null'); + console.log('⚠️ No answer in response'); setLlmAnswer(null); } @@ -438,9 +438,9 @@ export default function RagPage() { return ( <> {thinkContent && ( -
+
- + Reasoning Process @@ -477,6 +477,14 @@ export default function RagPage() {

{llmAnswer ? `Retrieved Knowledge (${results.length})` : `Results (${results.length})`}

+ {results.some((r: any) => r.pathLength && r.pathLength > 1) && ( + + + + + Multi-hop enabled + + )}
{results.map((triple, index) => ( @@ -509,8 +517,33 @@ export default function RagPage() {
)} {triple.confidence && !currentParams.usePureRag && ( -
- Confidence: {(triple.confidence * 100).toFixed(1)}% +
+
+
+ + Confidence: {(triple.confidence * 100).toFixed(1)}% + +
+ {triple.depth !== undefined && ( +
+ + + + + Hop: {triple.depth} + +
+ )} + {triple.pathLength !== undefined && triple.pathLength > 1 && ( +
+ + + + + Multi-hop path (length: {triple.pathLength}) + +
+ )}
)}