import React, { useState, useEffect } from 'react'; import { Database, HardDrive, Cpu, CheckCircle2, Server, RefreshCw } from 'lucide-react'; import api from '../api/client'; export default function VectorDbPage() { const [stats, setStats] = useState(null); const [indexes, setIndexes] = useState([]); const [loading, setLoading] = useState(true); const fetchStats = async () => { setLoading(true); try { const statsRes = await api.get('/vectordb/stats'); setStats(statsRes.data); const indexRes = await api.get('/vectordb/indexes'); setIndexes(indexRes.data.indexes || []); } catch (err) { console.error('Vector DB stats error', err); } finally { setLoading(false); } }; useEffect(() => { fetchStats(); }, []); return (
{/* Header */}

Vector Database & Storage Inspector

Monitor Supabase pgvector tables, local BM25 pickle indexes, Redis cache stats, and Vector DB adapters.

{stats && (
{/* Primary Vector DB Card */}
Primary Vector Store CONNECTED
{stats.primary_vector_store}
Vector Dimension: {stats.vector_dimension}D
Embedding Model: {stats.embedding_model}
Metric: {stats.distance_metric}
Total Vectors: {stats.total_vectors}
{/* Local BM25 Index Card */}
Lexical BM25 Index LOCAL DISK
{stats.bm25_indexes.index_count} Pickle Files
Storage Directory: {stats.bm25_indexes.directory}
Total Size: {stats.bm25_indexes.total_size_kb} KB
Algorithm: BM25Okapi ($k_1=1.5, b=0.75$)
{/* Redis Cache Card */}
Cache & Incremental RAG {stats.redis_cache.status}
Sub-50ms Cache
Eviction Policy: {stats.redis_cache.eviction_policy}
Default TTL: {stats.redis_cache.default_ttl_sec}s (24h)
)} {/* Index Files Table */}

Indexed Document Files & Pickle Cache ({indexes.length})

{indexes.length === 0 ? (

[ NO LOCAL INDEXES CREATED YET ]

) : (
{indexes.map((idx, i) => ( ))}
Index File Document ID Size (KB) Status
{idx.filename} {idx.document_id} {idx.size_kb} KB ACTIVE
)}
); }