'use client'; import { getStats } from '@/lib/api'; import { useEffect, useState } from 'react'; import { Brain, FileText, Layers, Tag, Link } from 'lucide-react'; interface Stats { total_documents: number; total_chunks: number; total_relations: number; total_tags: number; last_indexed: string | null; embedding_model: string; chat_model: string; } export default function HomePage() { const [stats, setStats] = useState(null); useEffect(() => { getStats().then(setStats).catch(console.error); }, []); const cards = stats ? [ { label: 'Documents', value: stats.total_documents, icon: FileText, color: 'text-blue-600' }, { label: 'Chunks', value: stats.total_chunks, icon: Layers, color: 'text-purple-600' }, { label: 'Links', value: stats.total_relations, icon: Link, color: 'text-green-600' }, { label: 'Tags', value: stats.total_tags, icon: Tag, color: 'text-orange-600' }, ] : []; return (

Second Brain

Your AI-powered knowledge base

{stats && ( <>
{cards.map((card) => (

{card.value.toLocaleString()}

{card.label}

))}

Embedding model: {stats.embedding_model}

Chat model: {stats.chat_model}

{stats.last_indexed && (

Last indexed: {new Date(stats.last_indexed).toLocaleString()}

)}
)} {!stats && (
Loading stats...
)}
); }