Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

feat(dialog): add sticky header and footer (#7154)

marliessophie448c56e114ea
diff --git a/web/src/components/table/table-view-presets/components/data-table-view-presets-drawer.tsx b/web/src/components/table/table-view-presets/components/data-table-view-presets-drawer.tsx
index 9b0259db8c..9d551ae381 100644
--- a/web/src/components/table/table-view-presets/components/data-table-view-presets-drawer.tsx
+++ b/web/src/components/table/table-view-presets/components/data-table-view-presets-drawer.tsx
@@ -39,6 +39,7 @@ import {
DialogHeader,
DialogTitle,
DialogFooter,
+ DialogBody,
} from "@/src/components/ui/dialog";
import { Input } from "@/src/components/ui/input";
import {
@@ -571,34 +572,37 @@ export function TableViewPresetsDrawer({
onSubmit={form.handleSubmit(onSubmit())}
className="space-y-4"
>
- <FormField
- control={form.control}
- name="name"
- render={({ field }) => (
- <FormItem>
- <FormLabel>View name</FormLabel>
- <FormControl>
- <Input {...field} />
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
-
- <div className="mt-4 text-sm text-muted-foreground">
- <p>This will save the current:</p>
- <ul className="mt-2 list-disc pl-5">
- <li>
- Column arrangement ({currentState.columnOrder.length}{" "}
- columns)
- </li>
- <li>Filters ({currentState.filters.length} active)</li>
- <li>
- Sort order ({formatOrderBy(currentState.orderBy)} criteria)
- </li>
- {currentState.searchQuery && <li>Search term</li>}
- </ul>
- </div>
+ <DialogBody>
+ <FormField
+ control={form.control}
+ name="name"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel>View name</FormLabel>
+ <FormControl>
+ <Input {...field} />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+
+ <div className="mt-4 text-sm text-muted-foreground">
+ <p>This will save the current:</p>
+ <ul className="mt-2 list-disc pl-5">
+ <li>
+ Column arrangement ({currentState.columnOrder.length}{" "}
+ columns)
+ </li>
+ <li>Filters ({currentState.filters.length} active)</li>
+ <li>
+ Sort order ({formatOrderBy(currentState.orderBy)}{" "}
+ criteria)
+ </li>
+ {currentState.searchQuery && <li>Search term</li>}
+ </ul>
+ </div>
+ </DialogBody>
<DialogFooter>
<Button
diff --git a/web/src/components/ui/command.tsx b/web/src/components/ui/command.tsx
index 2c0749ad02..d6b3646137 100644
--- a/web/src/components/ui/command.tsx
+++ b/web/src/components/ui/command.tsx
@@ -6,7 +6,7 @@ import { Command as CommandPrimitive } from "cmdk";
import { Search } from "lucide-react";
import { cn } from "@/src/utils/tailwind";
-import { Dialog, DialogContent } from "@/src/components/ui/dialog";
+import { Dialog, DialogBody, DialogContent } from "@/src/components/ui/dialog";
const Command = React.forwardRef<
React.ElementRef<typeof CommandPrimitive>,
@@ -36,12 +36,14 @@ const CommandDialog = ({
className="overflow-hidden p-0 shadow-lg"
closeOnInteractionOutside
>
- <Command
- filter={filter}
- className="pb-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12"
- >
- {children}
- </Command>
+ <DialogBody>
+ <Command
+ filter={filter}
+ className="pb-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12"
+ >
+ {children}
+ </Command>
+ </DialogBody>
</DialogContent>
</Dialog>
);
diff --git a/web/src/components/ui/dialog.tsx b/web/src/components/ui/dialog.tsx
index 69b87b8358..b27cce54e5 100644
--- a/web/src/components/ui/dialog.tsx
+++ b/web/src/components/ui/dialog.tsx
@@ -3,6 +3,7 @@
import * as React from "react";
import * as DialogPrimitive from "@radix-ui/react-dialog";
import { X } from "lucide-react";
+import { cva, type VariantProps } from "class-variance-authority";
import { cn } from "@/src/utils/tailwind";
@@ -29,24 +30,37 @@ const DialogOverlay = React.forwardRef<
));
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
+const dialogContentVariants = cva(
+ "fixed left-[50%] top-[50%] z-50 flex w-full flex-col translate-x-[-50%] translate-y-[-50%] bg-background shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
+ {
+ variants: {
+ size: {
+ default: "max-w-lg max-h-[85vh]",
+ lg: "max-w-4xl max-h-[85vh]",
+ xl: "max-w-7xl h-[90vh]",
+ },
+ },
+ defaultVariants: {
+ size: "default",
+ },
+ },
+);
+
const DialogContent = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> & {
closeOnInteractionOutside?: boolean;
- }
+ } & VariantProps<typeof dialogContentVariants>
>(
(
- { className, children, closeOnInteractionOutside = false, ...props },
+ { className, children, closeOnInteractionOutside = false, size, ...props },
ref,
) => (
<DialogPortal>
<DialogOverlay />
<DialogPrimitive.Content
ref={ref}
- className={cn(
- "fixed left-[50%] top-[50%] z-50 grid max-h-[85vh] w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 overflow-y-auto border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
- className,
- )}
+ className={cn(dialogContentVariants({ size, className }))}
aria-describedby={undefined}
onPointerDownOutside={(e) => {
if (!closeOnInteractionOutside) {
@@ -61,7 +75,7 @@ const DialogContent = React.forwardRef<
{...props}
>
{children}
- <DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
+ <DialogPrimitive.Close className="absolute right-4 top-4 z-20 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
<X className="h-4 w-4" />
<span className="sr-only">Close</span>
</DialogPrimitive.Close>
@@ -77,7 +91,7 @@ const DialogHeader = ({
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn(
- "flex flex-col space-y-1.5 text-center sm:text-left",
+ "sticky top-0 z-10 flex flex-shrink-0 flex-col space-y-1.5 bg-background p-6 pb-4 text-center sm:text-left",
className,
)}
{...props}
@@ -85,13 +99,28 @@ const DialogHeader = ({
);
DialogHeader.displayName = "DialogHeader";
+const DialogBody = React.forwardRef<
+ HTMLDivElement,
+ React.HTMLAttributes<HTMLDivElement>
+>(({ className, ...props }, ref) => (
+ <div
+ ref={ref}
+ className={cn(
+ "flex flex-1 flex-col gap-4 overflow-y-auto px-6 pb-6 [&:has(+.dialog-footer)]:pb-0",
+ className,
+ )}
+ {...props}
+ />
+));
+DialogBody.displayName = "DialogBody";
+
const DialogFooter = ({
className,
...props
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn(
- "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
+ "dialog-footer sticky bottom-0 z-10 flex flex-shrink-0 flex-col-reverse bg-background p-6 px-6 sm:flex-row sm:justify-end sm:space-x-2",
className,
)}
{...props}
@@ -134,6 +163,7 @@ export {
DialogTrigger,
DialogContent,
DialogHeader,
+ DialogBody,
DialogFooter,
DialogTitle,
DialogDescription,
diff --git a/web/src/components/ui/input-command.tsx b/web/src/components/ui/input-command.tsx
index 61e09eb888..37af569dbb 100644
--- a/web/src/components/ui/input-command.tsx
+++ b/web/src/components/ui/input-command.tsx
@@ -8,7 +8,7 @@ import { type DialogProps } from "@radix-ui/react-dialog";
import { Command as CommandPrimitive } from "cmdk";
import { Search } from "lucide-react";
-import { Dialog, DialogContent } from "@/src/components/ui/dialog";
+import { Dialog, DialogBody, DialogContent } from "@/src/components/ui/dialog";
import { cn } from "@/src/utils/tailwind";
const InputCommand = React.forwardRef<
@@ -35,9 +35,11 @@ const InputCommandDialog = ({
return (
<Dialog {...props}>
<DialogContent className="overflow-hidden p-0 shadow-lg">
- <InputCommand className="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-slate-500 dark:[&_[cmdk-group-heading]]:text-slate-400 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
- {children}
- </InputCommand>
+ <DialogBody>
+ <InputCommand className="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-slate-500 dark:[&_[cmdk-group-heading]]:text-slate-400 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
+ {children}
+ </InputCommand>
+ </DialogBody>
</DialogContent>
</Dialog>
);
diff --git a/web/src/components/ui/popover.tsx b/web/src/components/ui/popover.tsx
index 2ca2452fa6..d3744e31dc 100644
--- a/web/src/components/ui/popover.tsx
+++ b/web/src/components/ui/popover.tsx
@@ -19,7 +19,7 @@ const PopoverContent = React.forwardRef<
align={align}
sideOffset={sideOffset}
className={cn(
- "z-50 w-72 rounded-md border bg-popover p-3 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
+ "z-50 min-w-72 max-w-[max(var(--radix-popover-trigger-width),72px)] rounded-md border bg-popover p-3 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
className,
)}
{...props}
diff --git a/web/src/ee/features/billing/components/BillingSettings.tsx b/web/src/ee/features/billing/components/BillingSettings.tsx
index 98e18acec3..e66df78e7a 100644
--- a/web/src/ee/features/billing/components/BillingSettings.tsx
+++ b/web/src/ee/features/billing/components/BillingSettings.tsx
@@ -23,6 +23,7 @@ import {
DialogHeader,
DialogTitle,
DialogTrigger,
+ DialogBody,
} from "@/src/components/ui/dialog";
import { usePostHogClientCapture } from "@/src/features/posthog-analytics/usePostHogClientCapture";
import { stripeProducts } from "@/src/ee/features/billing/utils/stripeProducts";
@@ -230,122 +231,126 @@ const BillingPortalOrPricingPageButton = () => {
}
/>
</DialogHeader>
- <div className="mb-3 grid grid-cols-1 gap-3 md:grid-cols-3">
- {stripeProducts
- .filter((product) => Boolean(product.checkout))
- .map((product) => (
- <div
- key={product.stripeProductId}
- className="relative flex flex-col rounded-xl border bg-card p-4 shadow-sm transition-all hover:shadow-md"
- >
- <div className="mb-4">
- <h3 className="text-2xl font-bold">
- {product.checkout?.title}
- </h3>
- <div className="mt-4 space-y-1">
- <div className="text-2xl font-bold text-primary">
- {product.checkout?.price}
- </div>
- <div className="text-sm text-muted-foreground">
- + {product.checkout?.usagePrice}
+ <DialogBody>
+ <div className="mb-3 grid grid-cols-1 gap-3 md:grid-cols-3">
+ {stripeProducts
+ .filter((product) => Boolean(product.checkout))
+ .map((product) => (
+ <div
+ key={product.stripeProductId}
+ className="relative flex flex-col rounded-xl border bg-card p-4 shadow-sm transition-all hover:shadow-md"
+ >
+ <div className="mb-4">
+ <h3 className="text-2xl font-bold">
+ {product.checkout?.title}
+ </h3>
+ <div className="mt-4 space-y-1">
+ <div className="text-2xl font-bold text-primary">
+ {product.checkout?.price}
+ </div>
+ <div className="text-sm text-muted-foreground">
+ + {product.checkout?.usagePrice}
+ </div>
</div>
</div>
- </div>
- <div className="mb-4 text-sm text-muted-foreground">
- {product.checkout?.description}
- </div>
- <div className="space-y-2">
- <div className="text-sm font-medium">Main features:</div>
- <ul className="list-inside list-disc space-y-1 text-sm text-muted-foreground">
- {product.checkout?.mainFeatures.map((feature, index) => (
- <li key={index}>{feature}</li>
- ))}
- </ul>
- </div>
- <Link
- href="https://langfuse.com/pricing"
- target="_blank"
- className="mt-auto block py-4 text-sm text-muted-foreground hover:text-foreground"
- >
- Learn more about plan →
- </Link>
- {organization?.cloudConfig?.stripe?.activeProductId ? (
- // Change plan
- <Dialog>
- <DialogTrigger asChild>
- <Button
- disabled={
- organization?.cloudConfig?.stripe?.activeProductId ===
- product.stripeProductId
+ <div className="mb-4 text-sm text-muted-foreground">
+ {product.checkout?.description}
+ </div>
+ <div className="space-y-2">
+ <div className="text-sm font-medium">Main features:</div>
+ <ul className="list-inside list-disc space-y-1 text-sm text-muted-foreground">
+ {product.checkout?.mainFeatures.map((feature, index) => (
+ <li key={index}>{feature}</li>
+ ))}
+ </ul>
+ </div>
+ <Link
+ href="https://langfuse.com/pricing"
+ target="_blank"
+ className="mt-auto block py-4 text-sm text-muted-foreground hover:text-foreground"
+ >
+ Learn more about plan →
+ </Link>
+ {organization?.cloudConfig?.stripe?.activeProductId ? (
+ // Change plan
+ <Dialog>
+ <DialogTrigger asChild>
+ <Button
+ disabled={
+ organization?.cloudConfig?.stripe
+ ?.activeProductId === product.stripeProductId
+ }
+ className="w-full"
+ >
+ {organization?.cloudConfig?.stripe
+ ?.activeProductId === product.stripeProductId
+ ? "Current plan"
+ : "Change plan"}
+ </Button>
+ </DialogTrigger>
+ <DialogContent>
+ <DialogHeader>
+ <DialogTitle>
+ Confirm Change:{" "}
+ {planLabels[organization?.plan ?? "cloud:hobby"]} →{" "}
+ {product.checkout?.title}
+ </DialogTitle>
+ <DialogDescription className="pt-2">
+ This will immediately generate an invoice for any
+ usage on your current plan. Your new plan and
+ billing period will start today. Are you sure you
+ want to continue?
+ </DialogDescription>
+ </DialogHeader>
+ <DialogFooter>
+ <DialogClose asChild>
+ <Button variant="secondary">Cancel</Button>
+ </DialogClose>
+ <ActionButton
+ onClick={() => {
+ if (organization) {
+ setProcessingPlanId(product.stripeProductId);
+ mutChangePlan.mutate({
+ orgId: organization.id,
+ stripeProductId: product.stripeProductId,
+ });
+ }
+ }}
+ loading={
+ processingPlanId === product.stripeProductId
+ }
+ >
+ Confirm
+ </ActionButton>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
+ ) : (
+ // Upgrade, no plan yet
+ <ActionButton
+ onClick={() => {
+ if (organization) {
+ setProcessingPlanId(product.stripeProductId);
+ mutCreateCheckoutSession.mutate({
+ orgId: organization.id,
+ stripeProductId: product.stripeProductId,
+ });
}
- className="w-full"
- >
- {organization?.cloudConfig?.stripe?.activeProductId ===
+ }}
+ disabled={
+ organization?.cloudConfig?.stripe?.activeProductId ===
product.stripeProductId
- ? "Current plan"
- : "Change plan"}
- </Button>
- </DialogTrigger>
- <DialogContent>
- <DialogHeader>
- <DialogTitle>
- Confirm Change:{" "}
- {planLabels[organization?.plan ?? "cloud:hobby"]} →{" "}
- {product.checkout?.title}
- </DialogTitle>
- <DialogDescription className="pt-2">
- This will immediately generate an invoice for any
- usage on your current plan. Your new plan and billing
- period will start today. Are you sure you want to
- continue?
- </DialogDescription>
- </DialogHeader>
- <DialogFooter>
- <DialogClose asChild>
- <Button variant="secondary">Cancel</Button>
- </DialogClose>
- <ActionButton
- onClick={() => {
- if (organization) {
- setProcessingPlanId(product.stripeProductId);
- mutChangePlan.mutate({
- orgId: organization.id,
- stripeProductId: product.stripeProductId,
- });
- }
- }}
- loading={processingPlanId === product.stripeProductId}
- >
- Confirm
- </ActionButton>
- </DialogFooter>
- </DialogContent>
- </Dialog>
- ) : (
- // Upgrade, no plan yet
- <ActionButton
- onClick={() => {
- if (organization) {
- setProcessingPlanId(product.stripeProductId);
- mutCreateCheckoutSession.mutate({
- orgId: organization.id,
- stripeProductId: product.stripeProductId,
- });
}
- }}
- disabled={
- organization?.cloudConfig?.stripe?.activeProductId ===
- product.stripeProductId
- }
- className="w-full"
- loading={processingPlanId === product.stripeProductId}
- >
- Select plan
- </ActionButton>
- )}
- </div>
- ))}
- </div>
+ className="w-full"
+ loading={processingPlanId === product.stripeProductId}
+ >
+ Select plan
+ </ActionButton>
+ )}
+ </div>
+ ))}
+ </div>
+ </DialogBody>
</DialogContent>
</Dialog>
);
diff --git a/web/src/features/annotation-queues/components/CreateOrEditAnnotationQueueButton.tsx b/web/src/features/annotation-queues/components/CreateOrEditAnnotationQueueButton.tsx
index 6349b9f925..417649c7fd 100644
--- a/web/src/features/annotation-queues/components/CreateOrEditAnnotationQueueButton.tsx
+++ b/web/src/features/annotation-queues/components/CreateOrEditAnnotationQueueButton.tsx
@@ -2,8 +2,10 @@ import { Button, type ButtonProps } from "@/src/components/ui/button";
import React, { useEffect, useMemo, useState } from "react";
import {
Dialog,
+ DialogBody,
DialogContent,
DialogDescription,
+ DialogFooter,
DialogHeader,
DialogTitle,
DialogTrigger,
@@ -204,103 +206,109 @@ export const CreateOrEditAnnotationQueueButton = ({
</DialogHeader>
<Form {...form}>
<form className="space-y-6" onSubmit={form.handleSubmit(onSubmit)}>
- <FormField
- control={form.control}
- name="name"
- render={({ field }) => (
- <FormItem>
- <FormLabel>Name</FormLabel>
- <FormControl>
- <Input
- {...field}
- type="text"
- className="text-xs"
- onBlur={(e) => field.onChange(e.target.value.trimEnd())}
- />
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
- <FormField
- control={form.control}
- name="description"
- render={({ field }) => (
- <FormItem>
- <FormLabel>Description (optional)</FormLabel>
- <FormControl>
- <Textarea
- {...field}
- placeholder="Add description..."
- className="text-xs focus:outline-none focus:ring-0 focus-visible:ring-0 focus-visible:ring-offset-0 active:ring-0"
- />
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
- <FormField
- control={form.control}
- name="scoreConfigIds"
- render={({ field }) => (
- <FormItem>
- <FormLabel>Score Configs</FormLabel>
- <FormDescription>
- Define which dimensions annotators should score for the
- given queue.
- </FormDescription>
- <FormControl>
- <MultiSelectKeyValues
- placeholder="Value"
- align="end"
- className="grid grid-cols-[auto,1fr,auto,auto] gap-2"
- onValueChange={handleOnValueChange}
- options={configs
- .filter((config) => !config.isArchived)
- .map((config) => ({
- key: config.id,
- value: `${getScoreDataTypeIcon(config.dataType)} ${config.name}`,
- isArchived: config.isArchived,
- }))}
- values={field.value.map((configId) => {
- const config = configs.find(
- (config) => config.id === configId,
- );
- return {
- value: config
- ? `${getScoreDataTypeIcon(config.dataType)} ${config.name}`
- : `${configId}`,
- key: configId,
- };
- })}
- controlButtons={
- <DropdownMenuItem
- onSelect={() => {
- capture(
- "score_configs:manage_configs_item_click",
- { source: "AnnotationQueue" },
- );
- router.push(
- `/project/${projectId}/settings/scores`,
- );
- }}
- >
- Manage score configs
- </DropdownMenuItem>
- }
- />
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
- <Button
- type="submit"
- className="text-xs"
- disabled={!!form.formState.errors.name}
- >
- {queueId ? "Save" : "Create"} queue
- </Button>
+ <DialogBody>
+ <FormField
+ control={form.control}
+ name="name"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel>Name</FormLabel>
+ <FormControl>
+ <Input
+ {...field}
+ type="text"
+ className="text-xs"
+ onBlur={(e) =>
+ field.onChange(e.target.value.trimEnd())
+ }
+ />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ <FormField
+ control={form.control}
+ name="description"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel>Description (optional)</FormLabel>
+ <FormControl>
+ <Textarea
+ {...field}
+ placeholder="Add description..."
+ className="text-xs focus:outline-none focus:ring-0 focus-visible:ring-0 focus-visible:ring-offset-0 active:ring-0"
+ />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ <FormField
+ control={form.control}
+ name="scoreConfigIds"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel>Score Configs</FormLabel>
+ <FormDescription>
+ Define which dimensions annotators should score for the
+ given queue.
+ </FormDescription>
+ <FormControl>
+ <MultiSelectKeyValues
+ placeholder="Value"
+ align="end"
+ className="grid grid-cols-[auto,1fr,auto,auto] gap-2"
+ onValueChange={handleOnValueChange}
+ options={configs
+ .filter((config) => !config.isArchived)
+ .map((config) => ({
+ key: config.id,
+ value: `${getScoreDataTypeIcon(config.dataType)} ${config.name}`,
+ isArchived: config.isArchived,
+ }))}
+ values={field.value.map((configId) => {
+ const config = configs.find(
+ (config) => config.id === configId,
+ );
+ return {
+ value: config
+ ? `${getScoreDataTypeIcon(config.dataType)} ${config.name}`
+ : `${configId}`,
+ key: configId,
+ };
+ })}
+ controlButtons={
+ <DropdownMenuItem
+ onSelect={() => {
+ capture(
+ "score_configs:manage_configs_item_click",
+ { source: "AnnotationQueue" },
+ );
+ router.push(
+ `/project/${projectId}/settings/scores`,
+ );
+ }}
+ >
+ Manage score configs
+ </DropdownMenuItem>
+ }
+ />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ </DialogBody>
+ <DialogFooter>
+ <Button
+ type="submit"
+ className="text-xs"
+ disabled={!!form.formState.errors.name}
+ >
+ {queueId ? "Save" : "Create"} queue
+ </Button>
+ </DialogFooter>
</form>
</Form>
</DialogContent>
diff --git a/web/src/features/annotation-queues/components/DeleteAnnotationQueueButton.tsx b/web/src/features/annotation-queues/components/DeleteAnnotationQueueButton.tsx
index 4c8975aa51..5a2202027e 100644
--- a/web/src/features/annotation-queues/components/DeleteAnnotationQueueButton.tsx
+++ b/web/src/features/annotation-queues/components/DeleteAnnotationQueueButton.tsx
@@ -3,6 +3,7 @@ import {
Dialog,
DialogContent,
DialogDescription,
+ DialogFooter,
DialogHeader,
DialogTitle,
DialogTrigger,
@@ -65,21 +66,23 @@ export const DeleteAnnotationQueueButton = ({
deleted.
</DialogDescription>
</DialogHeader>
- <Button
- variant="destructive"
- loading={mutDelete.isLoading}
- disabled={mutDelete.isLoading}
- onClick={async (event) => {
- event.preventDefault();
- await mutDelete.mutateAsync({
- projectId,
- queueId,
- });
- setIsOpen(false);
- }}
- >
- Delete Annotation Queue
- </Button>
+ <DialogFooter>
+ <Button
+ variant="destructive"
+ loading={mutDelete.isLoading}
+ disabled={mutDelete.isLoading}
+ onClick={async (event) => {
+ event.preventDefault();
+ await mutDelete.mutateAsync({
+ projectId,
+ queueId,
+ });
+ setIsOpen(false);
+ }}
+ >
+ Delete Annotation Queue
+ </Button>
+ </DialogFooter>
</DialogContent>
</Dialog>
) : (
diff --git a/web/src/features/auth/components/AuthCloudRegionSwitch.tsx b/web/src/features/auth/components/AuthCloudRegionSwitch.tsx
index c28976d693..247a8983b9 100644
--- a/web/src/features/auth/components/AuthCloudRegionSwitch.tsx
+++ b/web/src/features/auth/components/AuthCloudRegionSwitch.tsx
@@ -9,6 +9,7 @@ import {
import { usePostHogClientCapture } from "@/src/features/posthog-analytics/usePostHogClientCapture";
import {
Dialog,
+ DialogBody,
DialogContent,
DialogDescription,
DialogHeader,
@@ -133,35 +134,37 @@ const DataRegionInfo = () => (
<DialogHeader>
<DialogTitle>Data Regions</DialogTitle>
</DialogHeader>
- <DialogDescription className="flex flex-col gap-2">
- <p>Langfuse Cloud is available in two data regions:</p>
- <ul className="list-disc pl-5">
- <li>US: Oregon (AWS us-west-2)</li>
- <li>EU: Ireland (AWS eu-west-1)</li>
- </ul>
- <p>
- Regions are strictly separated, and no data is shared across regions.
- Choosing a region close to you can help improve speed and comply with
- local data residency laws and privacy regulations. Contact us to
- onboard into a HIPAA compliant region.
- </p>
- <p>
- You can have accounts in both regions and data migrations are
- available on Team plans.
- </p>
- <p>
- For more information, visit{" "}
- <a
- href="https://langfuse.com/docs/data-security-privacy"
- target="_blank"
- rel="noopener noreferrer"
- className="text-primary-accent underline"
- >
- langfuse.com/security
- </a>
- .
- </p>
- </DialogDescription>
+ <DialogBody>
+ <DialogDescription className="flex flex-col gap-2">
+ <p>Langfuse Cloud is available in two data regions:</p>
+ <ul className="list-disc pl-5">
+ <li>US: Oregon (AWS us-west-2)</li>
+ <li>EU: Ireland (AWS eu-west-1)</li>
+ </ul>
+ <p>
+ Regions are strictly separated, and no data is shared across
+ regions. Choosing a region close to you can help improve speed and
+ comply with local data residency laws and privacy regulations.
+ Contact us to onboard into a HIPAA compliant region.
+ </p>
+ <p>
+ You can have accounts in both regions and data migrations are
+ available on Team plans.
+ </p>
+ <p>
+ For more information, visit{" "}
+ <a
+ href="https://langfuse.com/docs/data-security-privacy"
+ target="_blank"
+ rel="noopener noreferrer"
+ className="text-primary-accent underline"
+ >
+ langfuse.com/security
+ </a>
+ .
+ </p>
+ </DialogDescription>
+ </DialogBody>
</DialogContent>
</Dialog>
);
diff --git a/web/src/features/dashboard/components/EditDashboardDialog.tsx b/web/src/features/dashboard/components/EditDashboardDialog.tsx
index 929774dd44..11210a8aa3 100644
--- a/web/src/features/dashboard/components/EditDashboardDialog.tsx
+++ b/web/src/features/dashboard/components/EditDashboardDialog.tsx
@@ -6,6 +6,7 @@ import {
DialogHeader,
DialogTitle,
DialogFooter,
+ DialogBody,
} from "@/src/components/ui/dialog";
import { Button } from "@/src/components/ui/button";
import { Input } from "@/src/components/ui/input";
@@ -69,29 +70,29 @@ export function EditDashboardDialog({
<DialogHeader>
<DialogTitle>Edit Dashboard</DialogTitle>
</DialogHeader>
-
- <div className="grid gap-4 py-4">
- <div className="grid gap-2">
- <Label htmlFor="name">Name</Label>
- <Input
- id="name"
- value={name}
- onChange={(e) => setName(e.target.value)}
- placeholder="Dashboard name"
- />
- </div>
- <div className="grid gap-2">
- <Label htmlFor="description">Description</Label>
- <Textarea
- id="description"
- value={description}
- onChange={(e) => setDescription(e.target.value)}
- placeholder="Dashboard description"
- rows={3}
- />
+ <DialogBody>
+ <div className="grid gap-4 py-4">
+ <div className="grid gap-2">
+ <Label htmlFor="name">Name</Label>
+ <Input
+ id="name"
+ value={name}
+ onChange={(e) => setName(e.target.value)}
+ placeholder="Dashboard name"
+ />
+ </div>
+ <div className="grid gap-2">
+ <Label htmlFor="description">Description</Label>
+ <Textarea
+ id="description"
+ value={description}
+ onChange={(e) => setDescription(e.target.value)}
+ placeholder="Dashboard description"
+ rows={3}
+ />
+ </div>
</div>
- </div>
-
+ </DialogBody>
<DialogFooter>
<div className="flex gap-2">
<Button
diff --git a/web/src/features/dashboard/components/SelectDashboardDialog.tsx b/web/src/features/dashboard/components/SelectDashboardDialog.tsx
index 67f7e2a2b7..21595c13a0 100644
--- a/web/src/features/dashboard/components/SelectDashboardDialog.tsx
+++ b/web/src/features/dashboard/components/SelectDashboardDialog.tsx
@@ -6,6 +6,7 @@ import {
DialogHeader,
DialogTitle,
DialogFooter,
+ DialogBody,
} from "@/src/components/ui/dialog";
import { Button } from "@/src/components/ui/button";
import {
@@ -67,52 +68,52 @@ export function SelectDashboardDialog({
<DialogHeader>
<DialogTitle>Select dashboard to add widget to</DialogTitle>
</DialogHeader>
-
- <div className="mt-4 max-h-[400px] overflow-y-auto">
- {dashboards.isLoading ? (
- <div className="py-8 text-center">Loading dashboards...</div>
- ) : dashboards.isError ? (
- <div className="py-8 text-center text-destructive">
- Error: {dashboards.error.message}
- </div>
- ) : dashboards.data?.dashboards.length === 0 ? (
- <div className="py-8 text-center text-muted-foreground">
- No dashboards found.
- </div>
- ) : (
- <Table>
- <TableHeader>
- <TableRow>
- <TableHead>Name</TableHead>
- <TableHead>Description</TableHead>
- <TableHead>Updated</TableHead>
- </TableRow>
- </TableHeader>
- <TableBody>
- {dashboards.data?.dashboards
- .filter((d) => d.owner === "PROJECT")
- .map((d) => (
- <TableRow
- key={d.id}
- onClick={() => setSelectedDashboardId(d.id)}
- className={`cursor-pointer hover:bg-muted ${
- selectedDashboardId === d.id ? "bg-muted" : ""
- }`}
- >
- <TableCell className="font-medium">{d.name}</TableCell>
- <TableCell className="truncate" title={d.description}>
- {d.description}
- </TableCell>
- <TableCell>
- {new Date(d.updatedAt).toLocaleString()}
- </TableCell>
- </TableRow>
- ))}
- </TableBody>
- </Table>
- )}
- </div>
-
+ <DialogBody>
+ <div className="mt-4 max-h-[400px] overflow-y-auto">
+ {dashboards.isLoading ? (
+ <div className="py-8 text-center">Loading dashboards...</div>
+ ) : dashboards.isError ? (
+ <div className="py-8 text-center text-destructive">
+ Error: {dashboards.error.message}
+ </div>
+ ) : dashboards.data?.dashboards.length === 0 ? (
+ <div className="py-8 text-center text-muted-foreground">
+ No dashboards found.
+ </div>
+ ) : (
+ <Table>
+ <TableHeader>
+ <TableRow>
+ <TableHead>Name</TableHead>
+ <TableHead>Description</TableHead>
+ <TableHead>Updated</TableHead>
+ </TableRow>
+ </TableHeader>
+ <TableBody>
+ {dashboards.data?.dashboards
+ .filter((d) => d.owner === "PROJECT")
+ .map((d) => (
+ <TableRow
+ key={d.id}
+ onClick={() => setSelectedDashboardId(d.id)}
+ className={`cursor-pointer hover:bg-muted ${
+ selectedDashboardId === d.id ? "bg-muted" : ""
+ }`}
+ >
+ <TableCell className="font-medium">{d.name}</TableCell>
+ <TableCell className="truncate" title={d.description}>
+ {d.description}
+ </TableCell>
+ <TableCell>
+ {new Date(d.updatedAt).toLocaleString()}
+ </TableCell>
+ </TableRow>
+ ))}
+ </TableBody>
+ </Table>
+ )}
+ </div>
+ </DialogBody>
<DialogFooter className="mt-4 flex justify-between">
<Button variant="outline" onClick={handleSkip}>
Skip
diff --git a/web/src/features/datasets/components/DatasetActionButton.tsx b/web/src/features/datasets/components/DatasetActionButton.tsx
index 87cc793d29..65899ffdb2 100644
--- a/web/src/features/datasets/components/DatasetActionButton.tsx
+++ b/web/src/features/datasets/components/DatasetActionButton.tsx
@@ -146,6 +146,7 @@ export const DatasetActionButton = (props: DatasetActionButtonProps) => {
</DialogDescription>
)}
</DialogHeader>
+
{props.mode === "create" ? (
<DatasetForm
mode="create"
diff --git a/web/src/features/datasets/components/DatasetAggregateTableCell.tsx b/web/src/features/datasets/components/DatasetAggregateTableCell.tsx
index 66846816d3..63afc927dc 100644
--- a/web/src/features/datasets/components/DatasetAggregateTableCell.tsx
+++ b/web/src/features/datasets/components/DatasetAggregateTableCell.tsx
@@ -5,6 +5,7 @@ import { Button } from "@/src/components/ui/button";
import { IOTableCell } from "@/src/components/ui/CodeJsonViewer";
import {
Dialog,
+ DialogBody,
DialogFooter,
DialogHeader,
DialogTitle,
@@ -188,33 +189,34 @@ const DatasetAggregateCell = ({
</DialogTrigger>
<DialogContent
- className="max-w-screen-xl"
+ size="xl"
onClick={(event) => event.stopPropagation()}
>
<DialogHeader>
<DialogTitle>Expected Output → Actual Output</DialogTitle>
</DialogHeader>
-
- <div className="max-h-[80vh] max-w-screen-xl space-y-6 overflow-y-auto">
- <div className="space-y-6">
- <div className="space-y-4">
- <div>
- <DiffViewer
- oldString={JSON.stringify(output, null, 2)}
- newString={JSON.stringify(
- data?.output ?? "null",
- null,
- 2,
- )}
- oldLabel="Expected Output"
- newLabel="Actual Output"
- />
+ <DialogBody>
+ <div className="max-h-[80vh] max-w-screen-xl space-y-6 overflow-y-auto">
+ <div className="space-y-6">
+ <div className="space-y-4">
+ <div>
+ <DiffViewer
+ oldString={JSON.stringify(output, null, 2)}
+ newString={JSON.stringify(
+ data?.output ?? "null",
+ null,
+ 2,
+ )}
+ oldLabel="Expected Output"
+ newLabel="Actual Output"
+ />
+ </div>
</div>
</div>
</div>
- </div>
+ </DialogBody>
- <DialogFooter className="flex flex-row">
+ <DialogFooter className="static mt-auto">
<Button
onClick={() => {
setIsOpen(false);
diff --git a/web/src/features/datasets/components/DatasetForm.tsx b/web/src/features/datasets/components/DatasetForm.tsx
index 89d8292837..b7b2033461 100644
--- a/web/src/features/datasets/components/DatasetForm.tsx
+++ b/web/src/features/datasets/components/DatasetForm.tsx
@@ -19,6 +19,7 @@ import { usePostHogClientCapture } from "@/src/features/posthog-analytics/usePos
import { Label } from "@/src/components/ui/label";
import { useRouter } from "next/router";
import { useUniqueNameValidation } from "@/src/hooks/useUniqueNameValidation";
+import { DialogBody, DialogFooter } from "@/src/components/ui/dialog";
interface BaseDatasetFormProps {
mode: "create" | "update" | "delete";
@@ -202,90 +203,94 @@ export const DatasetForm = (props: DatasetFormProps) => {
props.mode === "delete" ? handleDelete : form.handleSubmit(onSubmit)
}
>
- {props.mode === "delete" ? (
- <div className="mb-8 grid w-full gap-1.5">
- <Label htmlFor="delete-confirmation">
- Type &quot;{props.datasetName}&quot; to confirm deletion
- </Label>
- <Input
- id="delete-confirmation"
- value={deleteConfirmationInput}
- onChange={(e) => setDeleteConfirmationInput(e.target.value)}
- />
- </div>
- ) : (
- <div className="mb-8 space-y-6">
- <FormField
- control={form.control}
- name="name"
- render={({ field }) => (
- <FormItem>
- <FormLabel>Name</FormLabel>
- <FormControl>
- <Input {...field} />
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
- <FormField
- control={form.control}
- name="description"
- render={({ field }) => (
- <FormItem>
- <FormLabel>Description (optional)</FormLabel>
- <FormControl>
- <Input {...field} />
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
- <FormField
- control={form.control}
- name="metadata"
- render={({ field }) => (
- <FormItem>
- <FormLabel>Metadata (optional)</FormLabel>
- <FormControl>
- <CodeMirrorEditor
- mode="json"
- value={field.value}
- onChange={(v) => {
- field.onChange(v);
- }}
- minHeight="none"
- />
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
- </div>
- )}
- <Button
- type="submit"
- variant={props.mode === "delete" ? "destructive" : "default"}
- disabled={!!form.formState.errors.name}
- loading={
- (props.mode === "create" && createMutation.isLoading) ||
- (props.mode === "delete" && deleteMutation.isLoading)
- }
- className="w-full"
- >
- {props.mode === "create"
- ? "Create dataset"
- : props.mode === "delete"
- ? "Delete Dataset"
- : "Update dataset"}
- </Button>
+ <DialogBody>
+ {props.mode === "delete" ? (
+ <div className="mb-8 grid w-full gap-1.5">
+ <Label htmlFor="delete-confirmation">
+ Type &quot;{props.datasetName}&quot; to confirm deletion
+ </Label>
+ <Input
+ id="delete-confirmation"
+ value={deleteConfirmationInput}
+ onChange={(e) => setDeleteConfirmationInput(e.target.value)}
+ />
+ </div>
+ ) : (
+ <div className="mb-8 space-y-6">
+ <FormField
+ control={form.control}
+ name="name"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel>Name</FormLabel>
+ <FormControl>
+ <Input {...field} />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ <FormField
+ control={form.control}
+ name="description"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel>Description (optional)</FormLabel>
+ <FormControl>
+ <Input {...field} />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ <FormField
+ control={form.control}
+ name="metadata"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel>Metadata (optional)</FormLabel>
+ <FormControl>
+ <CodeMirrorEditor
+ mode="json"
+ value={field.value}
+ onChange={(v) => {
+ field.onChange(v);
+ }}
+ minHeight="none"
+ />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ </div>
+ )}
+ </DialogBody>
+ <DialogFooter>
+ <Button
+ type="submit"
+ variant={props.mode === "delete" ? "destructive" : "default"}
+ disabled={!!form.formState.errors.name}
+ loading={
+ (props.mode === "create" && createMutation.isLoading) ||
+ (props.mode === "delete" && deleteMutation.isLoading)
+ }
+ className="w-full"
+ >
+ {props.mode === "create"
+ ? "Create dataset"
+ : props.mode === "delete"
+ ? "Delete Dataset"
+ : "Update dataset"}
+ </Button>
+ {formError && (
+ <p className="mt-4 text-center text-sm text-red-500">
+ <span className="font-bold">Error:</span> {formError}
+ </p>
+ )}
+ </DialogFooter>
</form>
</Form>
- {formError && (
- <p className="mt-4 text-center text-sm text-red-500">
- <span className="font-bold">Error:</span> {formError}
- </p>
- )}
</div>
);
};
diff --git a/web/src/features/datasets/components/DatasetRunsTable.tsx b/web/src/features/datasets/components/DatasetRunsTable.tsx
index d7d6544f47..7eaacda381 100644
--- a/web/src/features/datasets/components/DatasetRunsTable.tsx
+++ b/web/src/features/datasets/components/DatasetRunsTable.tsx
@@ -49,6 +49,7 @@ import {
Dialog,
DialogContent,
DialogDescription,
+ DialogFooter,
DialogHeader,
DialogTitle,
} from "@/src/components/ui/dialog";
@@ -151,22 +152,24 @@ const DatasetRunTableMultiSelectAction = ({
{selectedRunIds.length > 1 ? "s" : ""}.
</DialogDescription>
</DialogHeader>
- <Button
- variant="destructive"
- loading={mutDelete.isLoading}
- disabled={mutDelete.isLoading}
- onClick={async (event) => {
- event.preventDefault();
- capture("dataset_run:delete_form_submit");
- await mutDelete.mutateAsync({
- projectId,
- datasetRunIds: selectedRunIds,
- });
- setIsDeleteDialogOpen(false);
- }}
- >
- Delete Dataset Runs
- </Button>
+ <DialogFooter>
+ <Button
+ variant="destructive"
+ loading={mutDelete.isLoading}
+ disabled={mutDelete.isLoading}
+ onClick={async (event) => {
+ event.preventDefault();
+ capture("dataset_run:delete_form_submit");
+ await mutDelete.mutateAsync({
+ projectId,
+ datasetRunIds: selectedRunIds,
+ });
+ setIsDeleteDialogOpen(false);
+ }}
+ >
+ Delete Dataset Runs
+ </Button>
+ </DialogFooter>
</DialogContent>
</Dialog>
</>
diff --git a/web/src/features/datasets/components/DeleteDatasetRunButton.tsx b/web/src/features/datasets/components/DeleteDatasetRunButton.tsx
index 33603868da..e0dacdbf6a 100644
--- a/web/src/features/datasets/components/DeleteDatasetRunButton.tsx
+++ b/web/src/features/datasets/components/DeleteDatasetRunButton.tsx
@@ -4,6 +4,7 @@ import {
Dialog,
DialogContent,
DialogDescription,
+ DialogFooter,
DialogHeader,
DialogTitle,
DialogTrigger,
@@ -69,22 +70,24 @@ export const DeleteDatasetRunButton = ({
deleted manually.
</DialogDescription>
</DialogHeader>
- <Button
- variant="destructive"
- loading={mutDelete.isLoading}
- disabled={mutDelete.isLoading}
- onClick={async (event) => {
- event.preventDefault();
- capture("dataset_run:delete_form_submit");
- await mutDelete.mutateAsync({
- projectId,
- datasetRunIds: [datasetRunId],
- });
- setIsDialogOpen(false);
- }}
- >
- Delete Dataset Run
- </Button>
+ <DialogFooter>
+ <Button
+ variant="destructive"
+ loading={mutDelete.isLoading}
+ disabled={mutDelete.isLoading}
+ onClick={async (event) => {
+ event.preventDefault();
+ capture("dataset_run:delete_form_submit");
+ await mutDelete.mutateAsync({
+ projectId,
+ datasetRunIds: [datasetRunId],
+ });
+ setIsDialogOpen(false);
+ }}
+ >
+ Delete Dataset Run
+ </Button>
+ </DialogFooter>
</DialogContent>
</Dialog>
) : (
diff --git a/web/src/features/datasets/components/NewDatasetItemButton.tsx b/web/src/features/datasets/components/NewDatasetItemButton.tsx
index 482221754e..29d6cb86ff 100644
--- a/web/src/features/datasets/components/NewDatasetItemButton.tsx
+++ b/web/src/features/datasets/components/NewDatasetItemButton.tsx
@@ -36,7 +36,7 @@ export const NewDatasetItemButton = (props: {
New item
</ActionButton>
</DialogTrigger>
- <DialogContent className="h-[calc(100vh-5rem)] max-h-none w-[calc(100vw-5rem)] max-w-none items-start">
+ <DialogContent size="xl">
<DialogHeader>
<DialogTitle>Create new dataset item</DialogTitle>
</DialogHeader>
diff --git a/web/src/features/datasets/components/NewDatasetItemForm.tsx b/web/src/features/datasets/components/NewDatasetItemForm.tsx
index 9ff3b8c574..48e9e0f5e8 100644
--- a/web/src/features/datasets/components/NewDatasetItemForm.tsx
+++ b/web/src/features/datasets/components/NewDatasetItemForm.tsx
@@ -31,6 +31,7 @@ import {
import { Check, ChevronsUpDown } from "lucide-react";
import { Badge } from "@/src/components/ui/badge";
import { ScrollArea } from "@/src/components/ui/scroll-area";
+import { DialogBody, DialogFooter } from "@/src/components/ui/dialog";
const formSchema = z.object({
datasetIds: z.array(z.string()).min(1, "Select at least one dataset"),
@@ -153,128 +154,152 @@ export const NewDatasetItemForm = (props: {
onSubmit={form.handleSubmit(onSubmit)}
className={cn("flex h-full flex-col gap-6", props.className)}
>
- <div className="flex-none">
- <FormField
- control={form.control}
- name="datasetIds"
- render={({ field }) => (
- <FormItem className="flex flex-col">
- <FormLabel>Datasets</FormLabel>
- <Popover>
- <PopoverTrigger asChild>
- <FormControl>
- <Button
- variant="outline"
- role="combobox"
- className={cn(
- "w-full justify-between",
- !field.value.length && "text-muted-foreground",
- )}
- >
- {field.value.length > 0
- ? `${field.value.length} dataset${field.value.length > 1 ? "s" : ""} selected`
- : "Select datasets"}
- <ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
- </Button>
- </FormControl>
- </PopoverTrigger>
- <PopoverContent className="w-full p-0">
- <InputCommand>
- <InputCommandInput placeholder="Search datasets..." />
- <InputCommandEmpty>No datasets found.</InputCommandEmpty>
- <InputCommandGroup>
- <ScrollArea className="h-60">
- {datasets.data
- ?.filter(
- (dataset) =>
- !props.blockedDatasetIds?.includes(dataset.id),
- )
- .map((dataset) => (
- <InputCommandItem
- value={dataset.name}
- key={dataset.id}
- onSelect={() => {
- const newValue = field.value.includes(
- dataset.id,
- )
- ? field.value.filter(
- (id) => id !== dataset.id,
- )
- : [...field.value, dataset.id];
- field.onChange(newValue);
- }}
- >
- <Check
- className={cn(
- "mr-2 h-4 w-4",
- field.value.includes(dataset.id)
- ? "opacity-100"
- : "opacity-0",
- )}
- />
- {dataset.name}
- </InputCommandItem>
- ))}
- </ScrollArea>
- </InputCommandGroup>
- </InputCommand>
- </PopoverContent>
- </Popover>
- {field.value.length > 0 && (
- <div className="mt-2 flex flex-wrap gap-1">
- {field.value.map((datasetId) => {
- const dataset = datasets.data?.find(
- (d) => d.id === datasetId,
- );
- return (
- <Badge
- key={datasetId}
- variant="secondary"
- className="mb-1 mr-1"
- >
- {dataset?.name || datasetId}
- </Badge>
- );
- })}
- </div>
- )}
- <FormMessage />
- </FormItem>
- )}
- />
- </div>
- <div className="ph-no-capture min-h-0 flex-1 overflow-y-auto">
- <div className="grid gap-4 md:grid-cols-2">
+ <DialogBody className="grid grid-rows-[auto,1fr]">
+ <div className="flex-none">
<FormField
control={form.control}
- name="input"
+ name="datasetIds"
render={({ field }) => (
- <FormItem className="flex flex-col gap-2">
- <FormLabel>Input</FormLabel>
- <FormControl>
- <CodeMirrorEditor
- mode="json"
- value={field.value}
- onChange={field.onChange}
- minHeight={200}
- />
- </FormControl>
+ <FormItem className="flex flex-col">
+ <FormLabel>Datasets</FormLabel>
+ <Popover>
+ <PopoverTrigger asChild>
+ <FormControl>
+ <Button
+ variant="outline"
+ role="combobox"
+ className={cn(
+ "w-full justify-between",
+ !field.value.length && "text-muted-foreground",
+ )}
+ >
+ {field.value.length > 0
+ ? `${field.value.length} dataset${field.value.length > 1 ? "s" : ""} selected`
+ : "Select datasets"}
+ <ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
+ </Button>
+ </FormControl>
+ </PopoverTrigger>
+ <PopoverContent className="p-0">
+ <InputCommand>
+ <InputCommandInput placeholder="Search datasets..." />
+ <InputCommandEmpty>
+ No datasets found.
+ </InputCommandEmpty>
+ <InputCommandGroup>
+ <ScrollArea className="h-fit">
+ {datasets.data
+ ?.filter(
+ (dataset) =>
+ !props.blockedDatasetIds?.includes(
+ dataset.id,
+ ),
+ )
+ .map((dataset) => (
+ <InputCommandItem
+ value={dataset.name}
+ key={dataset.id}
+ onSelect={() => {
+ const newValue = field.value.includes(
+ dataset.id,
+ )
+ ? field.value.filter(
+ (id) => id !== dataset.id,
+ )
+ : [...field.value, dataset.id];
+ field.onChange(newValue);
+ }}
+ >
+ <Check
+ className={cn(
+ "mr-2 h-4 w-4",
+ field.value.includes(dataset.id)
+ ? "opacity-100"
+ : "opacity-0",
+ )}
+ />
+ {dataset.name}
+ </InputCommandItem>
+ ))}
+ </ScrollArea>
+ </InputCommandGroup>
+ </InputCommand>
+ </PopoverContent>
+ </Popover>
+ {field.value.length > 0 && (
+ <div className="mt-2 flex flex-wrap gap-1">
+ {field.value.map((datasetId) => {
+ const dataset = datasets.data?.find(
+ (d) => d.id === datasetId,
+ );
+ return (
+ <Badge
+ key={datasetId}
+ variant="secondary"
+ className="mb-1 mr-1"
+ >
+ {dataset?.name || datasetId}
+ </Badge>
+ );
+ })}
+ </div>
+ )}
<FormMessage />
</FormItem>
)}
/>
+ </div>
+ <div className="ph-no-capture min-h-0 flex-1 overflow-y-auto">
+ <div className="grid gap-4 md:grid-cols-2">
+ <FormField
+ control={form.control}
+ name="input"
+ render={({ field }) => (
+ <FormItem className="flex flex-col gap-2">
+ <FormLabel>Input</FormLabel>
+ <FormControl>
+ <CodeMirrorEditor
+ mode="json"
+ value={field.value}
+ onChange={field.onChange}
+ minHeight={200}
+ />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ <FormField
+ control={form.control}
+ name="expectedOutput"
+ render={({ field }) => (
+ <FormItem className="flex flex-col gap-2">
+ <FormLabel>Expected output</FormLabel>
+ <FormControl>
+ <CodeMirrorEditor
+ mode="json"
+ value={field.value}
+ onChange={field.onChange}
+ minHeight={200}
+ />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ </div>
<FormField
control={form.control}
- name="expectedOutput"
+ name="metadata"
render={({ field }) => (
- <FormItem className="flex flex-col gap-2">
- <FormLabel>Expected output</FormLabel>
+ <FormItem className="mt-4 flex flex-col gap-2">
+ <FormLabel>Metadata</FormLabel>
<FormControl>
<CodeMirrorEditor
mode="json"
value={field.value}
onChange={field.onChange}
- minHeight={200}
+ minHeight={100}
/>
</FormControl>
<FormMessage />
@@ -282,26 +307,8 @@ export const NewDatasetItemForm = (props: {
)}
/>
</div>
- <FormField
- control={form.control}
- name="metadata"
- render={({ field }) => (
- <FormItem className="mt-4 flex flex-col gap-2">
- <FormLabel>Metadata</FormLabel>
- <FormControl>
- <CodeMirrorEditor
- mode="json"
- value={field.value}
- onChange={field.onChange}
- minHeight={100}
- />
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
- </div>
- <div className="mt-3 flex-none">
+ </DialogBody>
+ <DialogFooter>
<Button
type="submit"
loading={createManyDatasetItemsMutation.isLoading}
@@ -315,7 +322,7 @@ export const NewDatasetItemForm = (props: {
<span className="font-bold">Error:</span> {formError}
</p>
) : null}
- </div>
+ </DialogFooter>
</form>
</Form>
);
diff --git a/web/src/features/datasets/components/PreviewCsvImport.tsx b/web/src/features/datasets/components/PreviewCsvImport.tsx
index f3cf73466f..2d2c248289 100644
--- a/web/src/features/datasets/components/PreviewCsvImport.tsx
+++ b/web/src/features/datasets/components/PreviewCsvImport.tsx
@@ -22,6 +22,7 @@ import { showErrorToast } from "@/src/features/notifications/showErrorToast";
import { MAX_FILE_SIZE_BYTES } from "@/src/features/datasets/components/UploadDatasetCsv";
import { Progress } from "@/src/components/ui/progress";
import { usePostHogClientCapture } from "@/src/features/posthog-analytics/usePostHogClientCapture";
+import { DialogBody, DialogFooter } from "@/src/components/ui/dialog";
const MIN_CHUNK_SIZE = 1;
const CHUNK_START_SIZE = 50;
@@ -330,131 +331,139 @@ export function PreviewCsvImport({
};
return (
- <Card className="flex min-h-0 flex-1 flex-col items-center justify-center overflow-hidden p-2">
- <CardHeader className="shrink-0 text-center">
- <CardTitle className="text-lg">Import {preview.fileName}</CardTitle>
- <CardDescription>
- Map your CSV columns to dataset fields. The CSV file must have column
- headers in the first row.
- </CardDescription>
- </CardHeader>
- <CardContent className="flex min-h-0 w-full flex-1 flex-col p-2">
- <div className="min-h-0 flex-1">
- <DndContext
- collisionDetection={closestCenter}
- onDragEnd={handleDragEnd}
- >
- <div className="grid h-full grid-cols-2 gap-4 lg:grid-cols-4">
- <ImportCard
- id="input"
- title="Input"
- columns={preview.columns.filter((col) =>
- selectedInputColumn.has(col.name),
- )}
- onColumnSelect={(columnName) => {
- setSelectedInputColumn(
- new Set([...selectedInputColumn, columnName]),
- );
- }}
- onColumnRemove={(columnName) => {
- setSelectedInputColumn(
- new Set(
- [...selectedInputColumn].filter(
- (col) => col !== columnName,
- ),
- ),
- );
- }}
- />
- <ImportCard
- id="expected"
- title="Expected Output"
- columns={preview.columns.filter((col) =>
- selectedExpectedColumn.has(col.name),
- )}
- onColumnSelect={(columnName) => {
- setSelectedExpectedColumn(
- new Set([...selectedExpectedColumn, columnName]),
- );
- }}
- onColumnRemove={(columnName) => {
- setSelectedExpectedColumn(
- new Set(
- [...selectedExpectedColumn].filter(
- (col) => col !== columnName,
- ),
- ),
- );
- }}
- />
- <ImportCard
- id="metadata"
- title="Metadata"
- columns={preview.columns.filter((col) =>
- selectedMetadataColumn.has(col.name),
- )}
- onColumnSelect={(columnName) => {
- setSelectedMetadataColumn(
- new Set([...selectedMetadataColumn, columnName]),
- );
- }}
- onColumnRemove={(columnName) => {
- setSelectedMetadataColumn(
- new Set(
- [...selectedMetadataColumn].filter(
- (col) => col !== columnName,
- ),
- ),
- );
- }}
- />
- <ImportCard
- id="unmapped"
- title="Not mapped"
- info="These columns from your CSV will not be imported. Drag them to a field to include them."
- columns={preview.columns.filter((col) =>
- excludedColumns.has(col.name),
- )}
- onColumnSelect={(columnName) => {
- setExcludedColumns(new Set([...excludedColumns, columnName]));
- }}
- onColumnRemove={(columnName) => {
- setExcludedColumns(
- new Set(
- [...excludedColumns].filter((col) => col !== columnName),
- ),
- );
- }}
- className="bg-secondary/50"
- />
+ <>
+ <DialogBody className="border-t">
+ <Card className="flex min-h-0 flex-1 flex-col items-center justify-center overflow-hidden border-none pb-4">
+ <CardHeader className="shrink-0 text-center">
+ <CardTitle className="text-lg">Import {preview.fileName}</CardTitle>
+ <CardDescription>
+ Map your CSV columns to dataset fields. The CSV file must have
+ column headers in the first row.
+ </CardDescription>
+ </CardHeader>
+ <CardContent className="flex min-h-0 w-full flex-1 flex-col p-2">
+ <div className="min-h-0 flex-1">
+ <DndContext
+ collisionDetection={closestCenter}
+ onDragEnd={handleDragEnd}
+ >
+ <div className="grid h-full grid-cols-2 gap-4 lg:grid-cols-4">
+ <ImportCard
+ id="input"
+ title="Input"
+ columns={preview.columns.filter((col) =>
+ selectedInputColumn.has(col.name),
+ )}
+ onColumnSelect={(columnName) => {
+ setSelectedInputColumn(
+ new Set([...selectedInputColumn, columnName]),
+ );
+ }}
+ onColumnRemove={(columnName) => {
+ setSelectedInputColumn(
+ new Set(
+ [...selectedInputColumn].filter(
+ (col) => col !== columnName,
+ ),
+ ),
+ );
+ }}
+ />
+ <ImportCard
+ id="expected"
+ title="Expected Output"
+ columns={preview.columns.filter((col) =>
+ selectedExpectedColumn.has(col.name),
+ )}
+ onColumnSelect={(columnName) => {
+ setSelectedExpectedColumn(
+ new Set([...selectedExpectedColumn, columnName]),
+ );
+ }}
+ onColumnRemove={(columnName) => {
+ setSelectedExpectedColumn(
+ new Set(
+ [...selectedExpectedColumn].filter(
+ (col) => col !== columnName,
+ ),
+ ),
+ );
+ }}
+ />
+ <ImportCard
+ id="metadata"
+ title="Metadata"
+ columns={preview.columns.filter((col) =>
+ selectedMetadataColumn.has(col.name),
+ )}
+ onColumnSelect={(columnName) => {
+ setSelectedMetadataColumn(
+ new Set([...selectedMetadataColumn, columnName]),
+ );
+ }}
+ onColumnRemove={(columnName) => {
+ setSelectedMetadataColumn(
+ new Set(
+ [...selectedMetadataColumn].filter(
+ (col) => col !== columnName,
+ ),
+ ),
+ );
+ }}
+ />
+ <ImportCard
+ id="unmapped"
+ title="Not mapped"
+ info="These columns from your CSV will not be imported. Drag them to a field to include them."
+ columns={preview.columns.filter((col) =>
+ excludedColumns.has(col.name),
+ )}
+ onColumnSelect={(columnName) => {
+ setExcludedColumns(
+ new Set([...excludedColumns, columnName]),
+ );
+ }}
+ onColumnRemove={(columnName) => {
+ setExcludedColumns(
+ new Set(
+ [...excludedColumns].filter(
+ (col) => col !== columnName,
+ ),
+ ),
+ );
+ }}
+ className="bg-secondary/50"
+ />
+ </div>
+ </DndContext>
</div>
- </DndContext>
- </div>
- <div className="mt-3 flex justify-end space-x-2">
- <Button
- variant="outline"
- onClick={() => {
- setPreview(null);
- setSelectedInputColumn(new Set());
- setSelectedExpectedColumn(new Set());
- setSelectedMetadataColumn(new Set());
- setExcludedColumns(new Set());
- setCsvFile(null);
- }}
- >
- Cancel
- </Button>
- <Button
- disabled={
- selectedInputColumn.size === 0 &&
- selectedExpectedColumn.size === 0 &&
- selectedMetadataColumn.size === 0
- }
- onClick={handleImport}
- >
- Import
- </Button>
- </div>
+ </CardContent>
+ </Card>
+ </DialogBody>
+ <DialogFooter>
+ <Button
+ variant="outline"
+ onClick={() => {
+ setPreview(null);
+ setSelectedInputColumn(new Set());
+ setSelectedExpectedColumn(new Set());
+ setSelectedMetadataColumn(new Set());
+ setExcludedColumns(new Set());
+ setCsvFile(null);
+ }}
+ >
+ Cancel
+ </Button>
+ <Button
+ disabled={
+ selectedInputColumn.size === 0 &&
+ selectedExpectedColumn.size === 0 &&
+ selectedMetadataColumn.size === 0
+ }
+ onClick={handleImport}
+ >
+ Import
+ </Button>
{progress.status === "processing" && (
<div className="mt-2">
<Progress
@@ -463,7 +472,7 @@ export function PreviewCsvImport({
/>
</div>
)}
- </CardContent>
- </Card>
+ </DialogFooter>
+ </>
);
}
diff --git a/web/src/features/datasets/components/UploadDatasetCsv.tsx b/web/src/features/datasets/components/UploadDatasetCsv.tsx
index df773b7273..bc668b3803 100644
--- a/web/src/features/datasets/components/UploadDatasetCsv.tsx
+++ b/web/src/features/datasets/components/UploadDatasetCsv.tsx
@@ -14,6 +14,7 @@ import {
type CsvPreviewResult,
parseCsvClient,
} from "@/src/features/datasets/lib/csvHelpers";
+import { DialogBody } from "@/src/components/ui/dialog";
export const MAX_FILE_SIZE_BYTES = 1024 * 1024 * 1 * 10; // 10MB
const ACCEPTED_FILE_TYPES = ["text/csv"] as const;
@@ -76,35 +77,37 @@ export const UploadDatasetCsv = ({
};
return (
- <Card className="h-full items-center justify-center p-2">
- <CardHeader className="text-center">
- <CardTitle className="text-lg">Add items to dataset</CardTitle>
- <CardDescription>
- Add items to dataset by uploading a file, add items manually or via
- our SDKs/API
- </CardDescription>
- </CardHeader>
- <CardContent>
- {/* Hidden file input */}
- <Input
- type="file"
- ref={fileInputRef}
- className="hidden"
- accept=".csv"
- onChange={handleFileSelect}
- />
+ <DialogBody className="border-t">
+ <Card className="h-full items-center justify-center border-none">
+ <CardHeader className="text-center">
+ <CardTitle className="text-lg">Add items to dataset</CardTitle>
+ <CardDescription>
+ Add items to dataset by uploading a file, add items manually or via
+ our SDKs/API
+ </CardDescription>
+ </CardHeader>
+ <CardContent>
+ {/* Hidden file input */}
+ <Input
+ type="file"
+ ref={fileInputRef}
+ className="hidden"
+ accept=".csv"
+ onChange={handleFileSelect}
+ />
- {/* Clickable upload area */}
- <div
- className="flex max-h-full min-h-0 w-full cursor-pointer flex-col items-center justify-center gap-2 overflow-y-auto rounded-lg border border-dashed bg-secondary/50 p-4"
- onClick={() => fileInputRef.current?.click()}
- >
- <UploadIcon className="h-6 w-6 text-secondary-foreground" />
- <div className="text-sm text-secondary-foreground">
- Click to select a CSV file
+ {/* Clickable upload area */}
+ <div
+ className="flex max-h-full min-h-0 w-full cursor-pointer flex-col items-center justify-center gap-2 overflow-y-auto rounded-lg border border-dashed bg-secondary/50 p-4"
+ onClick={() => fileInputRef.current?.click()}
+ >
+ <UploadIcon className="h-6 w-6 text-secondary-foreground" />
+ <div className="text-sm text-secondary-foreground">
+ Click to select a CSV file
+ </div>
</div>
- </div>
- </CardContent>
- </Card>
+ </CardContent>
+ </Card>
+ </DialogBody>
);
};
diff --git a/web/src/features/evals/components/eval-templates-table.tsx b/web/src/features/evals/components/eval-templates-table.tsx
index eb9bb07e74..2464a830a3 100644
--- a/web/src/features/evals/components/eval-templates-table.tsx
+++ b/web/src/features/evals/components/eval-templates-table.tsx
@@ -377,7 +377,9 @@ export default function EvalsTemplateTable({
}}
>
<DialogContent className="max-h-[90vh] max-w-screen-md overflow-y-auto">
- <DialogTitle>Edit evaluator</DialogTitle>
+ <DialogHeader>
+ <DialogTitle>Edit evaluator</DialogTitle>
+ </DialogHeader>
<EvalTemplateForm
projectId={projectId}
preventRedirect={true}
@@ -404,7 +406,9 @@ export default function EvalsTemplateTable({
}}
>
<DialogContent className="max-h-[90vh] max-w-screen-md overflow-y-auto">
- <DialogTitle>Clone evaluator</DialogTitle>
+ <DialogHeader>
+ <DialogTitle>Clone evaluator</DialogTitle>
+ </DialogHeader>
<EvalTemplateForm
projectId={projectId}
preventRedirect={true}
diff --git a/web/src/features/evals/components/evaluator-table.tsx b/web/src/features/evals/components/evaluator-table.tsx
index 88e0e8bac9..8ac2d53870 100644
--- a/web/src/features/evals/components/evaluator-table.tsx
+++ b/web/src/features/evals/components/evaluator-table.tsx
@@ -35,7 +35,12 @@ import {
} from "@/src/components/ui/dropdown-menu";
import { Button } from "@/src/components/ui/button";
import { showSuccessToast } from "@/src/features/notifications/showSuccessToast";
-import { Dialog, DialogContent, DialogTitle } from "@/src/components/ui/dialog";
+import {
+ Dialog,
+ DialogContent,
+ DialogHeader,
+ DialogTitle,
+} from "@/src/components/ui/dialog";
import { EvaluatorForm } from "@/src/features/evals/components/evaluator-form";
import { useRouter } from "next/router";
import { DeleteEvalConfigButton } from "@/src/components/deleteButton";
@@ -419,7 +424,9 @@ export default function EvaluatorTable({ projectId }: { projectId: string }) {
}}
>
<DialogContent className="max-h-[90vh] max-w-screen-xl overflow-y-auto">
- <DialogTitle>Edit configuration</DialogTitle>
+ <DialogHeader>
+ <DialogTitle>Edit configuration</DialogTitle>
+ </DialogHeader>
{existingEvaluator.isLoading ? (
<div className="flex items-center justify-center p-4">
<Loader2 className="h-6 w-6 animate-spin" />
diff --git a/web/src/features/evals/components/select-evaluator-list.tsx b/web/src/features/evals/components/select-evaluator-list.tsx
index a31a61ebd9..9e0b105f3d 100644
--- a/web/src/features/evals/components/select-evaluator-list.tsx
+++ b/web/src/features/evals/components/select-evaluator-list.tsx
@@ -1,7 +1,12 @@
import { useState } from "react";
import { useRouter } from "next/router";
import { api } from "@/src/utils/api";
-import { Dialog, DialogContent, DialogTitle } from "@/src/components/ui/dialog";
+import {
+ Dialog,
+ DialogContent,
+ DialogHeader,
+ DialogTitle,
+} from "@/src/components/ui/dialog";
import { Button } from "@/src/components/ui/button";
import { PlusIcon } from "lucide-react";
import { EvaluatorSelector } from "./evaluator-selector";
@@ -109,7 +114,9 @@ export function SelectEvaluatorList({ projectId }: SelectEvaluatorListProps) {
onOpenChange={setIsCreateTemplateOpen}
>
<DialogContent className="max-h-[90vh] max-w-screen-md overflow-y-auto">
- <DialogTitle>Create new evaluator</DialogTitle>
+ <DialogHeader>
+ <DialogTitle>Create new evaluator</DialogTitle>
+ </DialogHeader>
<EvalTemplateForm
projectId={projectId}
preventRedirect={true}
diff --git a/web/src/features/evals/components/template-form.tsx b/web/src/features/evals/components/template-form.tsx
index 6d56236408..67237f78a8 100644
--- a/web/src/features/evals/components/template-form.tsx
+++ b/web/src/features/evals/components/template-form.tsx
@@ -35,6 +35,7 @@ import { type RouterInput } from "@/src/utils/types";
import { useEvaluationModel } from "@/src/features/evals/hooks/useEvaluationModel";
import { Checkbox } from "@/src/components/ui/checkbox";
import { ManageDefaultEvalModel } from "@/src/features/evals/components/manage-default-eval-model";
+import { DialogFooter, DialogBody } from "@/src/components/ui/dialog";
type PartialEvalTemplate = Omit<
EvalTemplate,
@@ -344,174 +345,178 @@ export const InnerEvalTemplateForm = (props: {
onSubmit={form.handleSubmit(onSubmit)}
className="mt-2 space-y-4"
>
- {!props.existingEvalTemplateId ? (
- <>
- <div className="col-span-1 row-span-1 lg:col-span-2">
+ <DialogBody>
+ {!props.existingEvalTemplateId ? (
+ <>
+ <div className="col-span-1 row-span-1 lg:col-span-2">
+ <FormField
+ control={form.control}
+ name="name"
+ render={({ field }) => (
+ <>
+ <FormItem>
+ <FormLabel>Name</FormLabel>
+ <FormControl>
+ <Input
+ {...field}
+ placeholder="Select a template name"
+ />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ </>
+ )}
+ />
+ </div>
+ <div className="lg:col-span-0 col-span-1 row-span-1"></div>
+ </>
+ ) : undefined}
+
+ {/* Model Selection Section */}
+ <Card>
+ <CardContent>
+ <p className="my-2 font-semibold">Model</p>
<FormField
control={form.control}
- name="name"
+ name="shouldUseDefaultModel"
render={({ field }) => (
- <>
- <FormItem>
- <FormLabel>Name</FormLabel>
- <FormControl>
- <Input
- {...field}
- placeholder="Select a template name"
+ <FormItem className="mt-3 flex flex-row items-center space-x-3 space-y-0">
+ <FormControl>
+ <Checkbox
+ checked={field.value}
+ onCheckedChange={field.onChange}
+ disabled={!props.isEditing}
+ />
+ </FormControl>
+ <div className="space-y-0 leading-none">
+ <FormLabel>Use default evaluation model</FormLabel>
+ <FormDescription className="text-xs">
+ <ManageDefaultEvalModel
+ projectId={props.projectId}
+ variant="color-coded"
+ setUpMessage="No default model set. Set up default evaluation model"
+ className="text-sm font-normal"
/>
- </FormControl>
- <FormMessage />
- </FormItem>
- </>
+ </FormDescription>
+ </div>
+ </FormItem>
)}
/>
- </div>
- <div className="lg:col-span-0 col-span-1 row-span-1"></div>
- </>
- ) : undefined}
+ {/* Only show model parameters if using custom model */}
+ {!useDefaultModel && (
+ <ModelParameters
+ customHeader={
+ <p className="text-sm font-medium leading-none">
+ Custom model configuration
+ </p>
+ }
+ {...{
+ modelParams,
+ availableModels,
+ availableProviders,
+ updateModelParamValue: updateModelParamValue,
+ setModelParamEnabled,
+ modelParamsDescription:
+ "Select a model which supports function calling.",
+ }}
+ formDisabled={!props.isEditing}
+ />
+ )}
+ </CardContent>
+ </Card>
- {/* Model Selection Section */}
- <Card>
- <CardContent>
- <p className="my-2 font-semibold">Model</p>
- <FormField
- control={form.control}
- name="shouldUseDefaultModel"
- render={({ field }) => (
- <FormItem className="mt-3 flex flex-row items-center space-x-3 space-y-0">
- <FormControl>
- <Checkbox
- checked={field.value}
- onCheckedChange={field.onChange}
- disabled={!props.isEditing}
- />
- </FormControl>
- <div className="space-y-0 leading-none">
- <FormLabel>Use default evaluation model</FormLabel>
- <FormDescription className="text-xs">
- <ManageDefaultEvalModel
- projectId={props.projectId}
- variant="color-coded"
- setUpMessage="No default model set. Set up default evaluation model"
- className="text-sm font-normal"
- />
+ <Card>
+ <CardContent className="space-y-6">
+ <div className="space-y-2">
+ <p className="my-2 font-semibold">Prompt</p>
+ <FormField
+ control={form.control}
+ name="prompt"
+ render={({ field }) => (
+ <>
+ <FormItem>
+ <FormLabel>Evaluation prompt</FormLabel>
+ <FormDescription>
+ Define your llm-as-a-judge evaluation template. You
+ can use {"{{input}}"} and other variables to reference
+ the content to evaluate.
+ </FormDescription>
+ <FormControl>
+ <CodeMirrorEditor
+ value={field.value}
+ onChange={field.onChange}
+ editable={props.isEditing}
+ mode="prompt"
+ minHeight={200}
+ />
+ </FormControl>
+ <FormMessage />
+ <PromptVariableListPreview
+ variables={extractedVariables ?? []}
+ />
+ </FormItem>
+ </>
+ )}
+ />
+ </div>
+
+ <FormField
+ control={form.control}
+ name="outputReasoning"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel>Score reasoning prompt</FormLabel>
+ <FormDescription>
+ Define how the LLM should explain its evaluation. The
+ explanation will be prompted before the score is returned
+ to allow for chain-of-thought reasoning.
</FormDescription>
- </div>
- </FormItem>
- )}
- />
- {/* Only show model parameters if using custom model */}
- {!useDefaultModel && (
- <ModelParameters
- customHeader={
- <p className="text-sm font-medium leading-none">
- Custom model configuration
- </p>
- }
- {...{
- modelParams,
- availableModels,
- availableProviders,
- updateModelParamValue: updateModelParamValue,
- setModelParamEnabled,
- modelParamsDescription:
- "Select a model which supports function calling.",
- }}
- formDisabled={!props.isEditing}
+ <FormControl>
+ <Input {...field} />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
/>
- )}
- </CardContent>
- </Card>
- <Card>
- <CardContent className="space-y-6">
- <div className="space-y-2">
- <p className="my-2 font-semibold">Prompt</p>
<FormField
control={form.control}
- name="prompt"
+ name="outputScore"
render={({ field }) => (
- <>
- <FormItem>
- <FormLabel>Evaluation prompt</FormLabel>
- <FormDescription>
- Define your llm-as-a-judge evaluation template. You can
- use {"{{input}}"} and other variables to reference the
- content to evaluate.
- </FormDescription>
- <FormControl>
- <CodeMirrorEditor
- value={field.value}
- onChange={field.onChange}
- editable={props.isEditing}
- mode="prompt"
- minHeight={200}
- />
- </FormControl>
- <FormMessage />
- <PromptVariableListPreview
- variables={extractedVariables ?? []}
- />
- </FormItem>
- </>
+ <FormItem>
+ <FormLabel>Score range prompt</FormLabel>
+ <FormDescription>
+ Define how the LLM should return the evaluation score in
+ natural language. Needs to yield a numeric value.
+ </FormDescription>
+ <FormControl>
+ <Input {...field} />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
)}
/>
- </div>
-
- <FormField
- control={form.control}
- name="outputReasoning"
- render={({ field }) => (
- <FormItem>
- <FormLabel>Score reasoning prompt</FormLabel>
- <FormDescription>
- Define how the LLM should explain its evaluation. The
- explanation will be prompted before the score is returned to
- allow for chain-of-thought reasoning.
- </FormDescription>
- <FormControl>
- <Input {...field} />
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
-
- <FormField
- control={form.control}
- name="outputScore"
- render={({ field }) => (
- <FormItem>
- <FormLabel>Score range prompt</FormLabel>
- <FormDescription>
- Define how the LLM should return the evaluation score in
- natural language. Needs to yield a numeric value.
- </FormDescription>
- <FormControl>
- <Input {...field} />
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
- </CardContent>
- </Card>
+ </CardContent>
+ </Card>
+ </DialogBody>
- {props.isEditing && (
- <Button
- type="submit"
- loading={createEvalTemplateMutation.isLoading}
- className="w-full"
- >
- Save
- </Button>
- )}
+ <DialogFooter>
+ {props.isEditing && (
+ <Button
+ type="submit"
+ loading={createEvalTemplateMutation.isLoading}
+ className="w-full"
+ >
+ Save
+ </Button>
+ )}
+ {formError ? (
+ <p className="text-red text-center">
+ <span className="font-bold">Error:</span> {formError}
+ </p>
+ ) : null}
+ </DialogFooter>
</form>
- {formError ? (
- <p className="text-red text-center">
- <span className="font-bold">Error:</span> {formError}
- </p>
- ) : null}
</Form>
);
};
diff --git a/web/src/features/experiments/components/CreateExperimentsForm.tsx b/web/src/features/experiments/components/CreateExperimentsForm.tsx
index f41f17261f..958aa380eb 100644
--- a/web/src/features/experiments/components/CreateExperimentsForm.tsx
+++ b/web/src/features/experiments/components/CreateExperimentsForm.tsx
@@ -62,6 +62,8 @@ import {
DialogDescription,
Dialog,
DialogContent,
+ DialogBody,
+ DialogFooter,
} from "@/src/components/ui/dialog";
import Link from "next/link";
import { usePostHogClientCapture } from "@/src/features/posthog-analytics/usePostHogClientCapture";
@@ -292,82 +294,84 @@ export const CreateExperimentsForm = ({
.
</DialogDescription>
</DialogHeader>
- <div className="flex flex-col gap-2 sm:flex-row">
- <Card className="flex flex-1 flex-col">
- <CardHeader>
- <CardTitle className="flex items-center gap-2 text-lg">
- <Wand2 className="size-4" />
- Prompt Experiment
- </CardTitle>
- <CardDescription>
- Test single prompts and model configurations via Langfuse UI
- </CardDescription>
- </CardHeader>
- <CardContent>
- <ul className="list-disc space-y-2 pl-4 text-sm text-muted-foreground">
- <li>Compare prompt versions</li>
- <li>Compare model configurations</li>
- <li>No code required</li>
- </ul>
- </CardContent>
- <CardFooter className="mt-auto flex flex-row gap-2">
- <Button
- className="w-full"
- onClick={() => setShowPromptForm(true)}
- >
- Create
- </Button>
- <Button
- variant="secondary"
- className="w-full"
- asChild
- onClick={() =>
- capture("dataset_run:view_prompt_experiment_docs")
- }
- >
- <Link href="https://langfuse.com/docs/datasets/prompt-experiments">
- View Docs
- </Link>
- </Button>
- </CardFooter>
- </Card>
-
- <Card className="flex flex-1 flex-col">
- <CardHeader>
- <CardTitle className="flex items-center gap-2 text-lg">
- <Code2 className="size-4" />
- Custom Experiment
- </CardTitle>
- <CardDescription>
- Run any experiment via the Langfuse SDKs
- </CardDescription>
- </CardHeader>
- <CardContent>
- <ul className="list-disc space-y-2 pl-4 text-sm text-muted-foreground">
- <li>Full control over experiment execution</li>
- <li>Custom evaluation logic</li>
- <li>Integration with your codebase</li>
- </ul>
- </CardContent>
- <CardFooter className="mt-auto">
- <Button
- className="w-full"
- variant="secondary"
- asChild
- onClick={() =>
- capture("dataset_run:view_custom_experiment_docs")
- }
- >
- <Link
- href="https://langfuse.com/docs/datasets/get-started"
- target="_blank"
+ <DialogBody>
+ <div className="flex flex-col gap-2 sm:flex-row">
+ <Card className="flex flex-1 flex-col">
+ <CardHeader>
+ <CardTitle className="flex items-center gap-2 text-lg">
+ <Wand2 className="size-4" />
+ Prompt Experiment
+ </CardTitle>
+ <CardDescription>
+ Test single prompts and model configurations via Langfuse UI
+ </CardDescription>
+ </CardHeader>
+ <CardContent>
+ <ul className="list-disc space-y-2 pl-4 text-sm text-muted-foreground">
+ <li>Compare prompt versions</li>
+ <li>Compare model configurations</li>
+ <li>No code required</li>
+ </ul>
+ </CardContent>
+ <CardFooter className="mt-auto flex flex-row gap-2">
+ <Button
+ className="w-full"
+ onClick={() => setShowPromptForm(true)}
>
- View Docs
- </Link>
- </Button>
- </CardFooter>
- </Card>
- </div>
+ Create
+ </Button>
+ <Button
+ variant="secondary"
+ className="w-full"
+ asChild
+ onClick={() =>
+ capture("dataset_run:view_prompt_experiment_docs")
+ }
+ >
+ <Link href="https://langfuse.com/docs/datasets/prompt-experiments">
+ View Docs
+ </Link>
+ </Button>
+ </CardFooter>
+ </Card>
+
+ <Card className="flex flex-1 flex-col">
+ <CardHeader>
+ <CardTitle className="flex items-center gap-2 text-lg">
+ <Code2 className="size-4" />
+ Custom Experiment
+ </CardTitle>
+ <CardDescription>
+ Run any experiment via the Langfuse SDKs
+ </CardDescription>
+ </CardHeader>
+ <CardContent>
+ <ul className="list-disc space-y-2 pl-4 text-sm text-muted-foreground">
+ <li>Full control over experiment execution</li>
+ <li>Custom evaluation logic</li>
+ <li>Integration with your codebase</li>
+ </ul>
+ </CardContent>
+ <CardFooter className="mt-auto">
+ <Button
+ className="w-full"
+ variant="secondary"
+ asChild
+ onClick={() =>
+ capture("dataset_run:view_custom_experiment_docs")
+ }
+ >
+ <Link
+ href="https://langfuse.com/docs/datasets/get-started"
+ target="_blank"
+ >
+ View Docs
+ </Link>
+ </Button>
+ </CardFooter>
+ </Card>
+ </div>
+ </DialogBody>
</>
);
}
@@ -406,353 +410,361 @@ export const CreateExperimentsForm = ({
</DialogHeader>
<Form {...form}>
<form className="space-y-6" onSubmit={form.handleSubmit(onSubmit)}>
- <FormField
- control={form.control}
- name="name"
- render={({ field }) => (
- <FormItem>
- <FormLabel>Experiment name (optional)</FormLabel>
- <FormControl>
- <Input {...field} type="string" />
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
- <FormField
- control={form.control}
- name="description"
- render={({ field }) => (
- <FormItem>
- <FormLabel>Description (optional)</FormLabel>
- <FormControl>
- <Textarea
- {...field}
- placeholder="Add description..."
- className="focus:outline-none focus:ring-0 focus-visible:ring-0 focus-visible:ring-offset-0 active:ring-0"
- />
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
- <FormField
- control={form.control}
- name="promptId"
- render={() => (
- <FormItem>
- <FormLabel>Prompt</FormLabel>
- <div className="mb-2 flex gap-2">
- <Popover open={open} onOpenChange={setOpen}>
- <PopoverTrigger asChild>
- <Button
- variant="outline"
- role="combobox"
- aria-expanded={open}
- className="w-2/3 justify-between px-2 font-normal"
+ <DialogBody>
+ <FormField
+ control={form.control}
+ name="name"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel>Experiment name (optional)</FormLabel>
+ <FormControl>
+ <Input {...field} type="string" />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ <FormField
+ control={form.control}
+ name="description"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel>Description (optional)</FormLabel>
+ <FormControl>
+ <Textarea
+ {...field}
+ placeholder="Add description..."
+ className="focus:outline-none focus:ring-0 focus-visible:ring-0 focus-visible:ring-offset-0 active:ring-0"
+ />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ <FormField
+ control={form.control}
+ name="promptId"
+ render={() => (
+ <FormItem>
+ <FormLabel>Prompt</FormLabel>
+ <div className="mb-2 flex gap-2">
+ <Popover open={open} onOpenChange={setOpen}>
+ <PopoverTrigger asChild>
+ <Button
+ variant="outline"
+ role="combobox"
+ aria-expanded={open}
+ className="w-2/3 justify-between px-2 font-normal"
+ >
+ {selectedPromptName || "Select a prompt"}
+ <ChevronDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
+ </Button>
+ </PopoverTrigger>
+ <PopoverContent
+ className="w-[--radix-popover-trigger-width] overflow-auto p-0"
+ align="start"
>
- {selectedPromptName || "Select a prompt"}
- <ChevronDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
- </Button>
- </PopoverTrigger>
- <PopoverContent
- className="w-[--radix-popover-trigger-width] overflow-auto p-0"
- align="start"
- >
- <InputCommand>
- <InputCommandInput
- placeholder="Search prompts..."
- className="h-9"
- />
- <InputCommandList>
- <InputCommandEmpty>
- No prompt found.
- </InputCommandEmpty>
- <InputCommandGroup>
- {promptsByName &&
- Object.entries(promptsByName).map(
- ([name, promptData]) => (
- <InputCommandItem
- key={name}
- onSelect={() => {
- setSelectedPromptName(name);
- const latestVersion = promptData[0];
- setSelectedPromptVersion(
- latestVersion.version,
- );
- form.setValue(
- "promptId",
- latestVersion.id,
- );
- form.clearErrors("promptId");
- }}
- >
- {name}
- <CheckIcon
- className={cn(
- "ml-auto h-4 w-4",
- name === selectedPromptName
- ? "opacity-100"
- : "opacity-0",
- )}
- />
- </InputCommandItem>
- ),
- )}
- </InputCommandGroup>
- </InputCommandList>
- </InputCommand>
- </PopoverContent>
- </Popover>
-
- <Popover>
- <PopoverTrigger asChild>
- <Button
- disabled={!selectedPromptName}
- variant="outline"
- role="combobox"
- className="w-1/3 justify-between px-2 font-normal"
+ <InputCommand>
+ <InputCommandInput
+ placeholder="Search prompts..."
+ className="h-9"
+ />
+ <InputCommandList>
+ <InputCommandEmpty>
+ No prompt found.
+ </InputCommandEmpty>
+ <InputCommandGroup>
+ {promptsByName &&
+ Object.entries(promptsByName).map(
+ ([name, promptData]) => (
+ <InputCommandItem
+ key={name}
+ onSelect={() => {
+ setSelectedPromptName(name);
+ const latestVersion = promptData[0];
+ setSelectedPromptVersion(
+ latestVersion.version,
+ );
+ form.setValue(
+ "promptId",
+ latestVersion.id,
+ );
+ form.clearErrors("promptId");
+ }}
+ >
+ {name}
+ <CheckIcon
+ className={cn(
+ "ml-auto h-4 w-4",
+ name === selectedPromptName
+ ? "opacity-100"
+ : "opacity-0",
+ )}
+ />
+ </InputCommandItem>
+ ),
+ )}
+ </InputCommandGroup>
+ </InputCommandList>
+ </InputCommand>
+ </PopoverContent>
+ </Popover>
+
+ <Popover>
+ <PopoverTrigger asChild>
+ <Button
+ disabled={!selectedPromptName}
+ variant="outline"
+ role="combobox"
+ className="w-1/3 justify-between px-2 font-normal"
+ >
+ {selectedPromptVersion
+ ? `Version ${selectedPromptVersion}`
+ : "Version"}
+ <ChevronDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
+ </Button>
+ </PopoverTrigger>
+ <PopoverContent
+ className="w-[--radix-popover-trigger-width] p-0"
+ align="start"
>
- {selectedPromptVersion
- ? `Version ${selectedPromptVersion}`
- : "Version"}
- <ChevronDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
- </Button>
- </PopoverTrigger>
- <PopoverContent
- className="w-[--radix-popover-trigger-width] p-0"
- align="start"
+ <InputCommand>
+ <InputCommandList>
+ <InputCommandEmpty>
+ No version found.
+ </InputCommandEmpty>
+ <InputCommandGroup className="overflow-y-auto">
+ {promptsByName &&
+ selectedPromptName &&
+ promptsByName[selectedPromptName] ? (
+ promptsByName[selectedPromptName].map(
+ (prompt) => (
+ <InputCommandItem
+ key={prompt.id}
+ onSelect={() => {
+ setSelectedPromptVersion(
+ prompt.version,
+ );
+ form.setValue("promptId", prompt.id);
+ form.clearErrors("promptId");
+ }}
+ >
+ Version {prompt.version}
+ <CheckIcon
+ className={cn(
+ "ml-auto h-4 w-4",
+ prompt.version ===
+ selectedPromptVersion
+ ? "opacity-100"
+ : "opacity-0",
+ )}
+ />
+ </InputCommandItem>
+ ),
+ )
+ ) : (
+ <InputCommandItem disabled>
+ No versions available
+ </InputCommandItem>
+ )}
+ </InputCommandGroup>
+ </InputCommandList>
+ </InputCommand>
+ </PopoverContent>
+ </Popover>
+ </div>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+
+ <FormField
+ control={form.control}
+ name="modelConfig"
+ render={() => (
+ <FormItem>
+ <Card className="p-4">
+ <ModelParameters
+ {...{
+ modelParams,
+ availableModels,
+ availableProviders,
+ updateModelParamValue: updateModelParamValue,
+ setModelParamEnabled,
+ }}
+ />
+ </Card>
+ {form.formState.errors.modelConfig && (
+ <p
+ id="modelConfig"
+ className={cn("text-sm font-medium text-destructive")}
>
- <InputCommand>
- <InputCommandList>
- <InputCommandEmpty>
- No version found.
- </InputCommandEmpty>
- <InputCommandGroup className="overflow-y-auto">
- {promptsByName &&
- selectedPromptName &&
- promptsByName[selectedPromptName] ? (
- promptsByName[selectedPromptName].map(
- (prompt) => (
- <InputCommandItem
- key={prompt.id}
- onSelect={() => {
- setSelectedPromptVersion(prompt.version);
- form.setValue("promptId", prompt.id);
- form.clearErrors("promptId");
- }}
- >
- Version {prompt.version}
- <CheckIcon
- className={cn(
- "ml-auto h-4 w-4",
- prompt.version === selectedPromptVersion
- ? "opacity-100"
- : "opacity-0",
- )}
- />
- </InputCommandItem>
- ),
- )
+ {[
+ form.formState.errors.modelConfig?.model?.message,
+ form.formState.errors.modelConfig?.provider?.message,
+ ].join(", ")}
+ </p>
+ )}
+ </FormItem>
+ )}
+ />
+
+ <FormField
+ control={form.control}
+ name="datasetId"
+ render={({ field }) => (
+ <FormItem>
+ <div className="flex items-center gap-2">
+ <FormLabel>Dataset</FormLabel>
+ <Popover>
+ <PopoverTrigger asChild>
+ <span className="cursor-pointer text-xs text-muted-foreground">
+ (expected columns)
+ </span>
+ </PopoverTrigger>
+ <PopoverContent className="w-80">
+ <div className="flex flex-col space-y-2">
+ <h4 className="text-sm font-medium leading-none">
+ Expected columns
+ </h4>
+ <span className="text-sm text-muted-foreground">
+ {promptId ? (
+ <div>
+ <span>
+ Given current prompt, dataset item input must
+ contain at least one of these first-level JSON
+ keys, mapped to a string value:
+ </span>
+ <ul className="my-2 ml-2 list-inside list-disc">
+ {expectedColumns.map((col) => (
+ <li key={col}>{col}</li>
+ ))}
+ </ul>
+ <span>
+ These will be used as the input to your
+ prompt.
+ </span>
+ </div>
) : (
- <InputCommandItem disabled>
- No versions available
- </InputCommandItem>
+ "Please select a prompt first"
)}
- </InputCommandGroup>
- </InputCommandList>
- </InputCommand>
- </PopoverContent>
- </Popover>
- </div>
- <FormMessage />
- </FormItem>
- )}
- />
+ </span>
+ </div>
+ </PopoverContent>
+ </Popover>
+ </div>
+ <Select
+ onValueChange={field.onChange}
+ defaultValue={field.value}
+ >
+ <FormControl>
+ <SelectTrigger>
+ <SelectValue placeholder="Select a dataset" />
+ </SelectTrigger>
+ </FormControl>
+ <SelectContent>
+ {datasets.data?.map((dataset) => (
+ <SelectItem value={dataset.id} key={dataset.id}>
+ {dataset.name}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
- <FormField
- control={form.control}
- name="modelConfig"
- render={() => (
+ {evaluators.data && !!datasetId ? (
<FormItem>
- <Card className="p-4">
- <ModelParameters
- {...{
- modelParams,
- availableModels,
- availableProviders,
- updateModelParamValue: updateModelParamValue,
- setModelParamEnabled,
- }}
- />
- </Card>
- {form.formState.errors.modelConfig && (
- <p
- id="modelConfig"
- className={cn("text-sm font-medium text-destructive")}
- >
- {[
- form.formState.errors.modelConfig?.model?.message,
- form.formState.errors.modelConfig?.provider?.message,
- ].join(", ")}
- </p>
- )}
+ <FormLabel>Evaluators</FormLabel>
+ <FormDescription>
+ Will run against your experiment results.
+ </FormDescription>
+ <TemplateSelector
+ projectId={projectId}
+ datasetId={datasetId}
+ evalTemplates={evalTemplates.data?.templates ?? []}
+ onConfigureTemplate={handleConfigureEvaluator}
+ onSelectEvaluator={handleSelectEvaluator}
+ activeTemplateIds={activeEvaluators}
+ inactiveTemplateIds={inActiveEvaluators}
+ />
</FormItem>
- )}
- />
-
- <FormField
- control={form.control}
- name="datasetId"
- render={({ field }) => (
+ ) : (
<FormItem>
- <div className="flex items-center gap-2">
- <FormLabel>Dataset</FormLabel>
- <Popover>
- <PopoverTrigger asChild>
- <span className="cursor-pointer text-xs text-muted-foreground">
- (expected columns)
- </span>
- </PopoverTrigger>
- <PopoverContent className="w-80">
- <div className="flex flex-col space-y-2">
- <h4 className="text-sm font-medium leading-none">
- Expected columns
- </h4>
- <span className="text-sm text-muted-foreground">
- {promptId ? (
- <div>
- <span>
- Given current prompt, dataset item input must
- contain at least one of these first-level JSON
- keys, mapped to a string value:
- </span>
- <ul className="my-2 ml-2 list-inside list-disc">
- {expectedColumns.map((col) => (
- <li key={col}>{col}</li>
- ))}
- </ul>
- <span>
- These will be used as the input to your prompt.
- </span>
- </div>
- ) : (
- "Please select a prompt first"
- )}
- </span>
- </div>
- </PopoverContent>
- </Popover>
- </div>
- <Select
- onValueChange={field.onChange}
- defaultValue={field.value}
- >
- <FormControl>
- <SelectTrigger>
- <SelectValue placeholder="Select a dataset" />
- </SelectTrigger>
- </FormControl>
- <SelectContent>
- {datasets.data?.map((dataset) => (
- <SelectItem value={dataset.id} key={dataset.id}>
- {dataset.name}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- <FormMessage />
+ <FormLabel>Evaluators</FormLabel>
+ {hasEvalReadAccess ? (
+ <FormDescription>
+ Select a dataset first to set up evaluators.
+ </FormDescription>
+ ) : (
+ <FormDescription>
+ ⓘ You do not have access to view evaluators. Please contact
+ your admin to upgrade your role.
+ </FormDescription>
+ )}
</FormItem>
)}
- />
-
- {evaluators.data && !!datasetId ? (
- <FormItem>
- <FormLabel>Evaluators</FormLabel>
- <FormDescription>
- Will run against your experiment results.
- </FormDescription>
- <TemplateSelector
- projectId={projectId}
- datasetId={datasetId}
- evalTemplates={evalTemplates.data?.templates ?? []}
- onConfigureTemplate={handleConfigureEvaluator}
- onSelectEvaluator={handleSelectEvaluator}
- activeTemplateIds={activeEvaluators}
- inactiveTemplateIds={inActiveEvaluators}
- />
- </FormItem>
- ) : (
- <FormItem>
- <FormLabel>Evaluators</FormLabel>
- {hasEvalReadAccess ? (
- <FormDescription>
- Select a dataset first to set up evaluators.
- </FormDescription>
- ) : (
- <FormDescription>
- ⓘ You do not have access to view evaluators. Please contact
- your admin to upgrade your role.
- </FormDescription>
+
+ <div className="mt-4 flex flex-col gap-4">
+ {validationResult.isLoading && Boolean(promptId && datasetId) && (
+ <Card className="relative overflow-hidden rounded-md shadow-none group-data-[collapsible=icon]:hidden">
+ <CardHeader className="p-2">
+ <CardTitle className="flex items-center justify-between text-sm">
+ <span>Validating configuration...</span>
+ <Loader2 className="h-3 w-3 animate-spin" />
+ </CardTitle>
+ <CardDescription className="text-foreground">
+ Checking dataset items against prompt variables
+ </CardDescription>
+ </CardHeader>
+ </Card>
)}
- </FormItem>
- )}
-
- <div className="mt-4 flex flex-col gap-4">
- {validationResult.isLoading && Boolean(promptId && datasetId) && (
- <Card className="relative overflow-hidden rounded-md shadow-none group-data-[collapsible=icon]:hidden">
- <CardHeader className="p-2">
- <CardTitle className="flex items-center justify-between text-sm">
- <span>Validating configuration...</span>
- <Loader2 className="h-3 w-3 animate-spin" />
- </CardTitle>
- <CardDescription className="text-foreground">
- Checking dataset items against prompt variables
- </CardDescription>
- </CardHeader>
- </Card>
- )}
- {validationResult.data?.isValid === false && (
- <Card className="relative overflow-hidden rounded-md border-dark-yellow bg-light-yellow shadow-none group-data-[collapsible=icon]:hidden">
- <CardHeader className="p-2">
- <CardTitle className="flex items-center justify-between text-sm text-dark-yellow">
- <span>Invalid configuration</span>
- <Info className="h-4 w-4" />
- </CardTitle>
- <CardDescription className="text-foreground">
- {validationResult.data?.message}
- </CardDescription>
- </CardHeader>
- </Card>
- )}
- {validationResult.data?.isValid === true && (
- <Card className="relative overflow-hidden rounded-md border-dark-green bg-light-green shadow-none group-data-[collapsible=icon]:hidden">
- <CardHeader className="p-2">
- <CardTitle className="flex items-center justify-between text-sm text-dark-green">
- <span>Valid configuration</span>
- <CircleCheck className="h-4 w-4" />
- </CardTitle>
- <div className="text-sm">
- Matches between dataset items and prompt variables
- <ul className="my-2 ml-2 list-inside list-disc">
- {Object.entries(
- validationResult.data.variablesMap ?? {},
- ).map(([variable, count]) => (
- <li key={variable}>
- <strong>{variable}:</strong> {count} /{" "}
- {validationResult.data?.isValid
- ? validationResult.data.totalItems
- : "unknown"}
- </li>
- ))}
- </ul>
- Items missing all prompt variables will be excluded from the
- experiment.
- </div>
- </CardHeader>
- </Card>
- )}
+ {validationResult.data?.isValid === false && (
+ <Card className="relative overflow-hidden rounded-md border-dark-yellow bg-light-yellow shadow-none group-data-[collapsible=icon]:hidden">
+ <CardHeader className="p-2">
+ <CardTitle className="flex items-center justify-between text-sm text-dark-yellow">
+ <span>Invalid configuration</span>
+ <Info className="h-4 w-4" />
+ </CardTitle>
+ <CardDescription className="text-foreground">
+ {validationResult.data?.message}
+ </CardDescription>
+ </CardHeader>
+ </Card>
+ )}
+ {validationResult.data?.isValid === true && (
+ <Card className="relative overflow-hidden rounded-md border-dark-green bg-light-green shadow-none group-data-[collapsible=icon]:hidden">
+ <CardHeader className="p-2">
+ <CardTitle className="flex items-center justify-between text-sm text-dark-green">
+ <span>Valid configuration</span>
+ <CircleCheck className="h-4 w-4" />
+ </CardTitle>
+ <div className="text-sm">
+ Matches between dataset items and prompt variables
+ <ul className="my-2 ml-2 list-inside list-disc">
+ {Object.entries(
+ validationResult.data.variablesMap ?? {},
+ ).map(([variable, count]) => (
+ <li key={variable}>
+ <strong>{variable}:</strong> {count} /{" "}
+ {validationResult.data?.isValid
+ ? validationResult.data.totalItems
+ : "unknown"}
+ </li>
+ ))}
+ </ul>
+ Items missing all prompt variables will be excluded from
+ the experiment.
+ </div>
+ </CardHeader>
+ </Card>
+ )}
+ </div>
+ </DialogBody>
+ <DialogFooter>
<div className="flex justify-end">
<Button
type="submit"
@@ -766,7 +778,7 @@ export const CreateExperimentsForm = ({
Create
</Button>
</div>
- </div>
+ </DialogFooter>
</form>
</Form>
diff --git a/web/src/features/feedback/component/FeedbackButton.tsx b/web/src/features/feedback/component/FeedbackButton.tsx
index 510cd5ae3f..dfe49f1e5f 100644
--- a/web/src/features/feedback/component/FeedbackButton.tsx
+++ b/web/src/features/feedback/component/FeedbackButton.tsx
@@ -7,6 +7,7 @@ import {
DialogTrigger,
DialogDescription,
DialogPortal,
+ DialogBody,
} from "@/src/components/ui/dialog";
import { useState } from "react";
import Link from "next/link";
@@ -42,18 +43,20 @@ export function FeedbackButtonWrapper({
<DialogTitle>{title}</DialogTitle>
<DialogDescription>{description}</DialogDescription>
</DialogHeader>
- <div className="flex flex-row flex-wrap items-center justify-center gap-3 sm:justify-start">
- <Link href="https://langfuse.com/ideas" target="_blank">
- <Button variant="secondary">
- <Sparkles className="mr-2 h-4 w-4" /> Submit Feature Request
- </Button>
- </Link>
- <Link href="https://langfuse.com/issues" target="_blank">
- <Button variant="secondary">
- <Bug className="mr-2 h-4 w-4" /> Report a Bug
- </Button>
- </Link>
- </div>
+ <DialogBody>
+ <div className="flex flex-row flex-wrap items-center justify-center gap-3 sm:justify-start">
+ <Link href="https://langfuse.com/ideas" target="_blank">
+ <Button variant="secondary">
+ <Sparkles className="mr-2 h-4 w-4" /> Submit Feature Request
+ </Button>
+ </Link>
+ <Link href="https://langfuse.com/issues" target="_blank">
+ <Button variant="secondary">
+ <Bug className="mr-2 h-4 w-4" /> Report a Bug
+ </Button>
+ </Link>
+ </div>
+ </DialogBody>
</DialogContent>
</DialogPortal>
</Dialog>
diff --git a/web/src/features/organizations/components/DeleteOrganizationButton.tsx b/web/src/features/organizations/components/DeleteOrganizationButton.tsx
index e48e95c0a0..cab5d2bb47 100644
--- a/web/src/features/organizations/components/DeleteOrganizationButton.tsx
+++ b/web/src/features/organizations/components/DeleteOrganizationButton.tsx
@@ -1,8 +1,10 @@
import { Button } from "@/src/components/ui/button";
import {
Dialog,
+ DialogBody,
DialogContent,
DialogDescription,
+ DialogFooter,
DialogHeader,
DialogTitle,
DialogTrigger,
@@ -96,28 +98,32 @@ export function DeleteOrganizationButton() {
className="space-y-8"
>
{!hasProjects && (
- <FormField
- control={form.control}
- name="name"
- render={({ field }) => (
- <FormItem>
- <FormControl>
- <Input placeholder={confirmMessage} {...field} />
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
+ <DialogBody>
+ <FormField
+ control={form.control}
+ name="name"
+ render={({ field }) => (
+ <FormItem>
+ <FormControl>
+ <Input placeholder={confirmMessage} {...field} />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ </DialogBody>
)}
- <Button
- type="submit"
- variant="destructive"
- loading={deleteOrganization.isLoading}
- disabled={hasProjects}
- className="w-full"
- >
- Delete Organization
- </Button>
+ <DialogFooter>
+ <Button
+ type="submit"
+ variant="destructive"
+ loading={deleteOrganization.isLoading}
+ disabled={hasProjects}
+ className="w-full"
+ >
+ Delete Organization
+ </Button>
+ </DialogFooter>
</form>
</Form>
</DialogContent>
diff --git a/web/src/features/playground/page/components/CreateOrEditLLMSchemaDialog.tsx b/web/src/features/playground/page/components/CreateOrEditLLMSchemaDialog.tsx
index 2e3c2eaf44..933547dd21 100644
--- a/web/src/features/playground/page/components/CreateOrEditLLMSchemaDialog.tsx
+++ b/web/src/features/playground/page/components/CreateOrEditLLMSchemaDialog.tsx
@@ -7,6 +7,7 @@ import * as z from "zod";
import { Button } from "@/src/components/ui/button";
import {
Dialog,
+ DialogBody,
DialogContent,
DialogDescription,
DialogFooter,
@@ -161,89 +162,91 @@ export const CreateOrEditLLMSchemaDialog: React.FC<
onSubmit={form.handleSubmit(onSubmit)}
className="flex flex-1 flex-col"
>
- <div className="flex-1 space-y-4 overflow-y-auto">
- <FormField
- control={form.control}
- name="name"
- render={({ field }) => (
- <FormItem>
- <FormLabel>Name</FormLabel>
- <FormControl>
- <Input placeholder="e.g., get_weather" {...field} />
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
-
- <FormField
- control={form.control}
- name="description"
- render={({ field }) => (
- <FormItem>
- <FormLabel>Description</FormLabel>
- <FormControl>
- <Textarea
- placeholder="Describe the schema"
- className="max-h-[120px] focus:ring-0 focus:ring-offset-0 focus-visible:ring-0 focus-visible:ring-offset-0"
- {...field}
- onKeyDown={(e) => {
- e.stopPropagation();
- }}
- />
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
+ <DialogBody>
+ <div className="flex-1 space-y-4 overflow-y-auto">
+ <FormField
+ control={form.control}
+ name="name"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel>Name</FormLabel>
+ <FormControl>
+ <Input placeholder="e.g., get_weather" {...field} />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
- <FormField
- control={form.control}
- name="schema"
- render={({ field }) => (
- <FormItem>
- <FormLabel>JSON Schema</FormLabel>
- <FormDescription>
- Define the structure of your schema using JSON Schema
- format.{" "}
- <a
- href="https://json-schema.org/learn/miscellaneous-examples"
- target="_blank"
- rel="noopener noreferrer"
- className="flex items-center"
- >
- See JSON Schema examples here
- <ArrowUpRight className="h-3 w-3" />
- </a>
- </FormDescription>
- <FormControl>
- <div className="relative flex flex-col gap-1">
- <CodeMirrorEditor
- value={field.value}
- onChange={field.onChange}
- mode="json"
- minHeight={200}
- className="max-h-[25vh]"
+ <FormField
+ control={form.control}
+ name="description"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel>Description</FormLabel>
+ <FormControl>
+ <Textarea
+ placeholder="Describe the schema"
+ className="max-h-[120px] focus:ring-0 focus:ring-offset-0 focus-visible:ring-0 focus-visible:ring-offset-0"
+ {...field}
+ onKeyDown={(e) => {
+ e.stopPropagation();
+ }}
/>
- <Button
- type="button"
- variant="outline"
- size="sm"
- onClick={prettifyJson}
- className="absolute right-3 top-3 text-xs"
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+
+ <FormField
+ control={form.control}
+ name="schema"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel>JSON Schema</FormLabel>
+ <FormDescription>
+ Define the structure of your schema using JSON Schema
+ format.{" "}
+ <a
+ href="https://json-schema.org/learn/miscellaneous-examples"
+ target="_blank"
+ rel="noopener noreferrer"
+ className="flex items-center"
>
- Prettify
- </Button>
- </div>
- </FormControl>
- <p className="text-xs text-muted-foreground">
- Parameters must be a valid JSON Schema object
- </p>
- <FormMessage />
- </FormItem>
- )}
- />
- </div>
+ See JSON Schema examples here
+ <ArrowUpRight className="h-3 w-3" />
+ </a>
+ </FormDescription>
+ <FormControl>
+ <div className="relative flex flex-col gap-1">
+ <CodeMirrorEditor
+ value={field.value}
+ onChange={field.onChange}
+ mode="json"
+ minHeight={200}
+ className="max-h-[25vh]"
+ />
+ <Button
+ type="button"
+ variant="outline"
+ size="sm"
+ onClick={prettifyJson}
+ className="absolute right-3 top-3 text-xs"
+ >
+ Prettify
+ </Button>
+ </div>
+ </FormControl>
+ <p className="text-xs text-muted-foreground">
+ Parameters must be a valid JSON Schema object
+ </p>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ </div>
+ </DialogBody>
<DialogFooter className="sticky bottom-0 mt-4 flex flex-col gap-2 border-t bg-background pt-4">
<div className="flex w-full flex-col gap-2">
diff --git a/web/src/features/playground/page/components/CreateOrEditLLMToolDialog.tsx b/web/src/features/playground/page/components/CreateOrEditLLMToolDialog.tsx
index 8f5104a50b..fcaa79b09c 100644
--- a/web/src/features/playground/page/components/CreateOrEditLLMToolDialog.tsx
+++ b/web/src/features/playground/page/components/CreateOrEditLLMToolDialog.tsx
@@ -7,6 +7,7 @@ import * as z from "zod";
import { Button } from "@/src/components/ui/button";
import {
Dialog,
+ DialogBody,
DialogContent,
DialogDescription,
DialogFooter,
@@ -166,93 +167,95 @@ export const CreateOrEditLLMToolDialog: React.FC<CreateOrEditLLMToolDialog> = (
onSubmit={form.handleSubmit(onSubmit)}
className="flex flex-1 flex-col"
>
- <div className="flex-1 space-y-4 overflow-y-auto">
- <FormField
- control={form.control}
- name="name"
- render={({ field }) => (
- <FormItem>
- <FormLabel>Name</FormLabel>
- <FormControl>
- <Input placeholder="e.g., get_weather" {...field} />
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
-
- <FormField
- control={form.control}
- name="description"
- render={({ field }) => (
- <FormItem>
- <FormLabel>Description</FormLabel>
- <FormDescription>
- This description will be sent to the LLM to help it
- understand the tool&apos;s purpose and functionality.
- </FormDescription>
- <FormControl>
- <Textarea
- placeholder="Describe the tool's purpose and usage"
- className="max-h-[120px] focus:ring-0 focus:ring-offset-0 focus-visible:ring-0 focus-visible:ring-offset-0"
- {...field}
- onKeyDown={(e) => {
- e.stopPropagation();
- }}
- />
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
+ <DialogBody>
+ <div className="flex-1 space-y-4 overflow-y-auto">
+ <FormField
+ control={form.control}
+ name="name"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel>Name</FormLabel>
+ <FormControl>
+ <Input placeholder="e.g., get_weather" {...field} />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
- <FormField
- control={form.control}
- name="parameters"
- render={({ field }) => (
- <FormItem>
- <FormLabel>Parameters (JSON Schema)</FormLabel>
- <FormDescription>
- Define the structure of your tool parameters using JSON
- Schema format.{" "}
- <a
- href="https://json-schema.org/learn/miscellaneous-examples"
- target="_blank"
- rel="noopener noreferrer"
- className="flex items-center"
- >
- See JSON Schema examples here
- <ArrowUpRight className="h-3 w-3" />
- </a>
- </FormDescription>
- <FormControl>
- <div className="relative flex flex-col gap-1">
- <CodeMirrorEditor
- value={field.value}
- onChange={field.onChange}
- mode="json"
- minHeight={200}
- className="max-h-[25vh]"
+ <FormField
+ control={form.control}
+ name="description"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel>Description</FormLabel>
+ <FormDescription>
+ This description will be sent to the LLM to help it
+ understand the tool&apos;s purpose and functionality.
+ </FormDescription>
+ <FormControl>
+ <Textarea
+ placeholder="Describe the tool's purpose and usage"
+ className="max-h-[120px] focus:ring-0 focus:ring-offset-0 focus-visible:ring-0 focus-visible:ring-offset-0"
+ {...field}
+ onKeyDown={(e) => {
+ e.stopPropagation();
+ }}
/>
- <Button
- type="button"
- variant="outline"
- size="sm"
- onClick={prettifyJson}
- className="absolute right-3 top-3 text-xs"
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+
+ <FormField
+ control={form.control}
+ name="parameters"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel>Parameters (JSON Schema)</FormLabel>
+ <FormDescription>
+ Define the structure of your tool parameters using JSON
+ Schema format.{" "}
+ <a
+ href="https://json-schema.org/learn/miscellaneous-examples"
+ target="_blank"
+ rel="noopener noreferrer"
+ className="flex items-center"
>
- Prettify
- </Button>
- </div>
- </FormControl>
- <p className="text-xs text-muted-foreground">
- Parameters must be a valid JSON Schema object
- </p>
- <FormMessage />
- </FormItem>
- )}
- />
- </div>
+ See JSON Schema examples here
+ <ArrowUpRight className="h-3 w-3" />
+ </a>
+ </FormDescription>
+ <FormControl>
+ <div className="relative flex flex-col gap-1">
+ <CodeMirrorEditor
+ value={field.value}
+ onChange={field.onChange}
+ mode="json"
+ minHeight={200}
+ className="max-h-[25vh]"
+ />
+ <Button
+ type="button"
+ variant="outline"
+ size="sm"
+ onClick={prettifyJson}
+ className="absolute right-3 top-3 text-xs"
+ >
+ Prettify
+ </Button>
+ </div>
+ </FormControl>
+ <p className="text-xs text-muted-foreground">
+ Parameters must be a valid JSON Schema object
+ </p>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ </div>
+ </DialogBody>
<DialogFooter className="sticky bottom-0 mt-4 flex flex-col gap-2 border-t bg-background pt-4">
<div className="flex w-full flex-col gap-2">
diff --git a/web/src/features/projects/components/DeleteProjectButton.tsx b/web/src/features/projects/components/DeleteProjectButton.tsx
index 5dc3c2c74b..5e3e4e7fcd 100644
--- a/web/src/features/projects/components/DeleteProjectButton.tsx
+++ b/web/src/features/projects/components/DeleteProjectButton.tsx
@@ -1,7 +1,9 @@
import { Button } from "@/src/components/ui/button";
import {
Dialog,
+ DialogBody,
DialogContent,
+ DialogFooter,
DialogDescription,
DialogHeader,
DialogTitle,
@@ -91,26 +93,30 @@ export function DeleteProjectButton() {
onSubmit={form.handleSubmit(onSubmit)}
className="space-y-8"
>
- <FormField
- control={form.control}
- name="name"
- render={({ field }) => (
- <FormItem>
- <FormControl>
- <Input placeholder={confirmMessage} {...field} />
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
- <Button
- type="submit"
- variant="destructive"
- loading={deleteProject.isLoading}
- className="w-full"
- >
- Delete project
- </Button>
+ <DialogBody>
+ <FormField
+ control={form.control}
+ name="name"
+ render={({ field }) => (
+ <FormItem>
+ <FormControl>
+ <Input placeholder={confirmMessage} {...field} />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ </DialogBody>
+ <DialogFooter>
+ <Button
+ type="submit"
+ variant="destructive"
+ loading={deleteProject.isLoading}
+ className="w-full"
+ >
+ Delete project
+ </Button>
+ </DialogFooter>
</form>
</Form>
</DialogContent>
diff --git a/web/src/features/projects/components/TransferProjectButton.tsx b/web/src/features/projects/components/TransferProjectButton.tsx
index 880d1d50d0..0faeb29836 100644
--- a/web/src/features/projects/components/TransferProjectButton.tsx
+++ b/web/src/features/projects/components/TransferProjectButton.tsx
@@ -1,7 +1,9 @@
import { Button } from "@/src/components/ui/button";
import {
Dialog,
+ DialogBody,
DialogContent,
+ DialogFooter,
DialogHeader,
DialogTitle,
DialogTrigger,
@@ -108,90 +110,93 @@ export function TransferProjectButton() {
<DialogTitle className="text-lg font-semibold">
Transfer Project
</DialogTitle>
+ <Alert className="mt-2">
+ <TriangleAlert className="h-4 w-4" />
+ <AlertTitle>Warning</AlertTitle>
+ <AlertDescription>
+ Transferring the project will move it to a different organization:
+ <ul className="list-disc pl-4">
+ <li>
+ Members who are not part of the new organization will lose
+ access.
+ </li>
+ <li>
+ The project remains fully operational as API keys, settings,
+ and data will remain unchanged. All features (e.g. tracing,
+ prompt management) will continue to work without interruption.
+ </li>
+ </ul>
+ </AlertDescription>
+ </Alert>
</DialogHeader>
- <Alert className="mt-2">
- <TriangleAlert className="h-4 w-4" />
- <AlertTitle>Warning</AlertTitle>
- <AlertDescription>
- Transferring the project will move it to a different organization:
- <ul className="list-disc pl-4">
- <li>
- Members who are not part of the new organization will lose
- access.
- </li>
- <li>
- The project remains fully operational as API keys, settings, and
- data will remain unchanged. All features (e.g. tracing, prompt
- management) will continue to work without interruption.
- </li>
- </ul>
- </AlertDescription>
- </Alert>
<Form {...form}>
<form
// eslint-disable-next-line @typescript-eslint/no-misused-promises
onSubmit={form.handleSubmit(onSubmit)}
- className="mt-8 space-y-8"
+ className="space-y-8"
>
- <FormField
- control={form.control}
- name="projectId"
- render={({ field }) => (
- <FormItem>
- <FormLabel>Select New Organization</FormLabel>
- <FormControl>
- <Select
- onValueChange={field.onChange}
- value={field.value}
- disabled={transferProject.isLoading}
- >
- <SelectTrigger>
- <SelectValue placeholder="Select organization" />
- </SelectTrigger>
- <SelectContent>
- {organizationsToTransferTo
- .filter((org) => org.id !== organization?.id)
- .map((org) => (
- <SelectItem key={org.id} value={org.id}>
- {org.name}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- </FormControl>
- <FormDescription>
- Transfer this project to another organization where you have
- the ability to create projects.
- </FormDescription>
- <FormMessage />
- </FormItem>
- )}
- />
- <FormField
- control={form.control}
- name="name"
- render={({ field }) => (
- <FormItem>
- <FormLabel>Confirm</FormLabel>
- <FormControl>
- <Input placeholder={confirmMessage} {...field} />
- </FormControl>
- <FormDescription>
- {`To confirm, type "${confirmMessage}" in the input box `}
- </FormDescription>
- <FormMessage />
- </FormItem>
- )}
- />
-
- <Button
- type="submit"
- variant="destructive"
- loading={transferProject.isLoading}
- className="w-full"
- >
- Transfer project
- </Button>
+ <DialogBody>
+ <FormField
+ control={form.control}
+ name="projectId"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel>Select New Organization</FormLabel>
+ <FormControl>
+ <Select
+ onValueChange={field.onChange}
+ value={field.value}
+ disabled={transferProject.isLoading}
+ >
+ <SelectTrigger>
+ <SelectValue placeholder="Select organization" />
+ </SelectTrigger>
+ <SelectContent>
+ {organizationsToTransferTo
+ .filter((org) => org.id !== organization?.id)
+ .map((org) => (
+ <SelectItem key={org.id} value={org.id}>
+ {org.name}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </FormControl>
+ <FormDescription>
+ Transfer this project to another organization where you
+ have the ability to create projects.
+ </FormDescription>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ <FormField
+ control={form.control}
+ name="name"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel>Confirm</FormLabel>
+ <FormControl>
+ <Input placeholder={confirmMessage} {...field} />
+ </FormControl>
+ <FormDescription>
+ {`To confirm, type "${confirmMessage}" in the input box `}
+ </FormDescription>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ </DialogBody>
+ <DialogFooter>
+ <Button
+ type="submit"
+ variant="destructive"
+ loading={transferProject.isLoading}
+ className="w-full"
+ >
+ Transfer project
+ </Button>
+ </DialogFooter>
</form>
</Form>
</DialogContent>
diff --git a/web/src/features/prompts/components/NewPromptForm/ReviewPromptDialog.tsx b/web/src/features/prompts/components/NewPromptForm/ReviewPromptDialog.tsx
index 3f7a748d0a..9ba33c5ebc 100644
--- a/web/src/features/prompts/components/NewPromptForm/ReviewPromptDialog.tsx
+++ b/web/src/features/prompts/components/NewPromptForm/ReviewPromptDialog.tsx
@@ -2,6 +2,7 @@ import React from "react";
import { Button } from "@/src/components/ui/button";
import {
Dialog,
+ DialogBody,
DialogContent,
DialogDescription,
DialogFooter,
@@ -63,7 +64,7 @@ export const ReviewPromptDialog: React.FC<ReviewPromptDialogProps> = (
return (
<Dialog open={open} onOpenChange={(open) => setOpen(open)}>
<DialogTrigger asChild>{children}</DialogTrigger>
- <DialogContent className="max-w-screen-xl">
+ <DialogContent size="xl">
<DialogHeader>
<DialogTitle>Review Prompt Changes</DialogTitle>
<DialogDescription className="flex items-center gap-2">
@@ -71,30 +72,32 @@ export const ReviewPromptDialog: React.FC<ReviewPromptDialogProps> = (
</DialogDescription>
</DialogHeader>
- <div className="max-h-[80vh] max-w-screen-xl space-y-6 overflow-y-auto">
- <div className="space-y-6">
- <div className="space-y-4">
- <div>
- <h3 className="mb-2 text-base font-medium">Content</h3>
- <DiffViewer
- oldString={initialPromptContent}
- newString={newPromptContent}
- oldLabel={`Previous content (v${initialPrompt.version})`}
- newLabel="New content (draft)"
- />
- </div>
- <div>
- <h3 className="mb-2 text-base font-medium">Config</h3>
- <DiffViewer
- oldString={JSON.stringify(initialPrompt.config, null, 2)}
- newString={newConfig ?? "failed"}
- oldLabel={`Previous config (v${initialPrompt.version})`}
- newLabel="New config (draft)"
- />
+ <DialogBody>
+ <div className="max-h-[80vh] max-w-screen-xl space-y-6 overflow-y-auto">
+ <div className="space-y-6">
+ <div className="space-y-4">
+ <div>
+ <h3 className="mb-2 text-base font-medium">Content</h3>
+ <DiffViewer
+ oldString={initialPromptContent}
+ newString={newPromptContent}
+ oldLabel={`Previous content (v${initialPrompt.version})`}
+ newLabel="New content (draft)"
+ />
+ </div>
+ <div>
+ <h3 className="mb-2 text-base font-medium">Config</h3>
+ <DiffViewer
+ oldString={JSON.stringify(initialPrompt.config, null, 2)}
+ newString={newConfig ?? "failed"}
+ oldLabel={`Previous config (v${initialPrompt.version})`}
+ newLabel="New config (draft)"
+ />
+ </div>
</div>
</div>
</div>
- </div>
+ </DialogBody>
<DialogFooter className="flex flex-row">
<Button
diff --git a/web/src/features/prompts/components/PromptSelectionDialog.tsx b/web/src/features/prompts/components/PromptSelectionDialog.tsx
index 80b9650668..e4c7640cd8 100644
--- a/web/src/features/prompts/components/PromptSelectionDialog.tsx
+++ b/web/src/features/prompts/components/PromptSelectionDialog.tsx
@@ -6,6 +6,7 @@ import {
DialogHeader,
DialogTitle,
DialogFooter,
+ DialogBody,
} from "@/src/components/ui/dialog";
import { Button } from "@/src/components/ui/button";
import {
@@ -102,135 +103,137 @@ export function PromptSelectionDialog({
<DialogHeader>
<DialogTitle>Add inline prompt reference</DialogTitle>
</DialogHeader>
- <div className="flex flex-col gap-4 py-4">
- <p className="text-sm text-muted-foreground">
- Referenced prompts are dynamically resolved and inserted when
- fetched via API/SDK. This enables modular design—create complex
- prompts from reusable, independently maintained components.
- </p>
-
- <div className="flex flex-col gap-2">
- <Label htmlFor="prompt-name">Prompt name</Label>
- <Select
- value={selectedPromptName}
- onValueChange={(value) => {
- setSelectedPromptName(value);
- setSelectedVersionOrLabel("");
- }}
- >
- <SelectTrigger id="prompt-name">
- <SelectValue placeholder="Select a text prompt" />
- </SelectTrigger>
- <SelectContent>
- {promptOptions?.map((prompt) => (
- <SelectItem key={prompt.name} value={prompt.name}>
- {prompt.name}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- <p className="text-xs text-muted-foreground">
- Only text prompts can be referenced inline.
+ <DialogBody>
+ <div className="flex flex-col gap-4 py-4">
+ <p className="text-sm text-muted-foreground">
+ Referenced prompts are dynamically resolved and inserted when
+ fetched via API/SDK. This enables modular design—create complex
+ prompts from reusable, independently maintained components.
</p>
- </div>
- {selectedPromptName && (
<div className="flex flex-col gap-2">
- <Label htmlFor="selection-type">Reference by</Label>
+ <Label htmlFor="prompt-name">Prompt name</Label>
<Select
- value={selectionType}
- onValueChange={(value: "version" | "label") => {
- setSelectionType(value);
+ value={selectedPromptName}
+ onValueChange={(value) => {
+ setSelectedPromptName(value);
setSelectedVersionOrLabel("");
}}
>
- <SelectTrigger id="selection-type">
- <SelectValue placeholder="Select link type" />
+ <SelectTrigger id="prompt-name">
+ <SelectValue placeholder="Select a text prompt" />
</SelectTrigger>
<SelectContent>
- <SelectItem value="label">Label</SelectItem>
- <SelectItem value="version">Version</SelectItem>
+ {promptOptions?.map((prompt) => (
+ <SelectItem key={prompt.name} value={prompt.name}>
+ {prompt.name}
+ </SelectItem>
+ ))}
</SelectContent>
</Select>
+ <p className="text-xs text-muted-foreground">
+ Only text prompts can be referenced inline.
+ </p>
</div>
- )}
- {selectedPromptName && (
- <div className="flex flex-col gap-2">
- <Label htmlFor="version-or-label">
- {selectionType === "version" ? "Version" : "Label"}
- </Label>
- <div className="flex gap-2">
+ {selectedPromptName && (
+ <div className="flex flex-col gap-2">
+ <Label htmlFor="selection-type">Reference by</Label>
<Select
- value={selectedVersionOrLabel}
- onValueChange={setSelectedVersionOrLabel}
+ value={selectionType}
+ onValueChange={(value: "version" | "label") => {
+ setSelectionType(value);
+ setSelectedVersionOrLabel("");
+ }}
>
- <SelectTrigger id="version-or-label">
- <SelectValue
- placeholder={
- selectionType === "version"
- ? "Select a version"
- : "Select a label"
- }
- />
+ <SelectTrigger id="selection-type">
+ <SelectValue placeholder="Select link type" />
</SelectTrigger>
<SelectContent>
- {selectionType === "version"
- ? selectedPrompt?.versions.map((version) => (
- <SelectItem
- key={version.toString()}
- value={version.toString()}
- >
- {version}
- </SelectItem>
- ))
- : selectedPrompt?.labels.map((label) => (
- <SelectItem key={label} value={label}>
- {label}
- </SelectItem>
- ))}
+ <SelectItem value="label">Label</SelectItem>
+ <SelectItem value="version">Version</SelectItem>
</SelectContent>
</Select>
- {selectedVersionOrLabel && (
- <Link
- href={`/project/${projectId}/prompts/${selectedPromptName}?${selectionType}=${selectedVersionOrLabel}`}
- target="_blank"
- passHref
+ </div>
+ )}
+
+ {selectedPromptName && (
+ <div className="flex flex-col gap-2">
+ <Label htmlFor="version-or-label">
+ {selectionType === "version" ? "Version" : "Label"}
+ </Label>
+ <div className="flex gap-2">
+ <Select
+ value={selectedVersionOrLabel}
+ onValueChange={setSelectedVersionOrLabel}
>
- <Button type="button" variant="outline" size="icon">
- <ExternalLinkIcon className="h-4 w-4" />
- </Button>
- </Link>
- )}
+ <SelectTrigger id="version-or-label">
+ <SelectValue
+ placeholder={
+ selectionType === "version"
+ ? "Select a version"
+ : "Select a label"
+ }
+ />
+ </SelectTrigger>
+ <SelectContent>
+ {selectionType === "version"
+ ? selectedPrompt?.versions.map((version) => (
+ <SelectItem
+ key={version.toString()}
+ value={version.toString()}
+ >
+ {version}
+ </SelectItem>
+ ))
+ : selectedPrompt?.labels.map((label) => (
+ <SelectItem key={label} value={label}>
+ {label}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ {selectedVersionOrLabel && (
+ <Link
+ href={`/project/${projectId}/prompts/${selectedPromptName}?${selectionType}=${selectedVersionOrLabel}`}
+ target="_blank"
+ passHref
+ >
+ <Button type="button" variant="outline" size="icon">
+ <ExternalLinkIcon className="h-4 w-4" />
+ </Button>
+ </Link>
+ )}
+ </div>
</div>
- </div>
- )}
- </div>
+ )}
+ </div>
- {selectedTag && (
- <div className="space-y-2">
- <Label>Tag preview</Label>
- <div className="relative">
- <div className="rounded-md border bg-muted p-3 pr-10 font-mono text-xs">
- {selectedTag}
+ {selectedTag && (
+ <div className="space-y-2">
+ <Label>Tag preview</Label>
+ <div className="relative">
+ <div className="rounded-md border bg-muted p-3 pr-10 font-mono text-xs">
+ {selectedTag}
+ </div>
+ <Button
+ type="button"
+ variant="ghost"
+ size="icon"
+ className="absolute right-2 top-2 bg-opacity-70"
+ onClick={copySelectedTag}
+ >
+ <CopyIcon className="h-4 w-4" />
+ </Button>
</div>
- <Button
- type="button"
- variant="ghost"
- size="icon"
- className="absolute right-2 top-2 bg-opacity-70"
- onClick={copySelectedTag}
- >
- <CopyIcon className="h-4 w-4" />
- </Button>
+ <p className="text-xs text-muted-foreground">
+ {onSelect
+ ? "This tag will be inserted into the prompt content."
+ : "This tag will be copied to clipboard to be then inserted into the prompt"}
+ </p>
</div>
- <p className="text-xs text-muted-foreground">
- {onSelect
- ? "This tag will be inserted into the prompt content."
- : "This tag will be copied to clipboard to be then inserted into the prompt"}
- </p>
- </div>
- )}
+ )}
+ </DialogBody>
<DialogFooter>
<Button type="button" variant="outline" onClick={onClose}>
diff --git a/web/src/features/prompts/components/PromptVersionDiffDialog.tsx b/web/src/features/prompts/components/PromptVersionDiffDialog.tsx
index e558be5d3e..43ec99bc7e 100644
--- a/web/src/features/prompts/components/PromptVersionDiffDialog.tsx
+++ b/web/src/features/prompts/components/PromptVersionDiffDialog.tsx
@@ -2,6 +2,7 @@ import React from "react";
import { Button } from "@/src/components/ui/button";
import {
Dialog,
+ DialogBody,
DialogContent,
DialogDescription,
DialogFooter,
@@ -48,7 +49,7 @@ export const PromptVersionDiffDialog: React.FC<PromptVersionDiffDialogProps> = (
</DialogTrigger>
<DialogContent
- className="max-w-screen-xl"
+ size="xl"
// prevent event bubbling up and triggering the row's click handler
onClick={(event) => event.stopPropagation()}
onPointerDownOutside={(e) => {
@@ -65,8 +66,7 @@ export const PromptVersionDiffDialog: React.FC<PromptVersionDiffDialogProps> = (
<span className="font-medium">Prompt {leftPrompt.name}</span>
</DialogDescription>
</DialogHeader>
-
- <div className="max-h-[80vh] max-w-screen-xl space-y-6 overflow-y-auto">
+ <DialogBody>
<div className="space-y-6">
<div className="space-y-4">
<div>
@@ -99,9 +99,9 @@ export const PromptVersionDiffDialog: React.FC<PromptVersionDiffDialogProps> = (
</div>
</div>
</div>
- </div>
+ </DialogBody>
- <DialogFooter className="flex flex-row">
+ <DialogFooter className="static mt-auto">
<Button
onClick={() => {
setIsOpen(false);
diff --git a/web/src/features/prompts/components/duplicate-prompt.tsx b/web/src/features/prompts/components/duplicate-prompt.tsx
index 0d0cc439a5..710bec8545 100644
--- a/web/src/features/prompts/components/duplicate-prompt.tsx
+++ b/web/src/features/prompts/components/duplicate-prompt.tsx
@@ -5,7 +5,9 @@ import { Copy } from "lucide-react";
import { useHasProjectAccess } from "@/src/features/rbac/utils/checkProjectAccess";
import {
Dialog,
+ DialogBody,
DialogContent,
+ DialogFooter,
DialogHeader,
DialogTitle,
DialogTrigger,
@@ -110,64 +112,67 @@ const DuplicatePromptForm: React.FC<{
<form
// eslint-disable-next-line @typescript-eslint/no-misused-promises
onSubmit={form.handleSubmit(onSubmit)}
- className="mt-4 flex h-full flex-1 flex-col gap-4"
+ className="flex h-full flex-1 flex-col gap-4"
>
- <FormField
- control={form.control}
- name="name"
- render={({ field }) => (
- <FormItem className="flex flex-col gap-2">
- <FormLabel>Name</FormLabel>
- <FormControl>
- <Input {...field} type="text" />
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
- <FormField
- control={form.control}
- name="isCopySingleVersion"
- render={({ field }) => (
- <FormItem>
- <FormLabel>Settings</FormLabel>
- <FormControl>
- <RadioGroup
- {...field}
- onValueChange={field.onChange}
- defaultValue={field.value}
- className="flex flex-col space-y-1"
- >
- <FormItem className="flex items-center space-x-3 space-y-0">
- <FormControl>
- <RadioGroupItem value={CopySettings.SINGLE_VERSION} />
- </FormControl>
- <FormLabel className="font-normal">
- Copy only version {promptVersion}
- </FormLabel>
- </FormItem>
- <FormItem className="flex items-center space-x-3 space-y-0">
- <FormControl>
- <RadioGroupItem value={CopySettings.ALL_VERSIONS} />
- </FormControl>
- <FormLabel className="font-normal">
- Copy all prompt versions and labels
- </FormLabel>
- </FormItem>
- </RadioGroup>
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
-
- <Button
- type="submit"
- loading={duplicatePrompt.isLoading}
- className="mb-4 mt-auto w-full"
- >
- Submit
- </Button>
+ <DialogBody>
+ <FormField
+ control={form.control}
+ name="name"
+ render={({ field }) => (
+ <FormItem className="flex flex-col gap-2">
+ <FormLabel>Name</FormLabel>
+ <FormControl>
+ <Input {...field} type="text" />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ <FormField
+ control={form.control}
+ name="isCopySingleVersion"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel>Settings</FormLabel>
+ <FormControl>
+ <RadioGroup
+ {...field}
+ onValueChange={field.onChange}
+ defaultValue={field.value}
+ className="flex flex-col space-y-1"
+ >
+ <FormItem className="flex items-center space-x-3 space-y-0">
+ <FormControl>
+ <RadioGroupItem value={CopySettings.SINGLE_VERSION} />
+ </FormControl>
+ <FormLabel className="font-normal">
+ Copy only version {promptVersion}
+ </FormLabel>
+ </FormItem>
+ <FormItem className="flex items-center space-x-3 space-y-0">
+ <FormControl>
+ <RadioGroupItem value={CopySettings.ALL_VERSIONS} />
+ </FormControl>
+ <FormLabel className="font-normal">
+ Copy all prompt versions and labels
+ </FormLabel>
+ </FormItem>
+ </RadioGroup>
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ </DialogBody>
+ <DialogFooter>
+ <Button
+ type="submit"
+ loading={duplicatePrompt.isLoading}
+ className="mt-auto w-full"
+ >
+ Submit
+ </Button>
+ </DialogFooter>
</form>
</Form>
);
diff --git a/web/src/features/public-api/components/ApiKeyList.tsx b/web/src/features/public-api/components/ApiKeyList.tsx
index d60e0c497d..c4d716ab4f 100644
--- a/web/src/features/public-api/components/ApiKeyList.tsx
+++ b/web/src/features/public-api/components/ApiKeyList.tsx
@@ -232,11 +232,11 @@ function DeleteApiKeyButton(props: {
<DialogContent>
<DialogHeader>
<DialogTitle className="mb-5">Delete API key</DialogTitle>
+ <DialogDescription>
+ Are you sure you want to delete this API key? This action cannot be
+ undone.
+ </DialogDescription>
</DialogHeader>
- <DialogDescription>
- Are you sure you want to delete this API key? This action cannot be
- undone.
- </DialogDescription>
<DialogFooter>
<Button
variant="destructive"
diff --git a/web/src/features/public-api/components/CreateApiKeyButton.tsx b/web/src/features/public-api/components/CreateApiKeyButton.tsx
index 632c702ffe..f74d5d315c 100644
--- a/web/src/features/public-api/components/CreateApiKeyButton.tsx
+++ b/web/src/features/public-api/components/CreateApiKeyButton.tsx
@@ -4,7 +4,9 @@ import { useState } from "react";
import { PlusIcon } from "lucide-react";
import {
Dialog,
+ DialogBody,
DialogContent,
+ DialogHeader,
DialogTitle,
DialogTrigger,
} from "@/src/components/ui/dialog";
@@ -106,12 +108,11 @@ export function CreateApiKeyButton(props: {
Create new API keys
</Button>
</DialogTrigger>
- <DialogContent
- onPointerDownOutside={(e) => e.preventDefault()}
- className="flex max-h-screen w-full flex-col md:max-w-xl"
- >
- <DialogTitle>API Keys</DialogTitle>
- <div className="shrink overflow-x-hidden overflow-y-scroll">
+ <DialogContent onPointerDownOutside={(e) => e.preventDefault()}>
+ <DialogHeader>
+ <DialogTitle>API Keys</DialogTitle>
+ </DialogHeader>
+ <DialogBody>
<ApiKeyRender
scope={props.scope}
generatedKeys={generatedKeys ?? undefined}
@@ -125,7 +126,7 @@ export function CreateApiKeyButton(props: {
/>
</div>
)}
- </div>
+ </DialogBody>
</DialogContent>
</Dialog>
);
diff --git a/web/src/features/public-api/components/CreateLLMApiKeyForm.tsx b/web/src/features/public-api/components/CreateLLMApiKeyForm.tsx
index e1caf889c5..c040727eb8 100644
--- a/web/src/features/public-api/components/CreateLLMApiKeyForm.tsx
+++ b/web/src/features/public-api/components/CreateLLMApiKeyForm.tsx
@@ -30,6 +30,8 @@ import { api } from "@/src/utils/api";
import { cn } from "@/src/utils/tailwind";
import { usePostHogClientCapture } from "@/src/features/posthog-analytics/usePostHogClientCapture";
import { type useUiCustomization } from "@/src/ee/features/ui-customization/useUiCustomization";
+import { DialogFooter } from "@/src/components/ui/dialog";
+import { DialogBody } from "@/src/components/ui/dialog";
const formSchema = z
.object({
@@ -229,133 +231,186 @@ export function CreateLLMApiKeyForm({
className={cn("flex flex-col gap-6 overflow-auto pb-2 pl-1 pr-4")}
onSubmit={form.handleSubmit(onSubmit)}
>
- {/* Provider name */}
- <FormField
- control={form.control}
- name="provider"
- render={({ field }) => (
- <FormItem>
- <FormLabel>Provider name</FormLabel>
- <FormDescription>
- Name to identify the key within Langfuse.
- </FormDescription>
- <FormControl>
- <Input {...field} />
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
-
- {/* LLM adapter */}
- <FormField
- control={form.control}
- name="adapter"
- render={({ field }) => (
- <FormItem>
- <FormLabel>LLM adapter</FormLabel>
- <FormDescription>
- Schema that is accepted at that provider endpoint.
- </FormDescription>
- <Select
- defaultValue={field.value}
- onValueChange={(value) => {
- field.onChange(value as LLMAdapter);
- form.setValue(
- "baseURL",
- getCustomizedBaseURL(value as LLMAdapter),
- );
- }}
- >
- <FormControl>
- <SelectTrigger>
- <SelectValue placeholder="Select a LLM provider" />
- </SelectTrigger>
- </FormControl>
- <SelectContent>
- {Object.values(LLMAdapter).map((provider) => (
- <SelectItem value={provider} key={provider}>
- {provider}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- <FormMessage />
- </FormItem>
- )}
- />
-
- {/* baseURL */}
- {currentAdapter !== LLMAdapter.Bedrock && (
+ <DialogBody>
+ {/* Provider name */}
<FormField
control={form.control}
- name="baseURL"
+ name="provider"
render={({ field }) => (
<FormItem>
- <FormLabel>API Base URL</FormLabel>
+ <FormLabel>Provider name</FormLabel>
<FormDescription>
- Leave blank to use the default base URL for the given LLM
- adapter.{" "}
- {currentAdapter === LLMAdapter.OpenAI && (
- <span>OpenAI default: https://api.openai.com/v1</span>
- )}
- {currentAdapter === LLMAdapter.Azure && (
- <span>
- Please add the base URL in the following format (or
- compatible API):
- https://&#123;instanceName&#125;.openai.azure.com/openai/deployments
- </span>
- )}
- {currentAdapter === LLMAdapter.Anthropic && (
- <span>
- Anthropic default: https://api.anthropic.com (excluding
- /v1/messages)
- </span>
- )}
- {currentAdapter === LLMAdapter.Atla && (
- <span className="text-dark-yellow">
- <br />
- Please use the Atla default base URL:
- https://api.atla-ai.com/v1/integrations/langfuse
- </span>
- )}
+ Name to identify the key within Langfuse.
</FormDescription>
-
<FormControl>
- <Input {...field} placeholder="default" />
+ <Input {...field} />
</FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ {/* LLM adapter */}
+ <FormField
+ control={form.control}
+ name="adapter"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel>LLM adapter</FormLabel>
+ <FormDescription>
+ Schema that is accepted at that provider endpoint.
+ </FormDescription>
+ <Select
+ defaultValue={field.value}
+ onValueChange={(value) => {
+ field.onChange(value as LLMAdapter);
+ form.setValue(
+ "baseURL",
+ getCustomizedBaseURL(value as LLMAdapter),
+ );
+ }}
+ >
+ <FormControl>
+ <SelectTrigger>
+ <SelectValue placeholder="Select a LLM provider" />
+ </SelectTrigger>
+ </FormControl>
+ <SelectContent>
+ {Object.values(LLMAdapter).map((provider) => (
+ <SelectItem value={provider} key={provider}>
+ {provider}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
<FormMessage />
</FormItem>
)}
/>
- )}
- {currentAdapter === LLMAdapter.Bedrock ? (
- <>
+ {/* baseURL */}
+ {currentAdapter !== LLMAdapter.Bedrock && (
<FormField
control={form.control}
- name="awsRegion"
+ name="baseURL"
render={({ field }) => (
<FormItem>
- <FormLabel>AWS Region</FormLabel>
+ <FormLabel>API Base URL</FormLabel>
+ <FormDescription>
+ Leave blank to use the default base URL for the given LLM
+ adapter.{" "}
+ {currentAdapter === LLMAdapter.OpenAI && (
+ <span>OpenAI default: https://api.openai.com/v1</span>
+ )}
+ {currentAdapter === LLMAdapter.Azure && (
+ <span>
+ Please add the base URL in the following format (or
+ compatible API):
+ https://&#123;instanceName&#125;.openai.azure.com/openai/deployments
+ </span>
+ )}
+ {currentAdapter === LLMAdapter.Anthropic && (
+ <span>
+ Anthropic default: https://api.anthropic.com (excluding
+ /v1/messages)
+ </span>
+ )}
+ {currentAdapter === LLMAdapter.Atla && (
+ <span className="text-dark-yellow">
+ <br />
+ Please use the Atla default base URL:
+ https://api.atla-ai.com/v1/integrations/langfuse
+ </span>
+ )}
+ </FormDescription>
+
<FormControl>
- <Input {...field} />
+ <Input {...field} placeholder="default" />
</FormControl>
+
<FormMessage />
</FormItem>
)}
/>
+ )}
+
+ {currentAdapter === LLMAdapter.Bedrock ? (
+ <>
+ <FormField
+ control={form.control}
+ name="awsRegion"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel>AWS Region</FormLabel>
+ <FormControl>
+ <Input {...field} />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ <FormField
+ control={form.control}
+ name="awsAccessKeyId"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel>AWS Access Key ID</FormLabel>
+ <FormDescription>
+ These should be long-lived credentials for an AWS user
+ with `bedrock:InvokeModel` permission.
+ </FormDescription>
+ <FormControl>
+ <Input {...field} />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ <FormField
+ control={form.control}
+ name="awsSecretAccessKey"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel>AWS Secret Access Key</FormLabel>
+ <FormControl>
+ <Input {...field} type="password" />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ </>
+ ) : (
<FormField
control={form.control}
- name="awsAccessKeyId"
+ name="secretKey"
render={({ field }) => (
<FormItem>
- <FormLabel>AWS Access Key ID</FormLabel>
+ <FormLabel>API Key</FormLabel>
<FormDescription>
- These should be long-lived credentials for an AWS user with
- `bedrock:InvokeModel` permission.
+ Your API keys are stored encrypted on our servers.
</FormDescription>
+ {currentAdapter === LLMAdapter.VertexAI && (
+ <FormDescription className="text-dark-yellow">
+ Paste your GCP service account JSON key here. The service
+ account must have `Vertex AI User` role permissions.
+ Example JSON:
+ <pre className="text-xs">
+ {`{
+ "type": "service_account",
+ "project_id": "<project_id>",
+ "private_key_id": "<private_key_id>",
+ "private_key": "<private_key>",
+ "client_email": "<client_email>",
+ "client_id": "<client_id>",
+ "auth_uri": "<auth_uri>",
+ "token_uri": "<token_uri>",
+ "auth_provider_x509_cert_url": "<auth_provider_x509_cert_url>",
+ "client_x509_cert_url": "<client_x509_cert_url>",
+}`}
+ </pre>
+ </FormDescription>
+ )}
<FormControl>
<Input {...field} />
</FormControl>
@@ -363,231 +418,185 @@ export function CreateLLMApiKeyForm({
</FormItem>
)}
/>
+ )}
+
+ {/* Extra Headers */}
+ {currentAdapter === LLMAdapter.OpenAI ||
+ currentAdapter === LLMAdapter.Azure ? (
<FormField
control={form.control}
- name="awsSecretAccessKey"
- render={({ field }) => (
+ name="extraHeaders"
+ render={() => (
<FormItem>
- <FormLabel>AWS Secret Access Key</FormLabel>
- <FormControl>
- <Input {...field} type="password" />
- </FormControl>
- <FormMessage />
+ <FormLabel>Extra Headers</FormLabel>
+ <FormDescription>
+ Optional additional HTTP headers to include with requests
+ towards LLM provider. All header values stored encrypted on
+ our servers.
+ </FormDescription>
+
+ {headerFields.map((header, index) => (
+ <div key={header.id} className="flex flex-row space-x-2">
+ <Input
+ {...form.register(`extraHeaders.${index}.key`)}
+ placeholder="Header name"
+ />
+ <Input
+ {...form.register(`extraHeaders.${index}.value`)}
+ placeholder="Header value"
+ />
+ <Button
+ type="button"
+ variant="ghost"
+ onClick={() => removeHeader(index)}
+ >
+ <TrashIcon className="h-4 w-4" />
+ </Button>
+ </div>
+ ))}
+
+ <Button
+ type="button"
+ variant="ghost"
+ onClick={() => appendHeader({ key: "", value: "" })}
+ className="w-full"
+ >
+ <PlusIcon
+ className="-ml-0.5 mr-1.5 h-5 w-5"
+ aria-hidden="true"
+ />
+ Add Header
+ </Button>
</FormItem>
)}
/>
- </>
- ) : (
+ ) : null}
+
+ {/* With default models */}
<FormField
control={form.control}
- name="secretKey"
+ name="withDefaultModels"
render={({ field }) => (
<FormItem>
- <FormLabel>API Key</FormLabel>
- <FormDescription>
- Your API keys are stored encrypted on our servers.
- </FormDescription>
- {currentAdapter === LLMAdapter.VertexAI && (
- <FormDescription className="text-dark-yellow">
- Paste your GCP service account JSON key here. The service
- account must have `Vertex AI User` role permissions. Example
- JSON:
- <pre className="text-xs">
- {`{
- "type": "service_account",
- "project_id": "<project_id>",
- "private_key_id": "<private_key_id>",
- "private_key": "<private_key>",
- "client_email": "<client_email>",
- "client_id": "<client_id>",
- "auth_uri": "<auth_uri>",
- "token_uri": "<token_uri>",
- "auth_provider_x509_cert_url": "<auth_provider_x509_cert_url>",
- "client_x509_cert_url": "<client_x509_cert_url>",
-}`}
- </pre>
- </FormDescription>
- )}
- <FormControl>
- <Input {...field} />
- </FormControl>
+ <span className="row flex">
+ <span className="flex-1">
+ <FormLabel>Enable default models</FormLabel>
+ <FormDescription>
+ Default models for the selected adapter will be available
+ in Langfuse features.
+ </FormDescription>
+ {currentAdapter === LLMAdapter.Azure && (
+ <FormDescription className="text-dark-yellow">
+ Azure LLM adapter does not support default model names
+ maintained by Langfuse. Instead, please add a custom
+ model below that is the same as your deployment name.
+ </FormDescription>
+ )}
+ {currentAdapter === LLMAdapter.Bedrock && (
+ <FormDescription className="text-dark-yellow">
+ Bedrock LLM adapter does not support default model names
+ maintained by Langfuse. Instead, please add the Bedrock
+ model IDs you have enabled in the AWS console.
+ </FormDescription>
+ )}
+ </span>
+
+ <FormControl>
+ <Switch
+ disabled={
+ currentAdapter === LLMAdapter.Azure ||
+ currentAdapter === LLMAdapter.Bedrock
+ }
+ checked={
+ currentAdapter === LLMAdapter.Azure ||
+ currentAdapter === LLMAdapter.Bedrock
+ ? false
+ : field.value
+ }
+ onCheckedChange={field.onChange}
+ />
+ </FormControl>
+ </span>
+
<FormMessage />
</FormItem>
)}
/>
- )}
- {/* Extra Headers */}
- {currentAdapter === LLMAdapter.OpenAI ||
- currentAdapter === LLMAdapter.Azure ? (
+ {/* Custom model names */}
<FormField
control={form.control}
- name="extraHeaders"
+ name="customModels"
render={() => (
<FormItem>
- <FormLabel>Extra Headers</FormLabel>
+ <FormLabel>Custom models</FormLabel>
<FormDescription>
- Optional additional HTTP headers to include with requests
- towards LLM provider. All header values stored encrypted on
- our servers.
+ Custom model names accepted by given endpoint.
</FormDescription>
+ {currentAdapter === LLMAdapter.Azure && (
+ <FormDescription className="text-dark-yellow">
+ {
+ "For Azure, the model name should be the same as the deployment name in Azure. For evals, choose a model with function calling capabilities."
+ }
+ </FormDescription>
+ )}
- {headerFields.map((header, index) => (
- <div key={header.id} className="flex flex-row space-x-2">
- <Input
- {...form.register(`extraHeaders.${index}.key`)}
- placeholder="Header name"
- />
+ {currentAdapter === LLMAdapter.Bedrock && (
+ <FormDescription className="text-dark-yellow">
+ {
+ "For Bedrock, the model name is the Bedrock Inference Profile ID, e.g. 'eu.anthropic.claude-3-5-sonnet-20240620-v1:0'"
+ }
+ </FormDescription>
+ )}
+
+ {fields.map((customModel, index) => (
+ <span
+ key={customModel.id}
+ className="flex flex-row space-x-2"
+ >
<Input
- {...form.register(`extraHeaders.${index}.value`)}
- placeholder="Header value"
+ {...form.register(`customModels.${index}.value`)}
+ placeholder={`Custom model name ${index + 1}`}
/>
<Button
type="button"
variant="ghost"
- onClick={() => removeHeader(index)}
+ onClick={() => remove(index)}
>
<TrashIcon className="h-4 w-4" />
</Button>
- </div>
+ </span>
))}
-
<Button
type="button"
variant="ghost"
- onClick={() => appendHeader({ key: "", value: "" })}
+ onClick={() => append({ value: "" })}
className="w-full"
>
<PlusIcon
className="-ml-0.5 mr-1.5 h-5 w-5"
aria-hidden="true"
/>
- Add Header
+ Add custom model name
</Button>
</FormItem>
)}
/>
- ) : null}
-
- {/* With default models */}
- <FormField
- control={form.control}
- name="withDefaultModels"
- render={({ field }) => (
- <FormItem>
- <span className="row flex">
- <span className="flex-1">
- <FormLabel>Enable default models</FormLabel>
- <FormDescription>
- Default models for the selected adapter will be available in
- Langfuse features.
- </FormDescription>
- {currentAdapter === LLMAdapter.Azure && (
- <FormDescription className="text-dark-yellow">
- Azure LLM adapter does not support default model names
- maintained by Langfuse. Instead, please add a custom model
- below that is the same as your deployment name.
- </FormDescription>
- )}
- {currentAdapter === LLMAdapter.Bedrock && (
- <FormDescription className="text-dark-yellow">
- Bedrock LLM adapter does not support default model names
- maintained by Langfuse. Instead, please add the Bedrock
- model IDs you have enabled in the AWS console.
- </FormDescription>
- )}
- </span>
-
- <FormControl>
- <Switch
- disabled={
- currentAdapter === LLMAdapter.Azure ||
- currentAdapter === LLMAdapter.Bedrock
- }
- checked={
- currentAdapter === LLMAdapter.Azure ||
- currentAdapter === LLMAdapter.Bedrock
- ? false
- : field.value
- }
- onCheckedChange={field.onChange}
- />
- </FormControl>
- </span>
-
- <FormMessage />
- </FormItem>
- )}
- />
-
- {/* Custom model names */}
- <FormField
- control={form.control}
- name="customModels"
- render={() => (
- <FormItem>
- <FormLabel>Custom models</FormLabel>
- <FormDescription>
- Custom model names accepted by given endpoint.
- </FormDescription>
- {currentAdapter === LLMAdapter.Azure && (
- <FormDescription className="text-dark-yellow">
- {
- "For Azure, the model name should be the same as the deployment name in Azure. For evals, choose a model with function calling capabilities."
- }
- </FormDescription>
- )}
-
- {currentAdapter === LLMAdapter.Bedrock && (
- <FormDescription className="text-dark-yellow">
- {
- "For Bedrock, the model name is the Bedrock Inference Profile ID, e.g. 'eu.anthropic.claude-3-5-sonnet-20240620-v1:0'"
- }
- </FormDescription>
- )}
-
- {fields.map((customModel, index) => (
- <span key={customModel.id} className="flex flex-row space-x-2">
- <Input
- {...form.register(`customModels.${index}.value`)}
- placeholder={`Custom model name ${index + 1}`}
- />
- <Button
- type="button"
- variant="ghost"
- onClick={() => remove(index)}
- >
- <TrashIcon className="h-4 w-4" />
- </Button>
- </span>
- ))}
- <Button
- type="button"
- variant="ghost"
- onClick={() => append({ value: "" })}
- className="w-full"
- >
- <PlusIcon
- className="-ml-0.5 mr-1.5 h-5 w-5"
- aria-hidden="true"
- />
- Add custom model name
- </Button>
- </FormItem>
+ </DialogBody>
+
+ <DialogFooter>
+ <Button
+ type="submit"
+ className="w-full"
+ loading={form.formState.isSubmitting}
+ >
+ Save new LLM API key
+ </Button>
+
+ {form.formState.errors.root && (
+ <FormMessage>{form.formState.errors.root.message}</FormMessage>
)}
- />
-
- <Button
- type="submit"
- className="w-full"
- loading={form.formState.isSubmitting}
- >
- Save new LLM API key
- </Button>
-
- {form.formState.errors.root && (
- <FormMessage>{form.formState.errors.root.message}</FormMessage>
- )}
+ </DialogFooter>
</form>
</Form>
);
diff --git a/web/src/features/public-api/components/LLMApiKeyList.tsx b/web/src/features/public-api/components/LLMApiKeyList.tsx
index 88fc24650a..24efa66407 100644
--- a/web/src/features/public-api/components/LLMApiKeyList.tsx
+++ b/web/src/features/public-api/components/LLMApiKeyList.tsx
@@ -160,11 +160,12 @@ function DeleteApiKeyButton(props: { projectId: string; apiKeyId: string }) {
<DialogContent>
<DialogHeader>
<DialogTitle className="mb-5">Delete LLM provider</DialogTitle>
+ <DialogDescription>
+ Are you sure you want to delete this LLM provider? This action
+ cannot be undone.
+ </DialogDescription>
</DialogHeader>
- <DialogDescription>
- Are you sure you want to delete this LLM provider? This action cannot
- be undone.
- </DialogDescription>
+
<DialogFooter>
<Button
variant="destructive"
diff --git a/web/src/features/rbac/components/CreateProjectMemberButton.tsx b/web/src/features/rbac/components/CreateProjectMemberButton.tsx
index 874631ce44..580eee9dae 100644
--- a/web/src/features/rbac/components/CreateProjectMemberButton.tsx
+++ b/web/src/features/rbac/components/CreateProjectMemberButton.tsx
@@ -7,7 +7,9 @@ import { zodResolver } from "@hookform/resolvers/zod";
import { useForm } from "react-hook-form";
import {
Dialog,
+ DialogBody,
DialogContent,
+ DialogFooter,
DialogHeader,
DialogTitle,
DialogTrigger,
@@ -158,105 +160,109 @@ export function CreateProjectMemberButton(props: {
// eslint-disable-next-line @typescript-eslint/no-misused-promises
onSubmit={form.handleSubmit(onSubmit)}
>
- <FormField
- control={form.control}
- name="email"
- render={({ field }) => (
- <FormItem>
- <FormLabel>Email</FormLabel>
- <FormControl>
- <Input placeholder="[email protected]" {...field} />
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
- {!hasOnlySingleProjectAccess && (
+ <DialogBody>
<FormField
control={form.control}
- name="orgRole"
+ name="email"
render={({ field }) => (
<FormItem>
- <FormLabel>Organization Role</FormLabel>
- <Select
- defaultValue={field.value}
- onValueChange={(value) =>
- field.onChange(
- value as (typeof Role)[keyof typeof Role],
- )
- }
- >
- <FormControl>
- <SelectTrigger>
- <SelectValue placeholder="Select an organization role" />
- </SelectTrigger>
- </FormControl>
- <SelectContent>
- {Object.values(Role).map((role) => (
- <RoleSelectItem role={role} key={role} />
- ))}
- </SelectContent>
- </Select>
+ <FormLabel>Email</FormLabel>
+ <FormControl>
+ <Input placeholder="[email protected]" {...field} />
+ </FormControl>
<FormMessage />
</FormItem>
)}
/>
- )}
- {props.project !== undefined && hasProjectRoleEntitlement && (
- <FormField
- control={form.control}
- name="projectRole"
- render={({ field }) => (
- <FormItem>
- <FormLabel>Project Role</FormLabel>
- <Select
- defaultValue={field.value}
- onValueChange={(value) =>
- field.onChange(
- value as (typeof Role)[keyof typeof Role],
- )
- }
- >
- <FormControl>
- <SelectTrigger>
- <SelectValue placeholder="Select a project role" />
- </SelectTrigger>
- </FormControl>
- <SelectContent>
- {Object.values(Role)
- .filter(
- (role) =>
- !hasOnlySingleProjectAccess ||
- role !== Role.NONE,
+ {!hasOnlySingleProjectAccess && (
+ <FormField
+ control={form.control}
+ name="orgRole"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel>Organization Role</FormLabel>
+ <Select
+ defaultValue={field.value}
+ onValueChange={(value) =>
+ field.onChange(
+ value as (typeof Role)[keyof typeof Role],
)
- .map((role) => (
- <RoleSelectItem
- role={role}
- key={role}
- isProjectRole
- />
+ }
+ >
+ <FormControl>
+ <SelectTrigger>
+ <SelectValue placeholder="Select an organization role" />
+ </SelectTrigger>
+ </FormControl>
+ <SelectContent>
+ {Object.values(Role).map((role) => (
+ <RoleSelectItem role={role} key={role} />
))}
- </SelectContent>
- </Select>
- {!hasOnlySingleProjectAccess && (
- <FormDescription>
- This project role will override the default role for
- this current project ({props.project!.name}).
- </FormDescription>
- )}
- <FormMessage />
- </FormItem>
- )}
- />
- )}
- <Button
- type="submit"
- className="w-full"
- loading={form.formState.isSubmitting}
- >
- Grant access
- </Button>
- <FormMessage />
+ </SelectContent>
+ </Select>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ )}
+ {props.project !== undefined && hasProjectRoleEntitlement && (
+ <FormField
+ control={form.control}
+ name="projectRole"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel>Project Role</FormLabel>
+ <Select
+ defaultValue={field.value}
+ onValueChange={(value) =>
+ field.onChange(
+ value as (typeof Role)[keyof typeof Role],
+ )
+ }
+ >
+ <FormControl>
+ <SelectTrigger>
+ <SelectValue placeholder="Select a project role" />
+ </SelectTrigger>
+ </FormControl>
+ <SelectContent>
+ {Object.values(Role)
+ .filter(
+ (role) =>
+ !hasOnlySingleProjectAccess ||
+ role !== Role.NONE,
+ )
+ .map((role) => (
+ <RoleSelectItem
+ role={role}
+ key={role}
+ isProjectRole
+ />
+ ))}
+ </SelectContent>
+ </Select>
+ {!hasOnlySingleProjectAccess && (
+ <FormDescription>
+ This project role will override the default role for
+ this current project ({props.project!.name}).
+ </FormDescription>
+ )}
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ )}
+ </DialogBody>
+ <DialogFooter>
+ <Button
+ type="submit"
+ className="w-full"
+ loading={form.formState.isSubmitting}
+ >
+ Grant access
+ </Button>
+ <FormMessage />
+ </DialogFooter>
</form>
</Form>
</DialogContent>
diff --git a/web/src/features/scores/components/CreateScoreConfigButton.tsx b/web/src/features/scores/components/CreateScoreConfigButton.tsx
index 1ed6812c1b..4592727789 100644
--- a/web/src/features/scores/components/CreateScoreConfigButton.tsx
+++ b/web/src/features/scores/components/CreateScoreConfigButton.tsx
@@ -3,7 +3,9 @@ import { Button } from "@/src/components/ui/button";
import { useHasProjectAccess } from "@/src/features/rbac/utils/checkProjectAccess";
import {
Dialog,
+ DialogBody,
DialogContent,
+ DialogFooter,
DialogHeader,
DialogTitle,
DialogTrigger,
@@ -193,248 +195,255 @@ export function CreateScoreConfigButton({ projectId }: { projectId: string }) {
// eslint-disable-next-line @typescript-eslint/no-misused-promises
onSubmit={form.handleSubmit(onSubmit)}
>
- <FormField
- control={form.control}
- name="name"
- render={({ field }) => (
- <FormItem>
- <FormLabel>Name</FormLabel>
- <FormControl>
- <Input
- {...field}
- type="text"
- onBlur={(e) => field.onChange(e.target.value.trimEnd())}
- />
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
- <FormField
- control={form.control}
- name="dataType"
- render={({ field }) => (
- <FormItem>
- <FormLabel>Data type</FormLabel>
- <Select
- defaultValue={field.value}
- onValueChange={(value) => {
- field.onChange(
- value as (typeof availableDataTypes)[number],
- );
- form.clearErrors();
- if (isNumericDataType(value as ScoreDataType)) {
- form.setValue("categories", undefined);
- } else {
- form.setValue("minValue", undefined);
- form.setValue("maxValue", undefined);
- if (isBooleanDataType(value as ScoreDataType)) {
- replace([
- { label: "True", value: 1 },
- { label: "False", value: 0 },
- ]);
- } else {
- replace([{ label: "", value: 0 }]);
- }
- }
- }}
- >
+ <DialogBody>
+ <FormField
+ control={form.control}
+ name="name"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel>Name</FormLabel>
<FormControl>
- <SelectTrigger>
- <SelectValue placeholder="Select a data type" />
- </SelectTrigger>
+ <Input
+ {...field}
+ type="text"
+ onBlur={(e) =>
+ field.onChange(e.target.value.trimEnd())
+ }
+ />
</FormControl>
- <SelectContent>
- {availableDataTypes.map((role) => (
- <SelectItem value={role} key={role}>
- {role}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- <FormMessage />
- </FormItem>
- )}
- />
- {isNumericDataType(form.getValues("dataType")) ? (
- <>
- <FormField
- control={form.control}
- name="minValue"
- render={({ field }) => (
- <FormItem>
- <FormLabel>Minimum (optional) </FormLabel>
- <FormControl>
- <Input
- {...field}
- value={field.value ?? ""}
- // manually manage controlled input state
- onChange={(e) => {
- const value = e.target.value;
- field.onChange(
- value === "" ? undefined : Number(value),
- );
- }}
- type="number"
- />
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
- <FormField
- control={form.control}
- name="maxValue"
- render={({ field }) => (
- <FormItem>
- <FormLabel>Maximum (optional)</FormLabel>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ <FormField
+ control={form.control}
+ name="dataType"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel>Data type</FormLabel>
+ <Select
+ defaultValue={field.value}
+ onValueChange={(value) => {
+ field.onChange(
+ value as (typeof availableDataTypes)[number],
+ );
+ form.clearErrors();
+ if (isNumericDataType(value as ScoreDataType)) {
+ form.setValue("categories", undefined);
+ } else {
+ form.setValue("minValue", undefined);
+ form.setValue("maxValue", undefined);
+ if (isBooleanDataType(value as ScoreDataType)) {
+ replace([
+ { label: "True", value: 1 },
+ { label: "False", value: 0 },
+ ]);
+ } else {
+ replace([{ label: "", value: 0 }]);
+ }
+ }
+ }}
+ >
<FormControl>
- <Input
- {...field}
- value={field.value ?? ""}
- // manually manage controlled input state
- onChange={(e) => {
- const value = e.target.value;
- field.onChange(
- value === "" ? undefined : Number(value),
- );
- }}
- type="number"
- />
+ <SelectTrigger>
+ <SelectValue placeholder="Select a data type" />
+ </SelectTrigger>
</FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
- </>
- ) : (
- <div className="grid grid-flow-row gap-2">
- <FormField
- control={form.control}
- name="categories"
- render={() => (
- <>
- {fields.length > 0 && (
- <div className="mb-2 grid grid-cols-[1fr,3fr] items-center gap-2 text-left sm:grid-cols-[1fr,7fr]">
- <FormLabel className="grid grid-flow-col">
- Value
- <DocPopup
- description={`This is how the ${
- isCategoricalDataType(
- form.getValues("dataType"),
- )
- ? "category"
- : "boolean"
- } label is mapped to an integer value internally.`}
- />
- </FormLabel>
- <FormLabel>Label</FormLabel>
- </div>
- )}
- {fields.map((category, index) => (
- <div
- key={`${category.id}-langfuseObject`}
- className="items-top mb-2 grid grid-cols-[1fr,3fr] gap-2 text-left sm:grid-cols-[1fr,7fr]"
- >
- <FormField
- control={form.control}
- name={`categories.${index}.value`}
- render={({ field }) => (
- <FormItem>
- <FormControl>
- <Input
- {...field}
- readOnly
- disabled
- inputMode="numeric"
- className="text-center"
- />
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
+ <SelectContent>
+ {availableDataTypes.map((role) => (
+ <SelectItem value={role} key={role}>
+ {role}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ {isNumericDataType(form.getValues("dataType")) ? (
+ <>
+ <FormField
+ control={form.control}
+ name="minValue"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel>Minimum (optional) </FormLabel>
+ <FormControl>
+ <Input
+ {...field}
+ value={field.value ?? ""}
+ // manually manage controlled input state
+ onChange={(e) => {
+ const value = e.target.value;
+ field.onChange(
+ value === "" ? undefined : Number(value),
+ );
+ }}
+ type="number"
+ />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ <FormField
+ control={form.control}
+ name="maxValue"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel>Maximum (optional)</FormLabel>
+ <FormControl>
+ <Input
+ {...field}
+ value={field.value ?? ""}
+ // manually manage controlled input state
+ onChange={(e) => {
+ const value = e.target.value;
+ field.onChange(
+ value === "" ? undefined : Number(value),
+ );
+ }}
+ type="number"
/>
- <div className="grid grid-cols-[1fr,auto] gap-2">
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ </>
+ ) : (
+ <div className="grid grid-flow-row gap-2">
+ <FormField
+ control={form.control}
+ name="categories"
+ render={() => (
+ <>
+ {fields.length > 0 && (
+ <div className="mb-2 grid grid-cols-[1fr,3fr] items-center gap-2 text-left sm:grid-cols-[1fr,7fr]">
+ <FormLabel className="grid grid-flow-col">
+ Value
+ <DocPopup
+ description={`This is how the ${
+ isCategoricalDataType(
+ form.getValues("dataType"),
+ )
+ ? "category"
+ : "boolean"
+ } label is mapped to an integer value internally.`}
+ />
+ </FormLabel>
+ <FormLabel>Label</FormLabel>
+ </div>
+ )}
+ {fields.map((category, index) => (
+ <div
+ key={`${category.id}-langfuseObject`}
+ className="items-top mb-2 grid grid-cols-[1fr,3fr] gap-2 text-left sm:grid-cols-[1fr,7fr]"
+ >
<FormField
control={form.control}
- name={`categories.${index}.label`}
+ name={`categories.${index}.value`}
render={({ field }) => (
<FormItem>
<FormControl>
<Input
{...field}
- type="text"
- onBlur={(e) =>
- field.onChange(
- e.target.value.trimEnd(),
- )
- }
- readOnly={isBooleanDataType(
- form.getValues("dataType"),
- )}
+ readOnly
+ disabled
+ inputMode="numeric"
+ className="text-center"
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
- {isCategoricalDataType(
- form.getValues("dataType"),
- ) && (
- <Button
- onClick={() => remove(index)}
- variant="outline"
- size="icon"
- disabled={
- index === 0 || index !== fields.length - 1
- }
- >
- <Trash className="h-4 w-4" />
- </Button>
- )}
+ <div className="grid grid-cols-[1fr,auto] gap-2">
+ <FormField
+ control={form.control}
+ name={`categories.${index}.label`}
+ render={({ field }) => (
+ <FormItem>
+ <FormControl>
+ <Input
+ {...field}
+ type="text"
+ onBlur={(e) =>
+ field.onChange(
+ e.target.value.trimEnd(),
+ )
+ }
+ readOnly={isBooleanDataType(
+ form.getValues("dataType"),
+ )}
+ />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ {isCategoricalDataType(
+ form.getValues("dataType"),
+ ) && (
+ <Button
+ onClick={() => remove(index)}
+ variant="outline"
+ size="icon"
+ disabled={
+ index === 0 || index !== fields.length - 1
+ }
+ >
+ <Trash className="h-4 w-4" />
+ </Button>
+ )}
+ </div>
</div>
- </div>
- ))}
- {isCategoricalDataType(form.getValues("dataType")) && (
- <div className="grid-cols-auto grid">
- <Button
- type="button"
- variant="secondary"
- disabled={
- isBooleanDataType(form.getValues("dataType")) &&
- fields.length === 2
- }
- onClick={() =>
- append({ label: "", value: fields.length })
- }
- >
- Add category
- </Button>
- </div>
- )}
- </>
- )}
- />
- </div>
- )}
- <FormField
- control={form.control}
- name="description"
- render={({ field }) => (
- <>
- <FormItem>
- <FormLabel>Description (optional)</FormLabel>
- <FormControl>
- <Textarea
- {...field}
- placeholder="Provide an optional description of the score config..."
- />
- </FormControl>
- <FormMessage />
- </FormItem>
- </>
+ ))}
+ {isCategoricalDataType(
+ form.getValues("dataType"),
+ ) && (
+ <div className="grid-cols-auto grid">
+ <Button
+ type="button"
+ variant="secondary"
+ disabled={
+ isBooleanDataType(
+ form.getValues("dataType"),
+ ) && fields.length === 2
+ }
+ onClick={() =>
+ append({ label: "", value: fields.length })
+ }
+ >
+ Add category
+ </Button>
+ </div>
+ )}
+ </>
+ )}
+ />
+ </div>
)}
- />
+ <FormField
+ control={form.control}
+ name="description"
+ render={({ field }) => (
+ <>
+ <FormItem>
+ <FormLabel>Description (optional)</FormLabel>
+ <FormControl>
+ <Textarea
+ {...field}
+ placeholder="Provide an optional description of the score config..."
+ />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ </>
+ )}
+ />
+ </DialogBody>
</form>
<Dialog
open={confirmOpen}
@@ -444,39 +453,45 @@ export function CreateScoreConfigButton({ projectId }: { projectId: string }) {
}}
>
<DialogTrigger asChild>
- <Button
- type="button"
- className="w-full"
- onClick={handleSubmitConfirm}
- >
- Submit
- </Button>
- </DialogTrigger>
- <DialogContent>
- <DialogHeader>
- <DialogTitle>Confirm Submission</DialogTitle>
- </DialogHeader>
- <p className="text-sm">
- Score configs cannot be edited or deleted after they have been
- created. Are you sure you want to proceed?
- </p>
- <div className="flex justify-end space-x-2">
+ <div className="p-6 pt-0">
<Button
type="button"
- variant="outline"
- disabled={form.formState.isSubmitting}
- onClick={() => setConfirmOpen(false)}
+ className="w-full"
+ onClick={handleSubmitConfirm}
>
- Continue Editing
- </Button>
- <Button
- type="submit"
- loading={form.formState.isSubmitting}
- onClick={form.handleSubmit(onSubmit)}
- >
- Confirm
+ Submit
</Button>
</div>
+ </DialogTrigger>
+ <DialogContent>
+ <DialogHeader>
+ <DialogTitle>Confirm Submission</DialogTitle>
+ </DialogHeader>
+ <DialogBody>
+ <p className="text-sm">
+ Score configs cannot be edited or deleted after they have
+ been created. Are you sure you want to proceed?
+ </p>
+ </DialogBody>
+ <DialogFooter>
+ <div className="flex justify-end space-x-2">
+ <Button
+ type="button"
+ variant="outline"
+ disabled={form.formState.isSubmitting}
+ onClick={() => setConfirmOpen(false)}
+ >
+ Continue Editing
+ </Button>
+ <Button
+ type="submit"
+ loading={form.formState.isSubmitting}
+ onClick={form.handleSubmit(onSubmit)}
+ >
+ Confirm
+ </Button>
+ </div>
+ </DialogFooter>
</DialogContent>
</Dialog>
{formError ? (
diff --git a/web/src/features/table/components/TableActionDialog.tsx b/web/src/features/table/components/TableActionDialog.tsx
index 8f7d8d9202..16fb0d58f2 100644
--- a/web/src/features/table/components/TableActionDialog.tsx
+++ b/web/src/features/table/components/TableActionDialog.tsx
@@ -1,5 +1,6 @@
import {
Dialog,
+ DialogBody,
DialogContent,
DialogDescription,
DialogFooter,
@@ -84,31 +85,33 @@ export function TableActionDialog({
className="space-y-6"
onSubmit={form.handleSubmit(handleConfirm)}
>
- <FormField
- control={form.control}
- name="targetId"
- render={({ field }) => (
- <FormItem>
- <Select
- onValueChange={field.onChange}
- defaultValue={field.value}
- >
- <FormControl>
- <SelectTrigger>
- <SelectValue placeholder="Select..." />
- </SelectTrigger>
- </FormControl>
- <SelectContent>
- <TableActionTargetOptions
- action={action}
- projectId={projectId}
- />
- </SelectContent>
- </Select>
- <FormMessage />
- </FormItem>
- )}
- />
+ <DialogBody>
+ <FormField
+ control={form.control}
+ name="targetId"
+ render={({ field }) => (
+ <FormItem>
+ <Select
+ onValueChange={field.onChange}
+ defaultValue={field.value}
+ >
+ <FormControl>
+ <SelectTrigger>
+ <SelectValue placeholder="Select..." />
+ </SelectTrigger>
+ </FormControl>
+ <SelectContent>
+ <TableActionTargetOptions
+ action={action}
+ projectId={projectId}
+ />
+ </SelectContent>
+ </Select>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ </DialogBody>
<DialogFooter>
{isInProgress.data && (
<div className="flex items-center gap-1">
diff --git a/web/src/features/widgets/components/SelectWidgetDialog.tsx b/web/src/features/widgets/components/SelectWidgetDialog.tsx
index 7554424a14..294e624554 100644
--- a/web/src/features/widgets/components/SelectWidgetDialog.tsx
+++ b/web/src/features/widgets/components/SelectWidgetDialog.tsx
@@ -7,6 +7,7 @@ import {
DialogHeader,
DialogTitle,
DialogFooter,
+ DialogBody,
} from "@/src/components/ui/dialog";
import { Button } from "@/src/components/ui/button";
import { PlusIcon } from "lucide-react";
@@ -85,69 +86,76 @@ export function SelectWidgetDialog({
<DialogTitle>Select widget to add</DialogTitle>
</DialogHeader>
- <div className="mt-4 max-h-[400px] overflow-y-auto">
- {widgets.isLoading ? (
- <div className="py-8 text-center">Loading widgets...</div>
- ) : widgets.isError ? (
- <div className="py-8 text-center text-destructive">
- Error: {widgets.error.message}
- </div>
- ) : widgets.data?.widgets.length === 0 ? (
- <div className="py-8 text-center text-muted-foreground">
- No widgets found. Create a new widget to get started.
- </div>
- ) : (
- <Table>
- <TableHeader>
- <TableRow>
- <TableHead>Name</TableHead>
- <TableHead>Description</TableHead>
- <TableHead>View Type</TableHead>
- <TableHead>Chart Type</TableHead>
- </TableRow>
- </TableHeader>
- <TableBody>
- {widgets.data?.widgets.map((widget) => (
- <TableRow
- key={widget.id}
- onClick={() => setSelectedWidgetId(widget.id)}
- className={`cursor-pointer hover:bg-muted ${
- selectedWidgetId === widget.id ? "bg-muted" : ""
- }`}
- >
- <TableCell className="font-medium">{widget.name}</TableCell>
- <TableCell className="truncate" title={widget.description}>
- {widget.description}
- </TableCell>
- <TableCell>
- {startCase(widget.view.toLowerCase())}
- </TableCell>
- <TableCell>
- {(() => {
- switch (widget.chartType) {
- case "LINE_TIME_SERIES":
- return "Line Chart (Time Series)";
- case "BAR_TIME_SERIES":
- return "Bar Chart (Time Series)";
- case "HORIZONTAL_BAR":
- return "Horizontal Bar Chart (Total Value)";
- case "VERTICAL_BAR":
- return "Vertical Bar Chart (Total Value)";
- case "PIE":
- return "Pie Chart (Total Value)";
- case "NUMBER":
- return "Big Number (Total Value)";
- default:
- return widget.chartType;
- }
- })()}
- </TableCell>
+ <DialogBody>
+ <div className="max-h-[400px] overflow-y-auto">
+ {widgets.isLoading ? (
+ <div className="py-8 text-center">Loading widgets...</div>
+ ) : widgets.isError ? (
+ <div className="py-8 text-center text-destructive">
+ Error: {widgets.error.message}
+ </div>
+ ) : widgets.data?.widgets.length === 0 ? (
+ <div className="py-8 text-center text-muted-foreground">
+ No widgets found. Create a new widget to get started.
+ </div>
+ ) : (
+ <Table>
+ <TableHeader>
+ <TableRow>
+ <TableHead>Name</TableHead>
+ <TableHead>Description</TableHead>
+ <TableHead>View Type</TableHead>
+ <TableHead>Chart Type</TableHead>
</TableRow>
- ))}
- </TableBody>
- </Table>
- )}
- </div>
+ </TableHeader>
+ <TableBody>
+ {widgets.data?.widgets.map((widget) => (
+ <TableRow
+ key={widget.id}
+ onClick={() => setSelectedWidgetId(widget.id)}
+ className={`cursor-pointer hover:bg-muted ${
+ selectedWidgetId === widget.id ? "bg-muted" : ""
+ }`}
+ >
+ <TableCell className="font-medium">
+ {widget.name}
+ </TableCell>
+ <TableCell
+ className="truncate"
+ title={widget.description}
+ >
+ {widget.description}
+ </TableCell>
+ <TableCell>
+ {startCase(widget.view.toLowerCase())}
+ </TableCell>
+ <TableCell>
+ {(() => {
+ switch (widget.chartType) {
+ case "LINE_TIME_SERIES":
+ return "Line Chart (Time Series)";
+ case "BAR_TIME_SERIES":
+ return "Bar Chart (Time Series)";
+ case "HORIZONTAL_BAR":
+ return "Horizontal Bar Chart (Total Value)";
+ case "VERTICAL_BAR":
+ return "Vertical Bar Chart (Total Value)";
+ case "PIE":
+ return "Pie Chart (Total Value)";
+ case "NUMBER":
+ return "Big Number (Total Value)";
+ default:
+ return widget.chartType;
+ }
+ })()}
+ </TableCell>
+ </TableRow>
+ ))}
+ </TableBody>
+ </Table>
+ )}
+ </div>
+ </DialogBody>
<DialogFooter className="mt-4 flex justify-between">
<Button onClick={handleNavigateToNewWidget} variant="outline">