File size: 3,713 Bytes
6e1a53e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
import { Separator } from "@/components/ui/separator";
import { Table, TableBody, TableCell, TableRow } from "@/components/ui/table";
import Link from "next/link";
import { PlusIcon, Pencil1Icon } from "@radix-ui/react-icons";
interface Row {
link: string;
text: string;
addLink: string;
changeLink: string;
}
interface SectionProps {
title: string;
description: string;
rows: Row[];
}
const Section: React.FC<SectionProps> = ({ title, description, rows }) => (
<div className="md:p-4 flex flex-col">
<div className="space-y-4">
<h3 className="text-xl font-semibold tracking-tight">{title}</h3>
</div>
<h3 className="text-sm text-muted-foreground">{description}</h3>
<Separator className="mt-2" />
<Table>
<TableBody>
{rows.map((row, index) => (
<TableRow key={index} className="flex">
<TableCell className="flex-grow font-sm underline underline-offset-2 pl-0">
<Link href={row.link}>{row.text}</Link>
</TableCell>
{row.addLink && (
<TableCell>
<Link
className="flex flex-row items-center justify-start"
href={row.addLink}
>
<PlusIcon className="text-green-400 mr-1" />
Add
</Link>
</TableCell>
)}
{row.changeLink && (
<TableCell>
<Link
className="flex flex-row items-center justify-start"
href={row.changeLink}
>
<Pencil1Icon className="text-yellow-500 mr-1" />
Change
</Link>
</TableCell>
)}
</TableRow>
))}
</TableBody>
</Table>
</div>
);
export default function Page() {
const sections = [
{
title: "Data",
description: "List, add, and change data sources.",
rows: [
{
link: "/admin/data",
text: "Data sources",
addLink: "/admin/data/add",
changeLink: "/admin/data",
},
],
},
{
title: "Vector store and embeddings",
description:
"List, add, and change vector store collections and embeddings.",
rows: [
{
link: "/admin/collections",
text: "Collections",
addLink: "/admin/data/add",
changeLink: "/admin/collections",
},
],
},
{
title: "Chat history",
description: "Manage chat history.",
rows: [
// {
// link: '/admin/users',
// text: 'Users',
// addLink: '/admin/users/add',
// changeLink: '/admin/users',
// },
{
link: "/admin/chat-history",
text: "Chat history",
changeLink: "/admin/chat-history",
},
],
},
// {
// title: 'UI settings',
// description: 'Configure what is shown in the UI to end users',
// rows: [
// {
// link: '/admin/ui-settings',
// text: 'UI settings',
// addLink: '/admin/ui-settings/add',
// changeLink: '/admin/ui-settings',
// },
// ],
// },
];
return (
<div className="mt-20 flex justify-center items-stretch">
<div className="max-w-screen-lg w-full bg-background">
<div className="md:p-4 flex flex-col">
<h1 className="text-4xl font-semibold tracking-tight">
Manage your RAG Apps
</h1>
</div>
{sections.map((section, index) => (
<Section key={index} {...section} />
))}
</div>
</div>
);
}
|