"use client" /** * Knowledge Base Settings - Admin Page * * WeKnora-style knowledge base management for admins */ import { useState } from "react" import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card" import { Button } from "@/components/ui/button" import { Badge } from "@/components/ui/badge" import { Input } from "@/components/ui/input" import { Label } from "@/components/ui/label" import { Textarea } from "@/components/ui/textarea" import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "@/components/ui/table" import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, } from "@/components/ui/dialog" import { Database, Plus, Upload, RefreshCw, Trash2, Edit, FileText, Scale, Newspaper, CheckCircle, XCircle, Clock, Settings, Search } from "lucide-react" interface KnowledgeBase { id: string name: string description: string type: 'legal' | 'news' | 'general' | 'custom' documentCount: number lastUpdated: string status: 'active' | 'indexing' | 'error' chunkSize: number embeddingModel: string } const MOCK_KNOWLEDGE_BASES: KnowledgeBase[] = [ { id: "kenya_law", name: "Kenya Law", description: "Constitution, Acts, Bills, Case Law from Kenya Law Reports", type: "legal", documentCount: 5420, lastUpdated: "2025-12-14T10:30:00Z", status: "active", chunkSize: 512, embeddingModel: "text-embedding-3-small" }, { id: "kenya_news", name: "Kenya News", description: "Current affairs from major Kenyan news outlets", type: "news", documentCount: 12350, lastUpdated: "2025-12-15T08:00:00Z", status: "active", chunkSize: 256, embeddingModel: "text-embedding-3-small" }, { id: "parliament", name: "Parliament Records", description: "Bills, Hansard, Committee Reports", type: "legal", documentCount: 2100, lastUpdated: "2025-12-13T14:20:00Z", status: "indexing", chunkSize: 512, embeddingModel: "text-embedding-3-small" } ] export default function KnowledgeBaseSettingsPage() { const [knowledgeBases, setKnowledgeBases] = useState(MOCK_KNOWLEDGE_BASES) const [selectedKB, setSelectedKB] = useState(null) const [isCreating, setIsCreating] = useState(false) const getTypeIcon = (type: string) => { switch (type) { case 'legal': return case 'news': return default: return } } const getStatusBadge = (status: string) => { switch (status) { case 'active': return Active case 'indexing': return Indexing case 'error': return Error default: return {status} } } return (

Knowledge Base Management

Manage your document collections and search indices

Create Knowledge Base Create a new knowledge base for document retrieval