import { Fragment, useState } from "react"; import { CheckCircle2, Edit3, Save, Sparkles } from "lucide-react"; import { toast } from "sonner"; import { Button } from "~/components/ui/button"; import { Card, CardAction, CardContent, CardDescription, CardHeader, CardTitle } from "~/components/ui/card"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "~/components/ui/table"; import { Textarea } from "~/components/ui/textarea"; import { FilterSelect, OperationsPageHeader } from "./OperationsUi"; import { PROMPTS, PROMPT_REGRESSION, PROMPT_VERSIONS, type PromptKey } from "./governanceData"; import { useCanOperationsAction } from "./operationsRole"; function PromptPreview({ text }: { text: string }) { const parts = text.split(/(\{\{[^}]+\}\})/g); return
{parts.map((part, index) => part.startsWith("{{") ? {part} : {part} )};
}
export default function PromptManagementPage() {
const canEdit = useCanOperationsAction("prompts:manage");
const canRegression = useCanOperationsAction("prompts:regression");
const [promptKey, setPromptKey] = useState