From eb1daa60f4b671e2be6bde1c6ac40f2db00aee82 Mon Sep 17 00:00:00 2001 From: Aljaz Ceru Date: Mon, 25 Aug 2025 17:18:34 +0200 Subject: [PATCH] fixing storage nan for rag --- frontend/src/app/rag/page.tsx | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/frontend/src/app/rag/page.tsx b/frontend/src/app/rag/page.tsx index 836fe3d..97e682e 100644 --- a/frontend/src/app/rag/page.tsx +++ b/frontend/src/app/rag/page.tsx @@ -31,10 +31,22 @@ interface Collection { } interface CollectionStats { - total_collections: number - total_documents: number - total_size: number - active_collections: number + collections: { + total: number + active: number + } + documents: { + total: number + processing: number + processed: number + } + storage: { + total_size_bytes: number + total_size_mb: number + } + vectors: { + total: number + } } export default function RAGPage() { @@ -117,8 +129,8 @@ function RAGPageContent() { ) } - const formatBytes = (bytes: number) => { - if (bytes === 0) return '0 Bytes' + const formatBytes = (bytes: number | null | undefined) => { + if (!bytes || bytes === 0) return '0 Bytes' const k = 1024 const sizes = ['Bytes', 'KB', 'MB', 'GB'] const i = Math.floor(Math.log(bytes) / Math.log(k)) @@ -145,9 +157,9 @@ function RAGPageContent() { -
{stats.total_collections}
+
{stats.collections.total}

- {stats.active_collections} active + {stats.collections.active} active

@@ -157,7 +169,7 @@ function RAGPageContent() { -
{stats.total_documents}
+
{stats.documents.total}

Across all collections

@@ -169,7 +181,7 @@ function RAGPageContent() { -
{formatBytes(stats.total_size)}
+
{formatBytes(stats.storage.total_size_bytes)}

Total indexed content