Skip to content

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

feat(ui): add cmd+k menu (#5276)

Marc Klingen02a3d91c5612
diff --git a/web/src/components/command-k-menu.tsx b/web/src/components/command-k-menu.tsx
new file mode 100644
index 0000000000..50f99f719d
--- /dev/null
+++ b/web/src/components/command-k-menu.tsx
@@ -0,0 +1,78 @@
+import { type NavigationItem } from "@/src/components/layouts/layout";
+import {
+ CommandDialog,
+ CommandEmpty,
+ CommandGroup,
+ CommandInput,
+ CommandItem,
+ CommandList,
+} from "@/src/components/ui/command";
+import { useRouter } from "next/router";
+import { useEffect, useState } from "react";
+
+export function CommandKMenu({
+ mainNavigation,
+}: {
+ mainNavigation: NavigationItem[];
+}) {
+ const [open, setOpen] = useState(false);
+ const router = useRouter();
+
+ const navItems = mainNavigation
+ .flatMap((item) => [
+ {
+ title: item.title,
+ url: item.url,
+ },
+ ...(item.items?.map((child) => ({
+ title: `${item.title} > ${child.title}`,
+ url: child.url,
+ })) ?? []),
+ ])
+ .filter((item) => Boolean(item.url));
+
+ useEffect(() => {
+ const down = (e: KeyboardEvent) => {
+ if (e.key === "k" && (e.metaKey || e.ctrlKey)) {
+ e.preventDefault();
+ setOpen((open) => !open);
+ }
+ };
+ document.addEventListener("keydown", down);
+ return () => document.removeEventListener("keydown", down);
+ }, []);
+
+ return (
+ <CommandDialog
+ open={open}
+ onOpenChange={setOpen}
+ filter={(value, search, keywords) => {
+ const extendValue = value + " " + keywords?.join(" ");
+ if (extendValue.toLowerCase().includes(search.toLowerCase())) return 1;
+ return 0;
+ }}
+ >
+ <CommandInput
+ placeholder="Type a command or search..."
+ className="border-none focus:border-none focus:outline-none focus:ring-0 focus:ring-transparent"
+ />
+ <CommandList>
+ <CommandEmpty>No results found.</CommandEmpty>
+ <CommandGroup heading="Main Navigation">
+ {navItems.map((item) => (
+ <CommandItem
+ key={item.url}
+ value={item.url}
+ onSelect={() => {
+ router.push(item.url);
+ setOpen(false);
+ }}
+ >
+ {item.title}
+ </CommandItem>
+ ))}
+ </CommandGroup>
+ </CommandList>
+ </CommandDialog>
+ );
+}
diff --git a/web/src/components/layouts/layout.tsx b/web/src/components/layouts/layout.tsx
index 747b6c1e9e..b718b9dd11 100644
--- a/web/src/components/layouts/layout.tsx
+++ b/web/src/components/layouts/layout.tsx
@@ -15,6 +15,7 @@ import { useUiCustomization } from "@/src/ee/features/ui-customization/useUiCust
import { hasOrganizationAccess } from "@/src/features/rbac/utils/checkOrganizationAccess";
import { SidebarInset, SidebarProvider } from "@/src/components/ui/sidebar";
import { AppSidebar } from "@/src/components/nav/app-sidebar";
+import { CommandKMenu } from "@/src/components/command-k-menu";
const signOutUser = async () => {
localStorage.clear();
@@ -314,6 +315,7 @@ export default function Layout(props: PropsWithChildren) {
<SidebarInset className="h-dvh max-w-full md:peer-data-[state=collapsed]:w-[calc(100vw-var(--sidebar-width-icon))] md:peer-data-[state=expanded]:w-[calc(100vw-var(--sidebar-width))]">
<main className="h-full p-3">{props.children}</main>
<Toaster visibleToasts={1} />
+ <CommandKMenu mainNavigation={navigation} />
</SidebarInset>
</SidebarProvider>
</div>
@@ -325,7 +327,7 @@ export type NavigationItem = NestedNavigationItem & {
items?: NestedNavigationItem[];
};
-type NestedNavigationItem = Omit<Route, "children"> & {
+type NestedNavigationItem = Omit<Route, "children" | "items"> & {
url: string;
isActive: boolean;
};
diff --git a/web/src/components/layouts/routes.tsx b/web/src/components/layouts/routes.tsx
index 4bb1400f9c..4d3e29f5d2 100644
--- a/web/src/components/layouts/routes.tsx
+++ b/web/src/components/layouts/routes.tsx
@@ -59,7 +59,7 @@ export const ROUTES: Route[] = [
},
{
title: "Tracing",
- pathname: `/project/[projectId]/traces`,
+ pathname: "",
icon: ListTree,
items: [
{
@@ -83,7 +83,7 @@ export const ROUTES: Route[] = [
{
title: "Evaluation",
icon: Lightbulb,
- pathname: `/project/[projectId]/annotation-queues`,
+ pathname: "",
entitlements: ["annotation-queues", "model-based-evaluations"],
projectRbacScopes: ["annotationQueues:read", "evalJob:read"],
items: [
diff --git a/web/src/components/ui/command.tsx b/web/src/components/ui/command.tsx
index aaa3c4848c..9f4e31772a 100644
--- a/web/src/components/ui/command.tsx
+++ b/web/src/components/ui/command.tsx
@@ -5,8 +5,8 @@ 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 { cn } from "@/src/utils/tailwind";
+import { Dialog, DialogContent } from "@/src/components/ui/dialog";
const Command = React.forwardRef<
React.ElementRef<typeof CommandPrimitive>,
@@ -15,7 +15,7 @@ const Command = React.forwardRef<
<CommandPrimitive
ref={ref}
className={cn(
- "flex h-full w-full flex-col overflow-hidden rounded-md bg-white text-slate-950 dark:bg-slate-950 dark:text-slate-50",
+ "flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
className,
)}
{...props}
@@ -23,13 +23,20 @@ const Command = React.forwardRef<
));
Command.displayName = CommandPrimitive.displayName;
-interface CommandDialogProps extends DialogProps {}
-
-const CommandDialog = ({ children, ...props }: CommandDialogProps) => {
+const CommandDialog = ({
+ children,
+ filter,
+ ...props
+}: DialogProps & {
+ filter?: React.ComponentProps<typeof CommandPrimitive>["filter"];
+}) => {
return (
<Dialog {...props}>
<DialogContent className="overflow-hidden p-0 shadow-lg">
- <Command 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">
+ <Command
+ filter={filter}
+ className="[&_[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 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5"
+ >
{children}
</Command>
</DialogContent>
@@ -41,12 +48,12 @@ const CommandInput = React.forwardRef<
React.ElementRef<typeof CommandPrimitive.Input>,
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>
>(({ className, ...props }, ref) => (
- <div className="flex items-center rounded border px-3" cmdk-input-wrapper="">
+ <div className="flex items-center border-b px-3" cmdk-input-wrapper="">
<Search className="mr-2 h-4 w-4 shrink-0 opacity-50" />
<CommandPrimitive.Input
ref={ref}
className={cn(
- "flex h-8 w-full rounded border-transparent bg-transparent py-3 text-sm outline-none placeholder:text-slate-500 focus:border-0 focus:border-none focus:border-transparent focus:ring-0 disabled:cursor-not-allowed disabled:opacity-50 dark:placeholder:text-slate-400 ",
+ "flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground focus:outline-none disabled:cursor-not-allowed disabled:opacity-50",
className,
)}
{...props}
@@ -89,7 +96,7 @@ const CommandGroup = React.forwardRef<
<CommandPrimitive.Group
ref={ref}
className={cn(
- "overflow-hidden p-1 text-slate-950 dark:text-slate-50 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-slate-500 dark:[&_[cmdk-group-heading]]:text-slate-400",
+ "overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
className,
)}
{...props}
@@ -104,7 +111,7 @@ const CommandSeparator = React.forwardRef<
>(({ className, ...props }, ref) => (
<CommandPrimitive.Separator
ref={ref}
- className={cn("-mx-1 h-px bg-slate-200 dark:bg-slate-800", className)}
+ className={cn("-mx-1 h-px bg-border", className)}
{...props}
/>
));
@@ -117,7 +124,7 @@ const CommandItem = React.forwardRef<
<CommandPrimitive.Item
ref={ref}
className={cn(
- "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-slate-100 aria-selected:text-slate-900 dark:aria-selected:bg-slate-800 dark:aria-selected:text-slate-50",
+ "relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
className,
)}
{...props}
@@ -133,7 +140,7 @@ const CommandShortcut = ({
return (
<span
className={cn(
- "ml-auto text-xs tracking-widest text-slate-500 dark:text-slate-400",
+ "ml-auto text-xs tracking-widest text-muted-foreground",
className,
)}
{...props}
diff --git a/web/src/components/ui/input-command.tsx b/web/src/components/ui/input-command.tsx
new file mode 100644
index 0000000000..ab9f66ef63
--- /dev/null
+++ b/web/src/components/ui/input-command.tsx
@@ -0,0 +1,161 @@
+"use client";
+
+// Adapted command to be used as a form field with suggestions
+// Find original shadcn/ui command component in /components/ui/command.tsx
+
+import * as React from "react";
+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 { cn } from "@/src/utils/tailwind";
+
+const InputCommand = React.forwardRef<
+ React.ElementRef<typeof CommandPrimitive>,
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive>
+>(({ className, ...props }, ref) => (
+ <CommandPrimitive
+ ref={ref}
+ className={cn(
+ "flex h-full w-full flex-col overflow-hidden rounded-md bg-white text-slate-950 dark:bg-slate-950 dark:text-slate-50",
+ className,
+ )}
+ {...props}
+ />
+));
+InputCommand.displayName = CommandPrimitive.displayName;
+
+interface InputCommandDialogProps extends DialogProps {}
+
+const InputCommandDialog = ({
+ children,
+ ...props
+}: InputCommandDialogProps) => {
+ 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>
+ </DialogContent>
+ </Dialog>
+ );
+};
+
+const InputCommandInput = React.forwardRef<
+ React.ElementRef<typeof CommandPrimitive.Input>,
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>
+>(({ className, ...props }, ref) => (
+ <div className="flex items-center rounded border px-3" cmdk-input-wrapper="">
+ <Search className="mr-2 h-4 w-4 shrink-0 opacity-50" />
+ <CommandPrimitive.Input
+ ref={ref}
+ className={cn(
+ "flex h-8 w-full rounded border-transparent bg-transparent py-3 text-sm outline-none placeholder:text-slate-500 focus:border-0 focus:border-none focus:border-transparent focus:ring-0 disabled:cursor-not-allowed disabled:opacity-50 dark:placeholder:text-slate-400",
+ className,
+ )}
+ {...props}
+ />
+ </div>
+));
+
+InputCommandInput.displayName = CommandPrimitive.Input.displayName;
+
+const InputCommandList = React.forwardRef<
+ React.ElementRef<typeof CommandPrimitive.List>,
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>
+>(({ className, ...props }, ref) => (
+ <CommandPrimitive.List
+ ref={ref}
+ className={cn("max-h-[300px] overflow-y-auto overflow-x-hidden", className)}
+ {...props}
+ />
+));
+
+InputCommandList.displayName = CommandPrimitive.List.displayName;
+
+const InputCommandEmpty = React.forwardRef<
+ React.ElementRef<typeof CommandPrimitive.Empty>,
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>
+>((props, ref) => (
+ <CommandPrimitive.Empty
+ ref={ref}
+ className="py-6 text-center text-sm"
+ {...props}
+ />
+));
+
+InputCommandEmpty.displayName = CommandPrimitive.Empty.displayName;
+
+const InputCommandGroup = React.forwardRef<
+ React.ElementRef<typeof CommandPrimitive.Group>,
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>
+>(({ className, ...props }, ref) => (
+ <CommandPrimitive.Group
+ ref={ref}
+ className={cn(
+ "overflow-hidden p-1 text-slate-950 dark:text-slate-50 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-slate-500 dark:[&_[cmdk-group-heading]]:text-slate-400",
+ className,
+ )}
+ {...props}
+ />
+));
+
+InputCommandGroup.displayName = CommandPrimitive.Group.displayName;
+
+const InputCommandSeparator = React.forwardRef<
+ React.ElementRef<typeof CommandPrimitive.Separator>,
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>
+>(({ className, ...props }, ref) => (
+ <CommandPrimitive.Separator
+ ref={ref}
+ className={cn("-mx-1 h-px bg-slate-200 dark:bg-slate-800", className)}
+ {...props}
+ />
+));
+InputCommandSeparator.displayName = CommandPrimitive.Separator.displayName;
+
+const InputCommandItem = React.forwardRef<
+ React.ElementRef<typeof CommandPrimitive.Item>,
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>
+>(({ className, ...props }, ref) => (
+ <CommandPrimitive.Item
+ ref={ref}
+ className={cn(
+ "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-slate-100 aria-selected:text-slate-900 dark:aria-selected:bg-slate-800 dark:aria-selected:text-slate-50",
+ className,
+ )}
+ {...props}
+ />
+));
+
+InputCommandItem.displayName = CommandPrimitive.Item.displayName;
+
+const InputCommandShortcut = ({
+ className,
+ ...props
+}: React.HTMLAttributes<HTMLSpanElement>) => {
+ return (
+ <span
+ className={cn(
+ "ml-auto text-xs tracking-widest text-slate-500 dark:text-slate-400",
+ className,
+ )}
+ {...props}
+ />
+ );
+};
+InputCommandShortcut.displayName = "CommandShortcut";
+
+export {
+ InputCommand,
+ InputCommandDialog,
+ InputCommandInput,
+ InputCommandList,
+ InputCommandEmpty,
+ InputCommandGroup,
+ InputCommandItem,
+ InputCommandShortcut,
+ InputCommandSeparator,
+};
diff --git a/web/src/ee/features/evals/components/evaluator-form.tsx b/web/src/ee/features/evals/components/evaluator-form.tsx
index 1e3fd85ce9..dc0a4d2524 100644
--- a/web/src/ee/features/evals/components/evaluator-form.tsx
+++ b/web/src/ee/features/evals/components/evaluator-form.tsx
@@ -53,14 +53,14 @@ import {
PopoverTrigger,
} from "@/src/components/ui/popover";
import {
- Command,
- CommandEmpty,
- CommandGroup,
- CommandInput,
- CommandItem,
- CommandList,
- CommandSeparator,
-} from "@/src/components/ui/command";
+ InputCommand,
+ InputCommandEmpty,
+ InputCommandGroup,
+ InputCommandInput,
+ InputCommandItem,
+ InputCommandList,
+ InputCommandSeparator,
+} from "@/src/components/ui/input-command";
import { cn } from "@/src/utils/tailwind";
import { Dialog, DialogContent, DialogTitle } from "@/src/components/ui/dialog";
import { EvalTemplateForm } from "@/src/ee/features/evals/components/template-form";
@@ -146,17 +146,17 @@ export const EvaluatorForm = (props: {
className="w-[--radix-popover-trigger-width] overflow-auto p-0"
align="start"
>
- <Command>
- <CommandInput
+ <InputCommand>
+ <InputCommandInput
placeholder="Search templates..."
className="h-9"
/>
- <CommandList>
- <CommandEmpty>No template found.</CommandEmpty>
- <CommandGroup>
+ <InputCommandList>
+ <InputCommandEmpty>No template found.</InputCommandEmpty>
+ <InputCommandGroup>
{Object.entries(templatesByName).map(
([name, templateData]) => (
- <CommandItem
+ <InputCommandItem
key={name}
onSelect={() => {
setSelectedTemplateName(name);
@@ -175,19 +175,21 @@ export const EvaluatorForm = (props: {
: "opacity-0",
)}
/>
- </CommandItem>
+ </InputCommandItem>
),
)}
- </CommandGroup>
- <CommandSeparator alwaysRender />
- <CommandGroup forceMount>
- <CommandItem onSelect={() => setIsCreateTemplateOpen(true)}>
+ </InputCommandGroup>
+ <InputCommandSeparator alwaysRender />
+ <InputCommandGroup forceMount>
+ <InputCommandItem
+ onSelect={() => setIsCreateTemplateOpen(true)}
+ >
Create new template
<ExternalLink className="ml-auto h-4 w-4" />
- </CommandItem>
- </CommandGroup>
- </CommandList>
- </Command>
+ </InputCommandItem>
+ </InputCommandGroup>
+ </InputCommandList>
+ </InputCommand>
</PopoverContent>
</Popover>
@@ -213,14 +215,14 @@ export const EvaluatorForm = (props: {
className="w-[--radix-popover-trigger-width] overflow-auto p-0"
align="start"
>
- <Command>
- <CommandList>
- <CommandEmpty>No version found.</CommandEmpty>
- <CommandGroup>
+ <InputCommand>
+ <InputCommandList>
+ <InputCommandEmpty>No version found.</InputCommandEmpty>
+ <InputCommandGroup>
{selectedTemplateName &&
templatesByName[selectedTemplateName] ? (
templatesByName[selectedTemplateName].map((template) => (
- <CommandItem
+ <InputCommandItem
key={template.id}
onSelect={() => {
setSelectedTemplateVersion(template.version);
@@ -236,14 +238,16 @@ export const EvaluatorForm = (props: {
: "opacity-0",
)}
/>
- </CommandItem>
+ </InputCommandItem>
))
) : (
- <CommandItem disabled>No versions available</CommandItem>
+ <InputCommandItem disabled>
+ No versions available
+ </InputCommandItem>
)}
- </CommandGroup>
- </CommandList>
- </Command>
+ </InputCommandGroup>
+ </InputCommandList>
+ </InputCommand>
</PopoverContent>
</Popover>
</div>
diff --git a/web/src/ee/features/experiments/components/CreateExperimentsForm.tsx b/web/src/ee/features/experiments/components/CreateExperimentsForm.tsx
index 988c5724c5..e68af86927 100644
--- a/web/src/ee/features/experiments/components/CreateExperimentsForm.tsx
+++ b/web/src/ee/features/experiments/components/CreateExperimentsForm.tsx
@@ -14,13 +14,13 @@ import { Form } from "@/src/components/ui/form";
import { Textarea } from "@/src/components/ui/textarea";
import { ModelParameters } from "@/src/components/ModelParameters";
import {
- CommandEmpty,
- CommandGroup,
- CommandInput,
- CommandList,
- Command,
- CommandItem,
-} from "@/src/components/ui/command";
+ InputCommandEmpty,
+ InputCommandGroup,
+ InputCommandInput,
+ InputCommandList,
+ InputCommand,
+ InputCommandItem,
+} from "@/src/components/ui/input-command";
import {
Select,
SelectContent,
@@ -562,7 +562,7 @@ export const CreateExperimentsForm = ({
render={() => (
<FormItem>
<FormLabel>Prompt</FormLabel>
- {/* FIX: I need the command list in the popover to be scrollable, currently it's not */}
+ {/* FIX: I need the Inputcommand list in the popover to be scrollable, currently it's not */}
<div className="mb-2 flex gap-2">
<Popover open={open} onOpenChange={setOpen}>
<PopoverTrigger asChild>
@@ -580,18 +580,20 @@ export const CreateExperimentsForm = ({
className="w-[--radix-popover-trigger-width] overflow-auto p-0"
align="start"
>
- <Command>
- <CommandInput
+ <InputCommand>
+ <InputCommandInput
placeholder="Search prompts..."
className="h-9"
/>
- <CommandList>
- <CommandEmpty>No prompt found.</CommandEmpty>
- <CommandGroup>
+ <InputCommandList>
+ <InputCommandEmpty>
+ No prompt found.
+ </InputCommandEmpty>
+ <InputCommandGroup>
{promptsByName &&
Object.entries(promptsByName).map(
([name, promptData]) => (
- <CommandItem
+ <InputCommandItem
key={name}
onSelect={() => {
setSelectedPromptName(name);
@@ -615,12 +617,12 @@ export const CreateExperimentsForm = ({
: "opacity-0",
)}
/>
- </CommandItem>
+ </InputCommandItem>
),
)}
- </CommandGroup>
- </CommandList>
- </Command>
+ </InputCommandGroup>
+ </InputCommandList>
+ </InputCommand>
</PopoverContent>
</Popover>
@@ -642,16 +644,18 @@ export const CreateExperimentsForm = ({
className="w-[--radix-popover-trigger-width] p-0"
align="start"
>
- <Command>
- <CommandList>
- <CommandEmpty>No version found.</CommandEmpty>
- <CommandGroup className="overflow-y-auto">
+ <InputCommand>
+ <InputCommandList>
+ <InputCommandEmpty>
+ No version found.
+ </InputCommandEmpty>
+ <InputCommandGroup className="overflow-y-auto">
{promptsByName &&
selectedPromptName &&
promptsByName[selectedPromptName] ? (
promptsByName[selectedPromptName].map(
(prompt) => (
- <CommandItem
+ <InputCommandItem
key={prompt.id}
onSelect={() => {
setSelectedPromptVersion(prompt.version);
@@ -668,17 +672,17 @@ export const CreateExperimentsForm = ({
: "opacity-0",
)}
/>
- </CommandItem>
+ </InputCommandItem>
),
)
) : (
- <CommandItem disabled>
+ <InputCommandItem disabled>
No versions available
- </CommandItem>
+ </InputCommandItem>
)}
- </CommandGroup>
- </CommandList>
- </Command>
+ </InputCommandGroup>
+ </InputCommandList>
+ </InputCommand>
</PopoverContent>
</Popover>
</div>
diff --git a/web/src/ee/features/playground/page/components/SaveToPromptButton.tsx b/web/src/ee/features/playground/page/components/SaveToPromptButton.tsx
index 1158789d56..4caf1a7595 100644
--- a/web/src/ee/features/playground/page/components/SaveToPromptButton.tsx
+++ b/web/src/ee/features/playground/page/components/SaveToPromptButton.tsx
@@ -5,13 +5,13 @@ import { useState } from "react";
import { Button } from "@/src/components/ui/button";
import {
- Command,
- CommandEmpty,
- CommandGroup,
- CommandInput,
- CommandItem,
- CommandList,
-} from "@/src/components/ui/command";
+ InputCommand,
+ InputCommandEmpty,
+ InputCommandGroup,
+ InputCommandInput,
+ InputCommandItem,
+ InputCommandList,
+} from "@/src/components/ui/input-command";
import {
Popover,
PopoverContent,
@@ -98,16 +98,16 @@ export const SaveToPromptButton: React.FC = () => {
Save as new prompt
</Button>
<Divider />
- <Command className="min-h-[8rem]">
- <CommandInput placeholder="Search chat prompts..." />
- <CommandEmpty>
+ <InputCommand className="min-h-[8rem]">
+ <InputCommandInput placeholder="Search chat prompts..." />
+ <InputCommandEmpty>
No chat prompt found
<DocPopup description="Prompts from the playground can only be saved to 'chat' prompts as they include multiple system/user messages." />
- </CommandEmpty>
- <CommandGroup className="mt-2">
- <CommandList>
+ </InputCommandEmpty>
+ <InputCommandGroup className="mt-2">
+ <InputCommandList>
{allChatPromptNamesWithIds.map((chatPrompt) => (
- <CommandItem
+ <InputCommandItem
key={chatPrompt.id}
title={chatPrompt.name}
value={chatPrompt.name}
@@ -133,11 +133,11 @@ export const SaveToPromptButton: React.FC = () => {
<span className="overflow-hidden text-ellipsis whitespace-nowrap">
{chatPrompt.name}
</span>
- </CommandItem>
+ </InputCommandItem>
))}
- </CommandList>
- </CommandGroup>
- </Command>
+ </InputCommandList>
+ </InputCommandGroup>
+ </InputCommand>
<Button
className="mt-2 w-full"
disabled={!Boolean(selectedPromptId)}
diff --git a/web/src/features/dashboard/components/ModelUsageChart.tsx b/web/src/features/dashboard/components/ModelUsageChart.tsx
index 7d5a9a5ad0..1a6ee34c8f 100644
--- a/web/src/features/dashboard/components/ModelUsageChart.tsx
+++ b/web/src/features/dashboard/components/ModelUsageChart.tsx
@@ -4,14 +4,14 @@ import { useEffect, useState } from "react";
import { NoDataOrLoading } from "@/src/components/NoDataOrLoading";
import { Button } from "@/src/components/ui/button";
import {
- Command,
- CommandEmpty,
- CommandGroup,
- CommandInput,
- CommandItem,
- CommandList,
- CommandSeparator,
-} from "@/src/components/ui/command";
+ InputCommand,
+ InputCommandEmpty,
+ InputCommandGroup,
+ InputCommandInput,
+ InputCommandItem,
+ InputCommandList,
+ InputCommandSeparator,
+} from "@/src/components/ui/input-command";
import {
Popover,
PopoverContent,
@@ -281,11 +281,11 @@ export const ModelUsageChart = ({
</Button>
</PopoverTrigger>
<PopoverContent className="w-56 p-0">
- <Command>
- <CommandInput placeholder="Search models..." />
- <CommandEmpty>No model found.</CommandEmpty>
- <CommandGroup>
- <CommandItem onSelect={handleSelectAll}>
+ <InputCommand>
+ <InputCommandInput placeholder="Search models..." />
+ <InputCommandEmpty>No model found.</InputCommandEmpty>
+ <InputCommandGroup>
+ <InputCommandItem onSelect={handleSelectAll}>
<Check
className={cn(
"mr-2 h-4 w-4",
@@ -295,11 +295,11 @@ export const ModelUsageChart = ({
<span>
<p className="font-semibold">Select All</p>
</span>
- </CommandItem>
- <CommandSeparator className="my-1" />
- <CommandList>
+ </InputCommandItem>
+ <InputCommandSeparator className="my-1" />
+ <InputCommandList>
{allModels.map((model) => (
- <CommandItem
+ <InputCommandItem
key={model}
onSelect={() => {
setSelectedModels((prev) =>
@@ -318,11 +318,11 @@ export const ModelUsageChart = ({
)}
/>
{!model || model === "" ? <i>none</i> : model}
- </CommandItem>
+ </InputCommandItem>
))}
- </CommandList>
- </CommandGroup>
- </Command>
+ </InputCommandList>
+ </InputCommandGroup>
+ </InputCommand>
</PopoverContent>
</Popover>
</div>
diff --git a/web/src/features/filters/components/filter-builder.tsx b/web/src/features/filters/components/filter-builder.tsx
index 1b29552e7c..f3555aab45 100644
--- a/web/src/features/filters/components/filter-builder.tsx
+++ b/web/src/features/filters/components/filter-builder.tsx
@@ -29,13 +29,13 @@ import { NonEmptyString } from "@langfuse/shared";
import { cn } from "@/src/utils/tailwind";
import { usePostHogClientCapture } from "@/src/features/posthog-analytics/usePostHogClientCapture";
import {
- Command,
- CommandEmpty,
- CommandGroup,
- CommandInput,
- CommandItem,
- CommandList,
-} from "@/src/components/ui/command";
+ InputCommand,
+ InputCommandEmpty,
+ InputCommandGroup,
+ InputCommandInput,
+ InputCommandItem,
+ InputCommandList,
+} from "@/src/components/ui/input-command";
// Has WipFilterState, passes all valid filters to parent onChange
export function PopoverFilterBuilder({
@@ -304,16 +304,18 @@ function FilterBuilderForm({
</Button>
</PopoverTrigger>
<PopoverContent className="max-w-fit p-0">
- <Command>
- <CommandInput
+ <InputCommand>
+ <InputCommandInput
placeholder="Search for column"
onFocus={(e) => (e.target.style.border = "none")}
/>
- <CommandList>
- <CommandEmpty>No options found.</CommandEmpty>
- <CommandGroup>
+ <InputCommandList>
+ <InputCommandEmpty>
+ No options found.
+ </InputCommandEmpty>
+ <InputCommandGroup>
{columns.map((option) => (
- <CommandItem
+ <InputCommandItem
key={option.id}
value={option.id}
onSelect={(value) => {
@@ -345,11 +347,11 @@ function FilterBuilderForm({
)}
/>
{option.name}
- </CommandItem>
+ </InputCommandItem>
))}
- </CommandGroup>
- </CommandList>
- </Command>
+ </InputCommandGroup>
+ </InputCommandList>
+ </InputCommand>
</PopoverContent>
</Popover>
{filter.type &&
diff --git a/web/src/features/filters/components/multi-select.tsx b/web/src/features/filters/components/multi-select.tsx
index 9b9b55e84a..62c5ea5daa 100644
--- a/web/src/features/filters/components/multi-select.tsx
+++ b/web/src/features/filters/components/multi-select.tsx
@@ -5,14 +5,14 @@ import { cn } from "@/src/utils/tailwind";
import { Badge } from "@/src/components/ui/badge";
import { Button } from "@/src/components/ui/button";
import {
- Command,
- CommandEmpty,
- CommandGroup,
- CommandInput,
- CommandItem,
- CommandList,
- CommandSeparator,
-} from "@/src/components/ui/command";
+ InputCommand,
+ InputCommandEmpty,
+ InputCommandGroup,
+ InputCommandInput,
+ InputCommandItem,
+ InputCommandList,
+ InputCommandSeparator,
+} from "@/src/components/ui/input-command";
import {
Popover,
PopoverContent,
@@ -137,18 +137,18 @@ export function MultiSelect({
</Button>
</PopoverTrigger>
<PopoverContent className="w-[200px] p-0" align="center">
- <Command>
- <CommandInput placeholder={title} />
- <CommandList>
+ <InputCommand>
+ <InputCommandInput placeholder={title} />
+ <InputCommandList>
{/* if isCustomSelectEnabled we always show custom select hence never empty */}
{!isCustomSelectEnabled && (
- <CommandEmpty>No results found.</CommandEmpty>
+ <InputCommandEmpty>No results found.</InputCommandEmpty>
)}
- <CommandGroup>
+ <InputCommandGroup>
{options.map((option) => {
const isSelected = selectedValues.has(option.value);
return (
- <CommandItem
+ <InputCommandItem
key={option.value}
onSelect={() => {
if (isSelected) {
@@ -178,14 +178,14 @@ export function MultiSelect({
{option.count}
</span>
) : null}
- </CommandItem>
+ </InputCommandItem>
);
})}
- </CommandGroup>
+ </InputCommandGroup>
{isCustomSelectEnabled && (
- <CommandGroup forceMount={true}>
- <CommandSeparator />
- <CommandItem
+ <InputCommandGroup forceMount={true}>
+ <InputCommandSeparator />
+ <InputCommandItem
key="freeTextField"
onSelect={() => {
const freeTextInput = getFreeTextInput(
@@ -238,24 +238,24 @@ export function MultiSelect({
placeholder="Enter custom value"
className="h-6 w-full rounded-none border-b-2 border-l-0 border-r-0 border-t-0 border-dotted p-0 text-sm"
/>
- </CommandItem>
- </CommandGroup>
+ </InputCommandItem>
+ </InputCommandGroup>
)}
{selectedValues.size > 0 && (
<>
- <CommandSeparator />
- <CommandGroup>
- <CommandItem
+ <InputCommandSeparator />
+ <InputCommandGroup>
+ <InputCommandItem
onSelect={() => onValueChange([])}
className="justify-center text-center"
>
Clear filters
- </CommandItem>
- </CommandGroup>
+ </InputCommandItem>
+ </InputCommandGroup>
</>
)}
- </CommandList>
- </Command>
+ </InputCommandList>
+ </InputCommand>
</PopoverContent>
</Popover>
);
diff --git a/web/src/features/navigate-detail-pages/DetailPageNav.tsx b/web/src/features/navigate-detail-pages/DetailPageNav.tsx
index 92ca49c73e..55076f3c06 100644
--- a/web/src/features/navigate-detail-pages/DetailPageNav.tsx
+++ b/web/src/features/navigate-detail-pages/DetailPageNav.tsx
@@ -1,5 +1,5 @@
import { Button } from "@/src/components/ui/button";
-import { CommandShortcut } from "@/src/components/ui/command";
+import { InputCommandShortcut } from "@/src/components/ui/input-command";
import {
Tooltip,
TooltipContent,
@@ -91,9 +91,9 @@ export const DetailPageNav = (props: {
</TooltipTrigger>
<TooltipContent>
<span>Navigate up</span>
- <CommandShortcut className="ml-2 rounded-sm bg-muted p-1 px-2">
+ <InputCommandShortcut className="ml-2 rounded-sm bg-muted p-1 px-2">
k
- </CommandShortcut>
+ </InputCommandShortcut>
</TooltipContent>
</Tooltip>
@@ -120,9 +120,9 @@ export const DetailPageNav = (props: {
</TooltipTrigger>
<TooltipContent>
<span>Navigate down</span>
- <CommandShortcut className="ml-2 rounded-sm bg-muted p-1 px-2">
+ <InputCommandShortcut className="ml-2 rounded-sm bg-muted p-1 px-2">
j
- </CommandShortcut>
+ </InputCommandShortcut>
</TooltipContent>
</Tooltip>
</div>
diff --git a/web/src/features/prompts/components/SetPromptVersionLabels/index.tsx b/web/src/features/prompts/components/SetPromptVersionLabels/index.tsx
index 0ce71a8200..78642e0118 100644
--- a/web/src/features/prompts/components/SetPromptVersionLabels/index.tsx
+++ b/web/src/features/prompts/components/SetPromptVersionLabels/index.tsx
@@ -4,11 +4,11 @@ import { PlusIcon, TagIcon } from "lucide-react";
import { Button } from "@/src/components/ui/button";
import {
- Command,
- CommandGroup,
- CommandList,
- CommandSeparator,
-} from "@/src/components/ui/command";
+ InputCommand,
+ InputCommandGroup,
+ InputCommandList,
+ InputCommandSeparator,
+} from "@/src/components/ui/input-command";
import {
Popover,
PopoverContent,
@@ -122,10 +122,10 @@ export function SetPromptVersionLabels({
<strong>production</strong> labeled prompt will be served by
default.
</h2>
- <Command className="mx-0 my-3 px-0">
- <CommandList className="max-h-full overflow-hidden">
- <CommandSeparator />
- <CommandGroup heading="Promote to production?">
+ <InputCommand className="mx-0 my-3 px-0">
+ <InputCommandList className="max-h-full overflow-hidden">
+ <InputCommandSeparator />
+ <InputCommandGroup heading="Promote to production?">
<LabelCommandItem
{...{
selectedLabels,
@@ -133,9 +133,9 @@ export function SetPromptVersionLabels({
label: PRODUCTION_LABEL,
}}
/>
- </CommandGroup>
- <CommandSeparator />
- <CommandGroup heading="Custom labels">
+ </InputCommandGroup>
+ <InputCommandSeparator />
+ <InputCommandGroup heading="Custom labels">
<div
className="max-h-[300px] overflow-y-auto overflow-x-hidden"
ref={customLabelScrollRef}
@@ -149,8 +149,8 @@ export function SetPromptVersionLabels({
/>
))}
</div>
- </CommandGroup>
- </CommandList>
+ </InputCommandGroup>
+ </InputCommandList>
<div className="px-1">
{isAddingLabel ? (
<AddLabelForm
@@ -180,7 +180,7 @@ export function SetPromptVersionLabels({
</Button>
)}
</div>
- </Command>
+ </InputCommand>
<Button
type="button"
variant={
diff --git a/web/src/features/prompts/components/auto-complete.tsx b/web/src/features/prompts/components/auto-complete.tsx
index 4121a73985..83e4252305 100644
--- a/web/src/features/prompts/components/auto-complete.tsx
+++ b/web/src/features/prompts/components/auto-complete.tsx
@@ -1,11 +1,11 @@
"use client";
import {
- CommandGroup,
- CommandItem,
- CommandList,
- CommandInput,
-} from "@/src/components/ui/command";
+ InputCommandGroup,
+ InputCommandItem,
+ InputCommandList,
+ InputCommandInput,
+} from "@/src/components/ui/input-command";
import { Command as CommandPrimitive } from "cmdk";
import { useState, useRef, useCallback, type KeyboardEvent } from "react";
@@ -93,7 +93,7 @@ export const AutoComplete = ({
return (
<CommandPrimitive onKeyDown={handleKeyDown}>
<div>
- <CommandInput
+ <InputCommandInput
ref={inputRef}
value={inputValue}
onValueChange={setInputValue}
@@ -106,13 +106,13 @@ export const AutoComplete = ({
<div className="relative mt-1">
{isOpen ? (
<div className="absolute top-0 z-10 w-full rounded-xl bg-background outline-none animate-in fade-in-0 zoom-in-95">
- <CommandList className="rounded-lg ring-1 ring-border">
+ <InputCommandList className="rounded-lg ring-1 ring-border">
{options.length > 0 ? (
- <CommandGroup>
+ <InputCommandGroup>
{options.map((option) => {
const isSelected = selected.value === option.value;
return (
- <CommandItem
+ <InputCommandItem
key={option.value}
value={option.label}
onMouseDown={(event) => {
@@ -127,12 +127,12 @@ export const AutoComplete = ({
>
{isSelected ? <Check className="w-4" /> : null}
{option.label}
- </CommandItem>
+ </InputCommandItem>
);
})}
- </CommandGroup>
+ </InputCommandGroup>
) : null}
- <CommandItemCreate
+ <InputCommandItemCreate
onMouseDown={(event) => {
event.preventDefault();
event.stopPropagation();
@@ -143,17 +143,17 @@ export const AutoComplete = ({
createLabel={createLabel}
{...{ inputValue, options }}
/>
- </CommandList>
+ </InputCommandList>
</div>
) : (
- <CommandList /> // CommandPrimitive expects a CommandList child, fix to prevent errors introduced in cmdk v1.0.0
+ <InputCommandList /> // CommandPrimitive expects a InputCommandList child, fix to prevent errors introduced in cmdk v1.0.0
)}
</div>
</CommandPrimitive>
);
};
-const CommandItemCreate = ({
+const InputCommandItemCreate = ({
inputValue,
options,
createLabel,
@@ -175,7 +175,7 @@ const CommandItemCreate = ({
if (!render) return null;
return (
- <CommandItem
+ <InputCommandItem
key={inputValue}
value={inputValue}
className="text-muted-foreground"
@@ -184,6 +184,6 @@ const CommandItemCreate = ({
>
<div className={cn("m-2 h-4 w-4")} />
{createLabel}: &quot;{inputValue}&quot;
- </CommandItem>
+ </InputCommandItem>
);
};
diff --git a/web/src/features/tag/components/TagCommandItem.tsx b/web/src/features/tag/components/TagCommandItem.tsx
index b90bd18e9a..075ea4aa49 100644
--- a/web/src/features/tag/components/TagCommandItem.tsx
+++ b/web/src/features/tag/components/TagCommandItem.tsx
@@ -1,4 +1,4 @@
-import { CommandItem } from "@/src/components/ui/command";
+import { InputCommandItem } from "@/src/components/ui/input-command";
import { cn } from "@/src/utils/tailwind";
import { Check } from "lucide-react";
import { Button } from "@/src/components/ui/button";
@@ -17,7 +17,7 @@ const TagCommandItem = ({
}: TagCommandItemProps) => {
const capture = usePostHogClientCapture();
return (
- <CommandItem
+ <InputCommandItem
key={value}
onSelect={() => {
setSelectedTags([...selectedTags, value]);
@@ -36,7 +36,7 @@ const TagCommandItem = ({
<Button variant="secondary" size="xs">
{value}
</Button>
- </CommandItem>
+ </InputCommandItem>
);
};