Skip to content

Commit 5c2a9ce

Browse files
author
napan.vijayvargiya
committed
added oxford views page
1 parent ebf32c7 commit 5c2a9ce

19 files changed

Lines changed: 3540 additions & 0 deletions

File tree

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
-- CreateTable
2+
CREATE TABLE "oxford_views" (
3+
"id" TEXT NOT NULL,
4+
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
5+
"updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
6+
"project_id" TEXT NOT NULL,
7+
"created_by" TEXT NOT NULL,
8+
"prompt" JSONB NOT NULL,
9+
"name" TEXT NOT NULL,
10+
"version" INTEGER NOT NULL,
11+
"type" TEXT NOT NULL DEFAULT 'text',
12+
"config" JSON NOT NULL DEFAULT '{}',
13+
"tags" TEXT[] DEFAULT ARRAY[]::TEXT[],
14+
"labels" TEXT[] DEFAULT ARRAY[]::TEXT[],
15+
"commit_message" TEXT,
16+
17+
CONSTRAINT "oxford_views_pkey" PRIMARY KEY ("id")
18+
);
19+
20+
-- CreateIndex
21+
CREATE UNIQUE INDEX "oxford_views_project_id_name_version_key" ON "oxford_views"("project_id", "name", "version");
22+
23+
-- CreateIndex
24+
CREATE INDEX "oxford_views_project_id_id_idx" ON "oxford_views"("project_id", "id");
25+
26+
-- CreateIndex
27+
CREATE INDEX "oxford_views_created_at_idx" ON "oxford_views"("created_at");
28+
29+
-- CreateIndex
30+
CREATE INDEX "oxford_views_updated_at_idx" ON "oxford_views"("updated_at");
31+
32+
-- CreateIndex
33+
CREATE INDEX "oxford_views_tags_idx" ON "oxford_views" USING GIN ("tags");
34+
35+
-- AddForeignKey
36+
ALTER TABLE "oxford_views" ADD CONSTRAINT "oxford_views_project_id_fkey" FOREIGN KEY ("project_id") REFERENCES "projects"("id") ON DELETE CASCADE ON UPDATE CASCADE;

packages/shared/prisma/schema.prisma

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ model Project {
130130
invitations MembershipInvitation[]
131131
sessions TraceSession[]
132132
Prompt Prompt[]
133+
OxfordView OxfordView[]
133134
Model Model[]
134135
EvalTemplate EvalTemplate[]
135136
JobConfiguration JobConfiguration[]
@@ -816,6 +817,33 @@ model PromptProtectedLabels {
816817
@@map("prompt_protected_labels")
817818
}
818819

820+
model OxfordView {
821+
id String @id @default(cuid())
822+
createdAt DateTime @default(now()) @map("created_at")
823+
updatedAt DateTime @default(now()) @updatedAt @map("updated_at")
824+
825+
projectId String @map("project_id")
826+
project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
827+
828+
createdBy String @map("created_by")
829+
830+
prompt Json
831+
name String
832+
version Int
833+
type String @default("text")
834+
config Json @default("{}") @db.Json
835+
tags String[] @default([])
836+
labels String[] @default([])
837+
commitMessage String? @map("commit_message")
838+
839+
@@unique([projectId, name, version])
840+
@@index([projectId, id])
841+
@@index([createdAt])
842+
@@index([updatedAt])
843+
@@index([tags(ops: ArrayOps)], type: Gin)
844+
@@map("oxford_views")
845+
}
846+
819847
// Update ObservationView below when making changes to this model!
820848
model Model {
821849
id String @id @default(cuid())

web/src/components/layouts/routes.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,15 @@ export const ROUTES: Route[] = [
132132
group: RouteGroup.PromptManagement,
133133
section: RouteSection.Main,
134134
},
135+
{
136+
title: "Oxford Views",
137+
pathname: "/project/[projectId]/oxford-views",
138+
icon: FileJson,
139+
projectRbacScopes: ["prompts:read"],
140+
productModule: "prompt-management",
141+
group: RouteGroup.PromptManagement,
142+
section: RouteSection.Main,
143+
},
135144
{
136145
title: "Playground",
137146
pathname: "/project/[projectId]/playground",

0 commit comments

Comments
 (0)