diff --git a/app/(protected)/project/[project_id]/annotations/annotations.tsx b/app/(protected)/project/[project_id]/annotations/annotations.tsx index 9716a3bf..d89445dd 100644 --- a/app/(protected)/project/[project_id]/annotations/annotations.tsx +++ b/app/(protected)/project/[project_id]/annotations/annotations.tsx @@ -181,15 +181,17 @@ export default function Annotations({ email }: { email: string }) { const spanId = row.original.span_id; const prompts = row.getValue("input") as string[]; const responses = row.getValue("output") as string[]; + const model = row.getValue("model") as string; let input = ""; if (prompts && prompts.length > 0) { // get last item in prompts const lastItem = prompts[prompts.length - 1]; + const parsedLastItem = JSON.parse(lastItem); input = - JSON.parse(lastItem)[0]?.content || - JSON.parse(lastItem)[0]?.message?.content || - JSON.parse(lastItem)[0]?.text; + parsedLastItem[parsedLastItem.length - 1]?.content || + parsedLastItem[parsedLastItem.length - 1]?.message?.content || + parsedLastItem[parsedLastItem.length - 1]?.text; // check if input is not a string if (typeof input !== "string") { @@ -201,10 +203,11 @@ export default function Annotations({ email }: { email: string }) { if (responses && responses.length > 0) { // get last item in responses const lastItem = responses[responses.length - 1]; + const parsedLastItem = JSON.parse(lastItem); output = - JSON.parse(lastItem)[0]?.message?.content || - JSON.parse(lastItem)[0]?.text || - JSON.parse(lastItem)[0]?.content; + parsedLastItem[parsedLastItem.length - 1]?.message?.content || + parsedLastItem[parsedLastItem.length - 1]?.text || + parsedLastItem[parsedLastItem.length - 1]?.content; // check if output is not a string if (typeof output !== "string") { @@ -221,9 +224,10 @@ export default function Annotations({ email }: { email: string }) { spanId, input, output, + model, }; if (checked) { - setSelectedData([...selectedData, checkedData]); + setSelectedData((prev) => [...prev, checkedData]); } else { setSelectedData( selectedData.filter((d) => d.spanId !== spanId) diff --git a/app/(protected)/project/[project_id]/datasets/dataset/[dataset_id]/page.tsx b/app/(protected)/project/[project_id]/datasets/dataset/[dataset_id]/page.tsx index a34a88cd..7112eaf5 100644 --- a/app/(protected)/project/[project_id]/datasets/dataset/[dataset_id]/page.tsx +++ b/app/(protected)/project/[project_id]/datasets/dataset/[dataset_id]/page.tsx @@ -1,22 +1,51 @@ "use client"; +import { ExpandingTextArea } from "@/components/playground/common"; import { CreateData } from "@/components/project/dataset/create-data"; import DatasetRowSkeleton from "@/components/project/dataset/dataset-row-skeleton"; -import { EditData } from "@/components/project/dataset/edit-data"; +import { DeleteData } from "@/components/project/dataset/delete-data"; import { DownloadDataset } from "@/components/shared/download-dataset"; -import { Spinner } from "@/components/shared/spinner"; +import RowSkeleton from "@/components/shared/row-skeleton"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; +import { + DropdownMenu, + DropdownMenuCheckboxItem, + DropdownMenuContent, + DropdownMenuTrigger, +} from "@/components/ui/dropdown-menu"; import { Separator } from "@/components/ui/separator"; +import { + Table, + TableBody, + TableCell, + TableHead, + TableHeader, + TableRow, +} from "@/components/ui/table"; import { EVALUATIONS_DOCS_URL, PAGE_SIZE } from "@/lib/constants"; +import { cn } from "@/lib/utils"; import { Data } from "@prisma/client"; -import { ArrowTopRightIcon } from "@radix-ui/react-icons"; -import { ChevronLeft, FlaskConical } from "lucide-react"; +import { ArrowTopRightIcon, ResetIcon } from "@radix-ui/react-icons"; +import { + ColumnDef, + flexRender, + getCoreRowModel, + useReactTable, + VisibilityState, +} from "@tanstack/react-table"; +import { + ChevronDown, + ChevronLeft, + FlaskConical, + MoveDiagonal, + X, +} from "lucide-react"; import Link from "next/link"; import { useParams } from "next/navigation"; -import { useState } from "react"; +import { useEffect, useMemo, useRef, useState } from "react"; import { useBottomScrollListener } from "react-bottom-scroll-listener"; -import { useQuery } from "react-query"; +import { useQuery, useQueryClient } from "react-query"; import { toast } from "sonner"; export default function Dataset() { @@ -24,18 +53,42 @@ export default function Dataset() { const dataset_id = useParams()?.dataset_id as string; const [page, setPage] = useState(1); const [totalPages, setTotalPages] = useState(1); - const [showLoader, setShowLoader] = useState(false); + const [showBottomLoader, setShowBottomLoader] = useState(false); const [currentData, setCurrentData] = useState([]); + const [tableState, setTableState] = useState({ + pagination: { + pageIndex: 0, + pageSize: 100, + }, + }); + const [columnVisibility, setColumnVisibility] = useState({}); + const [openDropdown, setOpenDropdown] = useState(false); - useBottomScrollListener(() => { - if (fetchDataset.isRefetching) { - return; - } - if (page <= totalPages) { - setShowLoader(true); - fetchDataset.refetch(); + useEffect(() => { + if (typeof window !== "undefined") { + try { + const storedState = window.localStorage.getItem( + "preferences.dataset.table-view" + ); + if (storedState) { + const parsedState = JSON.parse(storedState); + setTableState((prevState: any) => ({ + ...prevState, + ...parsedState, + pagination: { + ...prevState.pagination, + ...parsedState.pagination, + }, + })); + if (parsedState.columnVisibility) { + setColumnVisibility(parsedState.columnVisibility); + } + } + } catch (error) { + console.error("Error parsing stored table state:", error); + } } - }); + }, []); const fetchDataset = useQuery({ queryKey: [dataset_id], @@ -63,29 +116,269 @@ export default function Dataset() { // Merge the new data with the existing data if (currentData.length > 0) { - const updatedData = [...currentData, ...newData]; + const uniqueData = [ + ...currentData.filter( + (item) => !newData.some((existing) => existing.id === item.id) + ), + ...newData, + ]; - // Remove duplicates - const uniqueData = updatedData.filter( - (v: any, i: number, a: any) => - a.findIndex((t: any) => t.id === v.id) === i + // sort new data by created_at + uniqueData.sort( + (a: Data, b: Data) => + new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime() ); setCurrentData(uniqueData); } else { + // sort new data by created_at + newData.sort( + (a: Data, b: Data) => + new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime() + ); setCurrentData(newData); } - setShowLoader(false); + + setShowBottomLoader(false); }, onError: (error) => { - setShowLoader(false); + setShowBottomLoader(false); toast.error("Failed to fetch dataset", { description: error instanceof Error ? error.message : String(error), }); }, }); - if (fetchDataset.isLoading || !fetchDataset.data || !currentData) { + const scrollableDivRef = useBottomScrollListener(() => { + if (fetchDataset.isRefetching) { + return; + } + if (page <= totalPages) { + setShowBottomLoader(true); + fetchDataset.refetch(); + } + }); + + const DataComponent = ({ + label, + value, + id, + editable = false, + }: { + label: string; + value: string; + id?: string; + editable?: boolean; + }) => { + const [expandedView, setExpandedView] = useState(false); + const [editMode, setEditMode] = useState(false); + const [changedValue, setChangedValue] = useState(value); + const saveButtonRef = useRef(null); + const queryClient = useQueryClient(); + return ( +
+ {!editMode && !expandedView && value && ( + { + e.stopPropagation(); + setExpandedView(!expandedView); + }} + /> + )} + {!editMode && expandedView && value && ( + { + e.stopPropagation(); + setExpandedView(!expandedView); + }} + /> + )} + {editable && editMode && ( + { + setChangedValue(value); + }} + value={changedValue} + setFocusing={setEditMode} + saveButtonRef={saveButtonRef} + saveButtonLabel="Save" + handleSave={async () => { + try { + await fetch("/api/data", { + method: "PUT", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + id: id, + [label]: changedValue, + }), + }); + await queryClient.invalidateQueries({ queryKey: [dataset_id] }); + toast("Data saved!", { + description: "Your data has been saved.", + }); + } catch (error: any) { + toast("Error saving your dataset!", { + description: `There was an error saving your dataset: ${error.message}`, + }); + } finally { + setEditMode(false); + } + }} + /> + )} + {(!editable || !editMode) && ( +

editable && setEditMode(true)} + className={cn( + expandedView ? "" : "h-20", + "text-sm overflow-y-scroll" + )} + > + {value} +

+ )} +
+ ); + }; + + const columns: ColumnDef[] = [ + { + accessorKey: "id", + header: "ID", + cell: ({ row }) => { + return ( +

+ {row.getValue("id")} +

+ ); + }, + }, + { + size: 500, + accessorKey: "input", + enableResizing: true, + header: "Input", + cell: ({ row }) => { + const input = row.getValue("input") as string; + return ; + }, + }, + { + size: 500, + accessorKey: "output", + enableResizing: true, + header: "Output", + cell: ({ row }) => { + const output = row.getValue("output") as string; + return ; + }, + }, + { + size: 500, + accessorKey: "expectedOutput", + enableResizing: true, + header: "Expected Output", + cell: ({ row }) => { + const expectedOutput = row.getValue("expectedOutput") as string; + const id = row.getValue("id") as string; + return ( + + ); + }, + }, + { + size: 100, + accessorKey: "model", + enableResizing: true, + header: "Model", + cell: ({ row }) => { + const model = row.getValue("model") as string; + return

{model}

; + }, + }, + { + size: 300, + accessorKey: "note", + enableResizing: true, + header: "Note", + cell: ({ row }) => { + const note = row.getValue("note") as string; + const id = row.getValue("id") as string; + return ( + + ); + }, + }, + { + size: 50, + accessorKey: "delete", + enableResizing: true, + header: "Delete", + cell: ({ row }) => { + return ; + }, + }, + ]; + + const table = useReactTable({ + data: currentData, + columns, + getCoreRowModel: getCoreRowModel(), + initialState: { + ...tableState, + pagination: tableState.pagination, + columnVisibility, + }, + state: { + ...tableState, + pagination: tableState.pagination, + columnVisibility, + }, + onStateChange: (newState: any) => { + setTableState((prevState: any) => ({ + ...newState, + pagination: newState.pagination || prevState.pagination, + })); + const currState = table.getState(); + localStorage.setItem( + "preferences.dataset.table-view", + JSON.stringify(currState) + ); + }, + onColumnVisibilityChange: (newVisibility) => { + setColumnVisibility(newVisibility); + const currState = table.getState(); + localStorage.setItem( + "preferences.dataset.table-view", + JSON.stringify(currState) + ); + }, + enableColumnResizing: true, + columnResizeMode: "onChange", + manualPagination: true, // Add this if you're handling pagination yourself + }); + + const columnSizeVars = useMemo(() => { + const headers = table.getFlatHeaders(); + const colSizes: { [key: string]: number } = {}; + for (let i = 0; i < headers.length; i++) { + const header = headers[i]!; + colSizes[`--header-${header.id}-size`] = header.getSize(); + colSizes[`--col-${header.column.id}-size`] = header.column.getSize(); + } + return colSizes; + }, [table.getState().columnSizingInfo, table.getState().columnSizing]); + + if (fetchDataset.isLoading || !fetchDataset.data) { return ; } else { return ( @@ -114,51 +407,123 @@ export default function Dataset() { + + + + + + {table + .getAllColumns() + .filter((column) => column.getCanHide()) + .map((column) => { + return ( + setOpenDropdown(true)} + onCheckedChange={(value) => + column.toggleVisibility(!!value) + } + > + {column.columnDef.header?.toString()} + + ); + })} + + + -
-
-

Created at

-

Input

-

Output

-

Note

-
- {fetchDataset.isLoading && currentData?.length === 0 && ( -
+
+ {!fetchDataset.isLoading && currentData.length === 0 && ( +

No data found in this dataset

)} {!fetchDataset.isLoading && - currentData.length > 0 && - currentData.map((data: any, i: number) => { - return ( -
-
-

{data.createdAt}

-

- {data.input} -

-

- {data.output} -

-

{data.note}

-
- -
-
- -
- ); - })} - {showLoader && ( -
- + currentData && + currentData?.length > 0 && ( + + + {table.getHeaderGroups().map((headerGroup) => ( + + {headerGroup.headers.map((header) => ( + + {header.isPlaceholder + ? null + : flexRender( + header.column.columnDef.header, + header.getContext() + )} +
header.column.resetSize()} + onMouseDown={header.getResizeHandler()} + onTouchStart={header.getResizeHandler()} + className={`bg-muted-foreground resizer ${ + header.column.getIsResizing() ? "isResizing" : "" + }`} + /> + + ))} + + ))} + + + {table.getRowModel().rows.map((row) => ( + + {row.getVisibleCells().map((cell) => ( + + {flexRender( + cell.column.columnDef.cell, + cell.getContext() + )} + + ))} + + ))} + +
+ )} + {showBottomLoader && ( +
+ + {Array.from({ length: 2 }).map((_, index) => ( + + ))}
)}
@@ -183,12 +548,13 @@ function PageSkeleton() {
-

Created at

Input

Output

+

Expected Output

+

Model

Note

- {Array.from({ length: 5 }).map((_, index) => ( + {Array.from({ length: 6 }).map((_, index) => ( ))}
diff --git a/app/api/data/route.ts b/app/api/data/route.ts index 721aba11..6130cb6d 100644 --- a/app/api/data/route.ts +++ b/app/api/data/route.ts @@ -88,12 +88,12 @@ export async function POST(req: NextRequest) { const payload = datas.map((data: Data) => { const d: any = { - input: data.input, - output: data.output, - contexts: data.contexts || [], - annotatedOutput: data.annotatedOutput || "", - note: data.note || "", spanId: data.spanId || "", + input: data.input || "", + output: data.output || "", + expectedOutput: data.expectedOutput || "", + model: data.model || "", + note: data.note || "", projectId: projectId || "", datasetId: datasetId || "", }; @@ -106,6 +106,7 @@ export async function POST(req: NextRequest) { const result = await prisma.data.createMany({ data: payload, + skipDuplicates: true, }); return NextResponse.json({ @@ -129,7 +130,7 @@ export async function PUT(req: NextRequest) { } const data = await req.json(); - const { id, input, output, annotatedOutput, contexts, note } = data; + const { id, input, output, expectedOutput, model, note } = data; const result = await prisma.data.update({ where: { @@ -138,8 +139,8 @@ export async function PUT(req: NextRequest) { data: { input, output, - annotatedOutput, - contexts, + expectedOutput, + model, note, }, }); diff --git a/app/api/dataset/download/route.ts b/app/api/dataset/download/route.ts index b26f0968..343b0140 100644 --- a/app/api/dataset/download/route.ts +++ b/app/api/dataset/download/route.ts @@ -92,7 +92,9 @@ export async function GET(req: NextRequest) { result.push({ input: d.input, target: d.output, - annotated_output: d.annotatedOutput, + expected_output: d.expectedOutput, + model: d.model, + note: d.note, }); }); diff --git a/app/api/metrics/score/route.ts b/app/api/metrics/score/route.ts index 0d9f0210..b427df0c 100644 --- a/app/api/metrics/score/route.ts +++ b/app/api/metrics/score/route.ts @@ -95,7 +95,8 @@ export async function POST(req: NextRequest) { dateScoreMap[date][`${evaluation.Test?.name}(${testId})`][0] + evaluation.ltUserScore || 0; dateScoreMap[date][`${evaluation.Test?.name}(${testId})`][0] = total; - dateScoreMap[date][`${evaluation.Test?.name}(${testId})`][1] += 1; + dateScoreMap[date][`${evaluation.Test?.name}(${testId})`][1] += + evaluation.Test?.max || 1; }); } diff --git a/components/annotations/annotations-table.tsx b/components/annotations/annotations-table.tsx index 1e93d16f..e37a4cde 100644 --- a/components/annotations/annotations-table.tsx +++ b/components/annotations/annotations-table.tsx @@ -368,7 +368,6 @@ function EvaluationSheet({ const { isError, isLoading, - isFetching, data: evaluations, } = useQuery({ queryKey: ["fetch-evaluation-query", span.span_id], diff --git a/components/annotations/chart-tabs.tsx b/components/annotations/chart-tabs.tsx index 188db007..555c8068 100644 --- a/components/annotations/chart-tabs.tsx +++ b/components/annotations/chart-tabs.tsx @@ -89,7 +89,7 @@ export function ChartTabs({
) : Object.keys(chartData?.scores).length > 0 ? ( -
+
{Object.keys(chartData?.scores).map( (testId: string, index: number) => { const score = (chartData?.scores[testId] || 0) * 100; @@ -110,14 +110,14 @@ export function ChartTabs({ > {(chartData?.scores[testId] || 0) * 100}% - + {testName}
diff --git a/components/playground/common.tsx b/components/playground/common.tsx index e36f5d15..9946f614 100644 --- a/components/playground/common.tsx +++ b/components/playground/common.tsx @@ -9,7 +9,6 @@ import { OpenAIRole, } from "@/lib/types/playground_types"; import { cn } from "@/lib/utils"; -import { ArrowTopRightIcon } from "@radix-ui/react-icons"; import { MinusCircleIcon, PlusIcon } from "lucide-react"; import Link from "next/link"; import { useEffect, useRef, useState } from "react"; @@ -41,12 +40,14 @@ export function ExpandingTextArea({ onChange, setFocusing, saveButtonRef, + saveButtonLabel = "Save to Registry", handleSave, }: { value: string; onChange: any; setFocusing?: any; saveButtonRef: React.RefObject; + saveButtonLabel?: string; handleSave: (open: boolean) => void; }) { const textAreaRef = useRef(null); @@ -86,16 +87,16 @@ export function ExpandingTextArea({ onChange={handleChange} style={{ overflowY: "auto", height: "auto" }} /> -
+
diff --git a/components/project/dataset/create-data.tsx b/components/project/dataset/create-data.tsx index d1da4358..59cad731 100644 --- a/components/project/dataset/create-data.tsx +++ b/components/project/dataset/create-data.tsx @@ -44,7 +44,9 @@ export function CreateData({ const [busy, setBusy] = useState(false); const schema = z.object({ input: z.string().min(2, "Too short").max(200, "Too long"), - output: z.string().min(2, "Too short").max(2000, "Too long"), + output: z.string().min(2, "Too short").max(2000, "Too long").optional(), + expectedOutput: z.string().min(2, "Too short").max(2000, "Too long"), + model: z.string().min(2, "Too short").max(20, "Too long").optional(), note: z.string().max(25, "Too long").optional(), }); const CreateDataForm = useForm({ @@ -85,7 +87,9 @@ export function CreateData({ datas: [ { input: data.input, - output: data.output, + output: data.output || "", + expectedOutput: data.expectedOutput, + model: data.model || "", note: data.note || "", }, ], @@ -152,6 +156,49 @@ export function CreateData({ )} /> + ( + + + Expected Output + + + + + + + + )} + /> + ( + + + Model + + + + + + + + )} + /> (false); + const [busy, setBusy] = useState(false); + return ( + + + + + + + Delete Data + + Are you sure you want to delete this data? + + + + + + + + ); +} diff --git a/components/project/dataset/edit-data.tsx b/components/project/dataset/edit-data.tsx deleted file mode 100644 index 6d9a698b..00000000 --- a/components/project/dataset/edit-data.tsx +++ /dev/null @@ -1,286 +0,0 @@ -import { Info } from "@/components/shared/info"; -import { Button } from "@/components/ui/button"; -import { - Dialog, - DialogContent, - DialogDescription, - DialogFooter, - DialogHeader, - DialogTitle, - DialogTrigger, -} from "@/components/ui/dialog"; -import { - DropdownMenu, - DropdownMenuContent, - DropdownMenuItem, - DropdownMenuTrigger, -} from "@/components/ui/dropdown-menu"; -import { - Form, - FormControl, - FormField, - FormItem, - FormLabel, - FormMessage, -} from "@/components/ui/form"; -import { Input } from "@/components/ui/input"; -import { zodResolver } from "@hookform/resolvers/zod"; -import { Data } from "@prisma/client"; -import { DotsHorizontalIcon } from "@radix-ui/react-icons"; -import { EditIcon, TrashIcon } from "lucide-react"; -import { useState } from "react"; -import { useForm } from "react-hook-form"; -import { useQueryClient } from "react-query"; -import { toast } from "sonner"; -import { z } from "zod"; - -export function EditData({ - idata, - datasetId, - className = "w-full text-left p-0 text-muted-foreground hover:text-primary flex items-center", -}: { - idata: Data; - datasetId: string; - variant?: any; - className?: string; -}) { - const queryClient = useQueryClient(); - const [open, setOpen] = useState(false); - const [openEdit, setOpenEdit] = useState(false); - const [openDelete, setOpenDelete] = useState(false); - const [busy, setBusy] = useState(false); - const schema = z.object({ - input: z.string().min(2, "Too short").max(200, "Too long"), - output: z.string().min(2, "Too short").max(2000, "Too long"), - note: z.string().max(25, "Too long").optional(), - }); - const EditDataForm = useForm({ - resolver: zodResolver(schema), - defaultValues: { - input: idata.input || "", - output: idata.output || "", - note: idata.note || "", - }, - }); - return ( - - - - - - - - - - - - - - - - - - - {openEdit && ( - - - Edit Data - - Edit the data by filling out the form below. - - -
- { - try { - // stringify data.input, data.output if it's an object - if (typeof data.input === "object") { - data.input = JSON.stringify(data.input); - } - if (typeof data.output === "object") { - data.output = JSON.stringify(data.output); - } - setBusy(true); - await fetch("/api/data", { - method: "PUT", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ - id: idata.id, - input: data.input, - output: data.output, - note: data.note, - }), - }); - await queryClient.invalidateQueries(datasetId); - toast("Data saved!", { - description: "Your data has been saved.", - }); - setOpen(false); - } catch (error: any) { - toast("Error saving your dataset!", { - description: `There was an error saving your dataset: ${error.message}`, - }); - } finally { - setBusy(false); - } - })} - className="flex flex-col gap-4" - > - ( - - - Input - - - - - - - - )} - /> - ( - - - Output - - - - - - - - )} - /> - ( - - - Note - - - - - - - - )} - /> - - - - - -
- )} - {openDelete && ( - - - Delete Data - - Are you sure you want to delete this data? - - - - - - - )} -
- ); -} diff --git a/components/project/traces/trace-sheet.tsx b/components/project/traces/trace-sheet.tsx index 3cafbaa3..366a31e4 100644 --- a/components/project/traces/trace-sheet.tsx +++ b/components/project/traces/trace-sheet.tsx @@ -83,7 +83,8 @@ export function TraceSheet({
{includesLanggraph && ( diff --git a/components/project/traces/traces-table.tsx b/components/project/traces/traces-table.tsx index 6bb56918..38abeba0 100644 --- a/components/project/traces/traces-table.tsx +++ b/components/project/traces/traces-table.tsx @@ -30,7 +30,7 @@ import { import { ChevronDown, RefreshCwIcon } from "lucide-react"; import Link from "next/link"; import { useEffect, useMemo, useState } from "react"; -import TraceRowSkeleton from "../../shared/row-skeleton"; +import RowSkeleton from "../../shared/row-skeleton"; import { TableSkeleton } from "./table-skeleton"; import { TraceSheet } from "./trace-sheet"; import { TracesDownload } from "./traces-download"; @@ -317,7 +317,7 @@ export function TracesTable({
{Array.from({ length: 2 }).map((_, index) => ( - + ))}
)} diff --git a/components/shared/add-to-dataset.tsx b/components/shared/add-to-dataset.tsx index e4bf4fd8..2bb07072 100644 --- a/components/shared/add-to-dataset.tsx +++ b/components/shared/add-to-dataset.tsx @@ -1,8 +1,3 @@ -"use client"; - -import { Check, ChevronsUpDown, PlusIcon } from "lucide-react"; -import * as React from "react"; - import { Button } from "@/components/ui/button"; import { Command, @@ -11,13 +6,6 @@ import { CommandInput, CommandItem, } from "@/components/ui/command"; -import { - Popover, - PopoverContent, - PopoverTrigger, -} from "@/components/ui/popover"; -import { cn } from "@/lib/utils"; - import { Dialog, DialogContent, @@ -28,7 +16,16 @@ import { DialogTrigger, } from "@/components/ui/dialog"; import { Label } from "@/components/ui/label"; +import { + Popover, + PopoverContent, + PopoverTrigger, +} from "@/components/ui/popover"; +import { cn } from "@/lib/utils"; +import { Skeleton } from "@mui/material"; import { Dataset } from "@prisma/client"; +import { Check, ChevronsUpDown, PlusIcon } from "lucide-react"; +import * as React from "react"; import { useQuery, useQueryClient } from "react-query"; import { toast } from "sonner"; import { CreateDataset } from "../project/dataset/create"; @@ -140,7 +137,7 @@ export default function DatasetCombobox({ }); if (fetchDatasets.isLoading || !fetchDatasets.data) { - return
Loading...
; // this componenet isn't being used, will add updated loading later + return ; } else { return ( diff --git a/prisma/migrations/20240804000535_modify_data_columns_expectedoutput_model/migration.sql b/prisma/migrations/20240804000535_modify_data_columns_expectedoutput_model/migration.sql new file mode 100644 index 00000000..96c7de01 --- /dev/null +++ b/prisma/migrations/20240804000535_modify_data_columns_expectedoutput_model/migration.sql @@ -0,0 +1,12 @@ +/* + Warnings: + + - You are about to drop the column `annotatedOutput` on the `Data` table. All the data in the column will be lost. + - You are about to drop the column `contexts` on the `Data` table. All the data in the column will be lost. + +*/ +-- AlterTable +ALTER TABLE "Data" DROP COLUMN "annotatedOutput", +DROP COLUMN "contexts", +ADD COLUMN "expectedOutput" TEXT, +ADD COLUMN "model" TEXT; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index d28b453a..03a10bf7 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -128,20 +128,20 @@ model Prompt { } model Data { - id String @id @default(cuid()) - input String - output String - contexts String[] - annotatedOutput String? - note String? - spanId String? - Evaluation Evaluation[] - datasetId String? - Dataset Dataset? @relation(fields: [datasetId], references: [id], onDelete: Cascade) - projectId String? - Project Project? @relation(fields: [projectId], references: [id], onDelete: Cascade) - createdAt DateTime @default(now()) - updatedAt DateTime @updatedAt + id String @id @default(cuid()) + spanId String? + input String + output String + expectedOutput String? + model String? + note String? + Evaluation Evaluation[] + datasetId String? + Dataset Dataset? @relation(fields: [datasetId], references: [id], onDelete: Cascade) + projectId String? + Project Project? @relation(fields: [projectId], references: [id], onDelete: Cascade) + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt } model Dataset {