Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

chore(assistant-ui): update component files and demo pages

Steven Enamakeldf2feddeb157
diff --git a/app/src/components/assistant-ui/attachment.tsx b/app/src/components/assistant-ui/attachment.tsx
index 305b5c5043..a422132ff3 100644
--- a/app/src/components/assistant-ui/attachment.tsx
+++ b/app/src/components/assistant-ui/attachment.tsx
@@ -1,42 +1,30 @@
-"use client";
+'use client';
+import { cn } from '@/components/assistant-ui/lib/utils';
+import { TooltipIconButton } from '@/components/assistant-ui/tooltip-icon-button';
+import { Avatar, AvatarFallback, AvatarImage } from '@/components/assistant-ui/ui/avatar';
import {
- type PropsWithChildren,
- useEffect,
- useState,
- type FC,
- isValidElement,
-} from "react";
-import {
- XIcon,
- PlusIcon,
- FileText,
- Loader2Icon,
- AlertCircleIcon,
-} from "lucide-react";
-import {
- AttachmentPrimitive,
- ComposerPrimitive,
- MessagePrimitive,
- useAuiState,
- useAui,
-} from "@assistant-ui/react";
-import { useShallow } from "zustand/react/shallow";
+ Dialog,
+ DialogContent,
+ DialogTitle,
+ DialogTrigger,
+} from '@/components/assistant-ui/ui/dialog';
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
-} from "@/components/assistant-ui/ui/tooltip";
+} from '@/components/assistant-ui/ui/tooltip';
import {
- Dialog,
- DialogTitle,
- DialogContent,
- DialogTrigger,
-} from "@/components/assistant-ui/ui/dialog";
-import { Avatar, AvatarImage, AvatarFallback } from "@/components/assistant-ui/ui/avatar";
-import { TooltipIconButton } from "@/components/assistant-ui/tooltip-icon-button";
-import { cn } from "@/components/assistant-ui/lib/utils";
+ AttachmentPrimitive,
+ ComposerPrimitive,
+ MessagePrimitive,
+ useAui,
+ useAuiState,
+} from '@assistant-ui/react';
+import { AlertCircleIcon, FileText, Loader2Icon, PlusIcon, XIcon } from 'lucide-react';
+import { type FC, isValidElement, type PropsWithChildren, useEffect, useState } from 'react';
+import { useShallow } from 'zustand/react/shallow';
const useFileSrc = (file: File | undefined) => {
const [src, setSrc] = useState<string | undefined>(undefined);
@@ -61,21 +49,18 @@ const useFileSrc = (file: File | undefined) => {
const useAttachmentSrc = () => {
const { file, src } = useAuiState(
useShallow((s): { file?: File; src?: string } => {
- if (s.attachment.type !== "image") return {};
+ if (s.attachment.type !== 'image') return {};
if (s.attachment.file) return { file: s.attachment.file };
- const src = s.attachment.content?.filter((c) => c.type === "image")[0]
- ?.image;
+ const src = s.attachment.content?.filter(c => c.type === 'image')[0]?.image;
if (!src) return {};
return { src };
- }),
+ })
);
return useFileSrc(file) ?? src;
};
-type AttachmentPreviewProps = {
- src: string;
-};
+type AttachmentPreviewProps = { src: string };
const AttachmentPreview: FC<AttachmentPreviewProps> = ({ src }) => {
const [isLoaded, setIsLoaded] = useState(false);
@@ -84,10 +69,10 @@ const AttachmentPreview: FC<AttachmentPreviewProps> = ({ src }) => {
src={src}
alt="Attachment preview"
className={cn(
- "block h-auto max-h-[80vh] w-auto max-w-full rounded-sm object-contain transition-opacity duration-300 motion-reduce:transition-none",
+ 'block h-auto max-h-[80vh] w-auto max-w-full rounded-sm object-contain transition-opacity duration-300 motion-reduce:transition-none',
isLoaded
- ? "aui-attachment-preview-image-loaded opacity-100"
- : "aui-attachment-preview-image-loading opacity-0",
+ ? 'aui-attachment-preview-image-loaded opacity-100'
+ : 'aui-attachment-preview-image-loading opacity-0'
)}
onLoad={() => setIsLoaded(true)}
/>
@@ -107,9 +92,7 @@ const AttachmentPreviewDialog: FC<PropsWithChildren> = ({ children }) => {
render={isValidElement(children) ? children : <button type="button" />}
/>
<DialogContent className="aui-attachment-preview-dialog-content [&>button]:bg-foreground/60 [&>button]:hover:bg-foreground/80 [&_svg]:text-background p-2 sm:max-w-3xl [&>button]:rounded-full [&>button]:p-1 [&>button]:opacity-100 [&>button]:ring-0!">
- <DialogTitle className="aui-sr-only sr-only">
- Image Attachment Preview
- </DialogTitle>
+ <DialogTitle className="aui-sr-only sr-only">Image Attachment Preview</DialogTitle>
<div className="aui-attachment-preview bg-background relative mx-auto flex max-h-[80dvh] w-full items-center justify-center overflow-hidden rounded-sm">
<AttachmentPreview src={src} />
</div>
@@ -137,39 +120,37 @@ const AttachmentThumb: FC = () => {
const AttachmentUI: FC = () => {
const aui = useAui();
- const isComposer = aui.attachment.source !== "message";
+ const isComposer = aui.attachment.source !== 'message';
- const isImage = useAuiState((s) => s.attachment.type === "image");
- const typeLabel = useAuiState((s) => {
+ const isImage = useAuiState(s => s.attachment.type === 'image');
+ const typeLabel = useAuiState(s => {
const type = s.attachment.type;
switch (type) {
- case "image":
- return "Image";
- case "document":
- return "Document";
- case "file":
- return "File";
+ case 'image':
+ return 'Image';
+ case 'document':
+ return 'Document';
+ case 'file':
+ return 'File';
default:
return type;
}
});
- const uploadState = useAuiState((s) =>
- s.attachment.status.type === "running"
- ? "uploading"
- : s.attachment.status.type === "incomplete" &&
- s.attachment.status.reason === "error"
- ? "error"
- : undefined,
+ const uploadState = useAuiState(s =>
+ s.attachment.status.type === 'running'
+ ? 'uploading'
+ : s.attachment.status.type === 'incomplete' && s.attachment.status.reason === 'error'
+ ? 'error'
+ : undefined
);
- const isUploading = uploadState === "uploading";
- const isError = uploadState === "error";
+ const isUploading = uploadState === 'uploading';
+ const isError = uploadState === 'error';
- const errorMessage = useAuiState((s) =>
- s.attachment.status.type === "incomplete" &&
- s.attachment.status.reason === "error"
- ? (s.attachment.status.message ?? "Upload failed")
- : undefined,
+ const errorMessage = useAuiState(s =>
+ s.attachment.status.type === 'incomplete' && s.attachment.status.reason === 'error'
+ ? (s.attachment.status.message ?? 'Upload failed')
+ : undefined
);
return (
@@ -177,49 +158,37 @@ const AttachmentUI: FC = () => {
<Tooltip>
<AttachmentPrimitive.Root
className={cn(
- "aui-attachment-root relative",
- isComposer &&
- "animate-in fade-in-0 zoom-in-95 duration-200 motion-reduce:animate-none",
- isImage &&
- !isComposer &&
- "aui-attachment-root-message only:*:first:size-24",
- )}
- >
+ 'aui-attachment-root relative',
+ isComposer && 'animate-in fade-in-0 zoom-in-95 duration-200 motion-reduce:animate-none',
+ isImage && !isComposer && 'aui-attachment-root-message only:*:first:size-24'
+ )}>
<AttachmentPreviewDialog>
<TooltipTrigger
render={
<div
className={cn(
- "aui-attachment-tile bg-muted hover:after:bg-foreground/10 focus-visible:ring-ring/50 relative size-14 cursor-pointer overflow-hidden rounded-[calc(var(--composer-radius,1.5rem)-var(--composer-padding,8px))] transition-transform outline-none after:pointer-events-none after:absolute after:inset-0 after:rounded-[inherit] after:ring-1 after:ring-black/10 after:transition-colors after:ring-inset focus-visible:ring-1 active:scale-[0.96] motion-reduce:transition-none dark:after:ring-white/10",
- isError &&
- "after:ring-destructive/60 dark:after:ring-destructive/60",
+ 'aui-attachment-tile bg-muted hover:after:bg-foreground/10 focus-visible:ring-ring/50 relative size-14 cursor-pointer overflow-hidden rounded-[calc(var(--composer-radius,1.5rem)-var(--composer-padding,8px))] transition-transform outline-none after:pointer-events-none after:absolute after:inset-0 after:rounded-[inherit] after:ring-1 after:ring-black/10 after:transition-colors after:ring-inset focus-visible:ring-1 active:scale-[0.96] motion-reduce:transition-none dark:after:ring-white/10',
+ isError && 'after:ring-destructive/60 dark:after:ring-destructive/60'
)}
role="button"
tabIndex={0}
aria-label={`${typeLabel} attachment${
- isError
- ? ", upload failed"
- : isUploading
- ? ", uploading"
- : ""
+ isError ? ', upload failed' : isUploading ? ', uploading' : ''
}`}
/>
- }
- >
+ }>
<AttachmentThumb />
{isUploading && (
<div
aria-hidden="true"
- className="aui-attachment-tile-uploading bg-background/60 animate-in fade-in-0 absolute inset-0 flex items-center justify-center backdrop-blur-[2px] motion-reduce:animate-none"
- >
+ className="aui-attachment-tile-uploading bg-background/60 animate-in fade-in-0 absolute inset-0 flex items-center justify-center backdrop-blur-[2px] motion-reduce:animate-none">
<Loader2Icon className="text-muted-foreground size-4 animate-spin" />
</div>
)}
{isError && (
<div
aria-hidden="true"
- className="aui-attachment-tile-error bg-background/70 animate-in fade-in-0 absolute inset-0 flex items-center justify-center backdrop-blur-[2px] motion-reduce:animate-none"
- >
+ className="aui-attachment-tile-error bg-background/70 animate-in fade-in-0 absolute inset-0 flex items-center justify-center backdrop-blur-[2px] motion-reduce:animate-none">
<AlertCircleIcon className="text-destructive size-4" />
</div>
)}
@@ -229,9 +198,7 @@ const AttachmentUI: FC = () => {
</AttachmentPrimitive.Root>
<TooltipContent side="top">
<AttachmentPrimitive.Name />
- {errorMessage && (
- <p className="aui-attachment-error-message">{errorMessage}</p>
- )}
+ {errorMessage && <p className="aui-attachment-error-message">{errorMessage}</p>}
</TooltipContent>
</Tooltip>
</TooltipProvider>
@@ -247,8 +214,7 @@ const AttachmentRemove: FC = () => {
className="aui-attachment-tile-remove absolute end-1 top-1 size-5 rounded-full bg-black/50! text-white after:absolute after:-inset-1.5 hover:bg-black/70! hover:text-white! active:scale-[0.96] motion-reduce:transition-none"
side="top"
/>
- }
- >
+ }>
<XIcon className="aui-attachment-remove-icon size-3 stroke-[2.5]" />
</AttachmentPrimitive.Remove>
);
@@ -257,9 +223,7 @@ const AttachmentRemove: FC = () => {
export const UserMessageAttachments: FC = () => {
return (
<div className="aui-user-message-attachments-end col-span-full col-start-1 row-start-1 flex w-full flex-row justify-end gap-2">
- <MessagePrimitive.Attachments>
- {() => <AttachmentUI />}
- </MessagePrimitive.Attachments>
+ <MessagePrimitive.Attachments>{() => <AttachmentUI />}</MessagePrimitive.Attachments>
</div>
);
};
@@ -267,9 +231,7 @@ export const UserMessageAttachments: FC = () => {
export const ComposerAttachments: FC = () => {
return (
<div className="aui-composer-attachments flex w-full flex-row items-center gap-2 overflow-x-auto empty:hidden">
- <ComposerPrimitive.Attachments>
- {() => <AttachmentUI />}
- </ComposerPrimitive.Attachments>
+ <ComposerPrimitive.Attachments>{() => <AttachmentUI />}</ComposerPrimitive.Attachments>
</div>
);
};
@@ -286,8 +248,7 @@ export const ComposerAddAttachment: FC = () => {
className="aui-composer-add-attachment text-muted-foreground hover:text-foreground hover:bg-muted-foreground/15 dark:border-muted-foreground/15 dark:hover:bg-muted-foreground/30 size-7 rounded-full active:scale-[0.96] motion-reduce:transition-none"
aria-label="Add Attachment"
/>
- }
- >
+ }>
<PlusIcon className="aui-attachment-add-icon size-4" />
</ComposerPrimitive.AddAttachment>
);
diff --git a/app/src/components/assistant-ui/badge.tsx b/app/src/components/assistant-ui/badge.tsx
index 7e9a5ae529..fffb2ad25d 100644
--- a/app/src/components/assistant-ui/badge.tsx
+++ b/app/src/components/assistant-ui/badge.tsx
@@ -1,63 +1,51 @@
-"use client";
+'use client';
-import type { ComponentProps } from "react";
-import { mergeProps } from "@base-ui/react/merge-props";
-import { useRender } from "@base-ui/react/use-render";
-import { cva, type VariantProps } from "class-variance-authority";
-import { cn } from "@/components/assistant-ui/lib/utils";
+import { cn } from '@/components/assistant-ui/lib/utils';
+import { mergeProps } from '@base-ui/react/merge-props';
+import { useRender } from '@base-ui/react/use-render';
+import { cva, type VariantProps } from 'class-variance-authority';
+import type { ComponentProps } from 'react';
const badgeVariants = cva(
- "inline-flex items-center justify-center gap-1 rounded-md text-xs font-medium transition-colors [&_svg]:size-3 [&_svg]:shrink-0",
+ 'inline-flex items-center justify-center gap-1 rounded-md text-xs font-medium transition-colors [&_svg]:size-3 [&_svg]:shrink-0',
{
variants: {
variant: {
outline:
- "border-input text-muted-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground border bg-transparent",
- secondary:
- "bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/80",
- muted:
- "bg-muted text-muted-foreground [a&]:hover:bg-muted/80 [a&]:hover:text-foreground",
+ 'border-input text-muted-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground border bg-transparent',
+ secondary: 'bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/80',
+ muted: 'bg-muted text-muted-foreground [a&]:hover:bg-muted/80 [a&]:hover:text-foreground',
ghost:
- "text-muted-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground bg-transparent",
- info: "bg-blue-100 text-blue-700 dark:bg-blue-900/50 dark:text-blue-300 [a&]:hover:bg-blue-100/80",
+ 'text-muted-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground bg-transparent',
+ info: 'bg-blue-100 text-blue-700 dark:bg-blue-900/50 dark:text-blue-300 [a&]:hover:bg-blue-100/80',
warning:
- "bg-amber-100 text-amber-700 dark:bg-amber-900/50 dark:text-amber-300 [a&]:hover:bg-amber-100/80",
+ 'bg-amber-100 text-amber-700 dark:bg-amber-900/50 dark:text-amber-300 [a&]:hover:bg-amber-100/80',
success:
- "bg-emerald-100 text-emerald-700 dark:bg-emerald-900/50 dark:text-emerald-300 [a&]:hover:bg-emerald-100/80",
+ 'bg-emerald-100 text-emerald-700 dark:bg-emerald-900/50 dark:text-emerald-300 [a&]:hover:bg-emerald-100/80',
destructive:
- "bg-red-100 text-red-700 dark:bg-red-900/50 dark:text-red-300 [a&]:hover:bg-red-100/80",
+ 'bg-red-100 text-red-700 dark:bg-red-900/50 dark:text-red-300 [a&]:hover:bg-red-100/80',
},
- size: {
- sm: "px-1.5 py-0.5",
- default: "px-2 py-1",
- lg: "px-2.5 py-1.5 text-sm",
- },
- },
- defaultVariants: {
- variant: "outline",
- size: "default",
+ size: { sm: 'px-1.5 py-0.5', default: 'px-2 py-1', lg: 'px-2.5 py-1.5 text-sm' },
},
- },
+ defaultVariants: { variant: 'outline', size: 'default' },
+ }
);
-export type BadgeProps = useRender.ComponentProps<"span"> &
- VariantProps<typeof badgeVariants>;
+export type BadgeProps = useRender.ComponentProps<'span'> & VariantProps<typeof badgeVariants>;
function Badge({ className, variant, size, render, ...props }: BadgeProps) {
const dataProps = {
- "data-slot": "badge",
- "data-variant": variant,
- "data-size": size,
- } as ComponentProps<"span">;
+ 'data-slot': 'badge',
+ 'data-variant': variant,
+ 'data-size': size,
+ } as ComponentProps<'span'>;
return useRender({
- defaultTagName: "span",
- props: mergeProps<"span">(
+ defaultTagName: 'span',
+ props: mergeProps<'span'>(
dataProps,
- {
- className: cn(badgeVariants({ variant, size }), className),
- },
- props,
+ { className: cn(badgeVariants({ variant, size }), className) },
+ props
),
render,
});
diff --git a/app/src/components/assistant-ui/composer-trigger-popover.tsx b/app/src/components/assistant-ui/composer-trigger-popover.tsx
index 8dfa921015..882678a912 100644
--- a/app/src/components/assistant-ui/composer-trigger-popover.tsx
+++ b/app/src/components/assistant-ui/composer-trigger-popover.tsx
@@ -1,15 +1,15 @@
-"use client";
+'use client';
-import { memo, useRef, type ComponentPropsWithoutRef, type FC } from "react";
+import { cn } from '@/components/assistant-ui/lib/utils';
import {
ComposerPrimitive,
unstable_defaultDirectiveFormatter,
- unstable_useTriggerPopoverScopeContext,
type Unstable_DirectiveFormatter,
type Unstable_TriggerItem,
-} from "@assistant-ui/react";
-import { ChevronLeftIcon, ChevronRightIcon, SparklesIcon } from "lucide-react";
-import { cn } from "@/components/assistant-ui/lib/utils";
+ unstable_useTriggerPopoverScopeContext,
+} from '@assistant-ui/react';
+import { ChevronLeftIcon, ChevronRightIcon, SparklesIcon } from 'lucide-react';
+import { type ComponentPropsWithoutRef, type FC, memo, useRef } from 'react';
type IconComponent = FC<{ className?: string }>;
@@ -31,7 +31,7 @@ type ActionBehaviorProps = {
type ComposerTriggerPopoverBaseProps = Omit<
ComponentPropsWithoutRef<typeof ComposerPrimitive.Unstable_TriggerPopover>,
- "children"
+ 'children'
> & {
/**
* Maps icon keys to components. Items look up via `item.metadata?.icon`
@@ -67,7 +67,7 @@ type ComposerTriggerPopoverProps = ComposerTriggerPopoverBaseProps &
function resolveIcon(
iconKey: string | undefined,
iconMap: Record<string, IconComponent> | undefined,
- fallback: IconComponent,
+ fallback: IconComponent
): IconComponent {
if (iconKey && iconMap?.[iconKey]) return iconMap[iconKey]!;
return fallback;
@@ -79,25 +79,17 @@ type CategoriesProps = {
emptyLabel: string;
};
-const Categories: FC<CategoriesProps> = ({
- iconMap,
- fallbackIcon,
- emptyLabel,
-}) => (
+const Categories: FC<CategoriesProps> = ({ iconMap, fallbackIcon, emptyLabel }) => (
<ComposerPrimitive.Unstable_TriggerPopoverCategories>
- {(categories) => (
- <div
- data-slot="composer-trigger-popover-categories"
- className="flex flex-col py-1"
- >
- {categories.map((cat) => {
+ {categories => (
+ <div data-slot="composer-trigger-popover-categories" className="flex flex-col py-1">
+ {categories.map(cat => {
const Icon = resolveIcon(cat.id, iconMap, fallbackIcon);
return (
<ComposerPrimitive.Unstable_TriggerPopoverCategoryItem
key={cat.id}
categoryId={cat.id}
- className="hover:bg-accent focus:bg-accent data-[highlighted]:bg-accent flex cursor-pointer items-center justify-between gap-2 px-3 py-2 text-sm transition-colors outline-none"
- >
+ className="hover:bg-accent focus:bg-accent data-[highlighted]:bg-accent flex cursor-pointer items-center justify-between gap-2 px-3 py-2 text-sm transition-colors outline-none">
<span className="flex items-center gap-2">
<Icon className="text-muted-foreground size-4" />
{cat.label}
@@ -107,9 +99,7 @@ const Categories: FC<CategoriesProps> = ({
);
})}
{categories.length === 0 && (
- <div className="text-muted-foreground px-3 py-2 text-sm">
- {emptyLabel}
- </div>
+ <div className="text-muted-foreground px-3 py-2 text-sm">{emptyLabel}</div>
)}
</div>
)}
@@ -124,21 +114,12 @@ type ItemsProps = {
loadingLabel: string;
};
-const Items: FC<ItemsProps> = ({
- iconMap,
- fallbackIcon,
- backLabel,
- emptyLabel,
- loadingLabel,
-}) => {
+const Items: FC<ItemsProps> = ({ iconMap, fallbackIcon, backLabel, emptyLabel, loadingLabel }) => {
const { isLoading } = unstable_useTriggerPopoverScopeContext();
return (
<ComposerPrimitive.Unstable_TriggerPopoverItems>
- {(items) => (
- <div
- data-slot="composer-trigger-popover-items"
- className="flex flex-col"
- >
+ {items => (
+ <div data-slot="composer-trigger-popover-items" className="flex flex-col">
<ComposerPrimitive.Unstable_TriggerPopoverBack className="text-muted-foreground hover:bg-accent flex cursor-pointer items-center gap-1.5 border-b px-3 py-2 text-xs tracking-wide uppercase transition-colors">
<ChevronLeftIcon className="size-3.5" />
{backLabel}
@@ -147,17 +128,14 @@ const Items: FC<ItemsProps> = ({
<div className="py-1">
{items.map((item, index) => {
const iconKey =
- typeof item.metadata?.icon === "string"
- ? item.metadata.icon
- : undefined;
+ typeof item.metadata?.icon === 'string' ? item.metadata.icon : undefined;
const Icon = resolveIcon(iconKey, iconMap, fallbackIcon);
return (
<ComposerPrimitive.Unstable_TriggerPopoverItem
key={item.id}
item={item}
index={index}
- className="hover:bg-accent focus:bg-accent data-[highlighted]:bg-accent flex w-full cursor-pointer flex-col items-start gap-0.5 px-3 py-2 text-start transition-colors outline-none"
- >
+ className="hover:bg-accent focus:bg-accent data-[highlighted]:bg-accent flex w-full cursor-pointer flex-col items-start gap-0.5 px-3 py-2 text-start transition-colors outline-none">
<span className="flex items-center gap-2 text-sm font-medium">
<Icon className="text-primary size-3.5" />
{item.label}
@@ -189,10 +167,10 @@ const Items: FC<ItemsProps> = ({
const ComposerTriggerPopoverImpl: FC<ComposerTriggerPopoverProps> = ({
iconMap,
fallbackIcon = SparklesIcon,
- backLabel = "Back",
- emptyCategoriesLabel = "No items available",
- emptyItemsLabel = "No matching items",
- loadingLabel = "Loading…",
+ backLabel = 'Back',
+ emptyCategoriesLabel = 'No items available',
+ emptyItemsLabel = 'No matching items',
+ loadingLabel = 'Loading…',
className,
directive,
action,
@@ -200,13 +178,13 @@ const ComposerTriggerPopoverImpl: FC<ComposerTriggerPopoverProps> = ({
}) => {
const warnedRef = useRef(false);
if (
- process.env.NODE_ENV !== "production" &&
+ process.env.NODE_ENV !== 'production' &&
!warnedRef.current &&
Boolean(directive) === Boolean(action)
) {
warnedRef.current = true;
console.warn(
- "[assistant-ui] ComposerTriggerPopover requires exactly one of `directive` or `action` props.",
+ '[assistant-ui] ComposerTriggerPopover requires exactly one of `directive` or `action` props.'
);
}
@@ -214,11 +192,10 @@ const ComposerTriggerPopoverImpl: FC<ComposerTriggerPopoverProps> = ({
<ComposerPrimitive.Unstable_TriggerPopover
data-slot="composer-trigger-popover"
className={cn(
- "aui-composer-trigger-popover bg-popover text-popover-foreground absolute start-0 bottom-full z-50 mb-2 w-64 overflow-hidden rounded-xl border",
- className,
+ 'aui-composer-trigger-popover bg-popover text-popover-foreground absolute start-0 bottom-full z-50 mb-2 w-64 overflow-hidden rounded-xl border',
+ className
)}
- {...props}
- >
+ {...props}>
{directive ? (
<ComposerPrimitive.Unstable_TriggerPopover.Directive
formatter={directive.formatter ?? unstable_defaultDirectiveFormatter}
@@ -231,11 +208,7 @@ const ComposerTriggerPopoverImpl: FC<ComposerTriggerPopoverProps> = ({
removeOnExecute={action.removeOnExecute}
/>
) : null}
- <Categories
- iconMap={iconMap}
- fallbackIcon={fallbackIcon}
- emptyLabel={emptyCategoriesLabel}
- />
+ <Categories iconMap={iconMap} fallbackIcon={fallbackIcon} emptyLabel={emptyCategoriesLabel} />
<Items
iconMap={iconMap}
fallbackIcon={fallbackIcon}
@@ -246,8 +219,8 @@ const ComposerTriggerPopoverImpl: FC<ComposerTriggerPopoverProps> = ({
</ComposerPrimitive.Unstable_TriggerPopover>
);
};
-ComposerTriggerPopoverImpl.displayName = "ComposerTriggerPopover";
+ComposerTriggerPopoverImpl.displayName = 'ComposerTriggerPopover';
export const ComposerTriggerPopover = memo(
- ComposerTriggerPopoverImpl,
+ ComposerTriggerPopoverImpl
) as FC<ComposerTriggerPopoverProps>;
diff --git a/app/src/components/assistant-ui/directive-text.tsx b/app/src/components/assistant-ui/directive-text.tsx
index 59f978fad7..b8cef35bd7 100644
--- a/app/src/components/assistant-ui/directive-text.tsx
+++ b/app/src/components/assistant-ui/directive-text.tsx
@@ -1,12 +1,13 @@
-"use client";
+'use client';
-import { memo, type FC } from "react";
import {
type TextMessagePartComponent,
- type Unstable_DirectiveFormatter,
unstable_defaultDirectiveFormatter,
-} from "@assistant-ui/react";
-import { Badge } from "./badge";
+ type Unstable_DirectiveFormatter,
+} from '@assistant-ui/react';
+import { type FC, memo } from 'react';
+
+import { Badge } from './badge';
type IconComponent = FC<{ className?: string }>;
@@ -20,7 +21,7 @@ export type CreateDirectiveTextOptions = {
/** Creates a `Text` message part component that parses directive syntax and renders inline chips. */
export function createDirectiveText(
formatter: Unstable_DirectiveFormatter,
- options?: CreateDirectiveTextOptions,
+ options?: CreateDirectiveTextOptions
): TextMessagePartComponent {
const iconMap = options?.iconMap;
const fallbackIcon = options?.fallbackIcon;
@@ -28,14 +29,14 @@ export function createDirectiveText(
const Component: TextMessagePartComponent = ({ text }) => {
const segments = formatter.parse(text);
- if (segments.length === 1 && segments[0]!.kind === "text") {
+ if (segments.length === 1 && segments[0]!.kind === 'text') {
return <>{text}</>;
}
return (
<>
{segments.map((seg, i) => {
- if (seg.kind === "text") {
+ if (seg.kind === 'text') {
return (
<span key={i} className="whitespace-pre-wrap">
{seg.text}
@@ -53,8 +54,7 @@ export function createDirectiveText(
data-directive-type={seg.type}
data-directive-id={seg.id}
aria-label={`${seg.type}: ${seg.label}`}
- className="aui-directive-chip items-baseline text-[13px] leading-none [&_svg]:self-center"
- >
+ className="aui-directive-chip items-baseline text-[13px] leading-none [&_svg]:self-center">
{Icon && <Icon />}
{seg.label}
</Badge>
@@ -63,13 +63,11 @@ export function createDirectiveText(
</>
);
};
- Component.displayName = "DirectiveText";
+ Component.displayName = 'DirectiveText';
return Component;
}
-const DirectiveTextImpl = createDirectiveText(
- unstable_defaultDirectiveFormatter,
-);
+const DirectiveTextImpl = createDirectiveText(unstable_defaultDirectiveFormatter);
/** `Text` message part component that renders directive syntax as inline chips. */
export const DirectiveText: TextMessagePartComponent = memo(DirectiveTextImpl);
diff --git a/app/src/components/assistant-ui/dot-matrix.tsx b/app/src/components/assistant-ui/dot-matrix.tsx
index 5885b965b6..934d37f9c6 100644
--- a/app/src/components/assistant-ui/dot-matrix.tsx
+++ b/app/src/components/assistant-ui/dot-matrix.tsx
@@ -1,5 +1,5 @@
-import type { ComponentProps, CSSProperties } from "react";
-import { cn } from "@/components/assistant-ui/lib/utils";
+import { cn } from '@/components/assistant-ui/lib/utils';
+import type { ComponentProps, CSSProperties } from 'react';
const GRID = 5;
const CENTER = (GRID - 1) / 2;
@@ -12,8 +12,7 @@ const hash = (n: number, salt: number, range: number) => {
return ((h ^ (h >>> 16)) % range) / 1000;
};
-const glyph = (dots: [number, number][]) =>
- new Set(dots.map(([row, col]) => row * GRID + col));
+const glyph = (dots: [number, number][]) => new Set(dots.map(([row, col]) => row * GRID + col));
const CHECK = glyph([
[1, 4],
@@ -93,21 +92,11 @@ type StateConfig = {
};
const STATES = {
- idle: { color: "text-muted-foreground", base: 0.3 },
+ idle: { color: 'text-muted-foreground', base: 0.3 },
loading: {
- blink: (i) => ({
- duration: 0.9 + hash(i, 2, 700),
- delay: -hash(i, 1, 1200),
- lo: 0.15,
- }),
- },
- thinking: {
- blink: (_i, row, col) => ({
- duration: 1.2,
- delay: -(row + col) * 0.09,
- lo: 0.2,
- }),
+ blink: i => ({ duration: 0.9 + hash(i, 2, 700), delay: -hash(i, 1, 1200), lo: 0.15 }),
},
+ thinking: { blink: (_i, row, col) => ({ duration: 1.2, delay: -(row + col) * 0.09, lo: 0.2 }) },
streaming: {
blink: (_i, row, col) => ({
duration: 0.9,
@@ -115,13 +104,10 @@ const STATES = {
lo: 0.15,
}),
},
- searching: {
- blink: (_i, _row, col) => ({ duration: 1.1, delay: -col * 0.12, lo: 0.2 }),
- },
+ searching: { blink: (_i, _row, col) => ({ duration: 1.1, delay: -col * 0.12, lo: 0.2 }) },
syncing: {
blink: (_i, row, col) => {
- const turn =
- (Math.atan2(row - CENTER, col - CENTER) + Math.PI) / (2 * Math.PI);
+ const turn = (Math.atan2(row - CENTER, col - CENTER) + Math.PI) / (2 * Math.PI);
return { duration: 1.3, delay: -turn * 1.3, lo: 0.2 };
},
},
@@ -134,22 +120,10 @@ const STATES = {
},
waiting: {
glyph: ELLIPSIS,
- blink: (_i, _row, col) => ({
- duration: 1.2,
- delay: -col * 0.09,
- lo: 0.2,
- }),
- },
- uploading: {
- blink: (_i, row) => ({
- duration: 1,
- delay: -(GRID - 1 - row) * 0.12,
- lo: 0.2,
- }),
- },
- downloading: {
- blink: (_i, row) => ({ duration: 1, delay: -row * 0.12, lo: 0.2 }),
+ blink: (_i, _row, col) => ({ duration: 1.2, delay: -col * 0.09, lo: 0.2 }),
},
+ uploading: { blink: (_i, row) => ({ duration: 1, delay: -(GRID - 1 - row) * 0.12, lo: 0.2 }) },
+ downloading: { blink: (_i, row) => ({ duration: 1, delay: -row * 0.12, lo: 0.2 }) },
listening: {
blink: (_i, _row, col) => ({
duration: 0.7 + hash(col, 4, 500),
@@ -165,33 +139,33 @@ const STATES = {
}),
},
recording: {
- color: "text-red-500",
+ color: 'text-red-500',
glyph: RECORD,
dim: 0.12,
blink: () => ({ duration: 1.4, delay: 0, lo: 0.3 }),
},
- success: { color: "text-emerald-500", glyph: CHECK },
+ success: { color: 'text-emerald-500', glyph: CHECK },
error: {
- color: "text-red-500",
+ color: 'text-red-500',
glyph: CROSS,
blink: () => ({ duration: 1.1, delay: 0, lo: 0.4 }),
},
warning: {
- color: "text-amber-500",
+ color: 'text-amber-500',
glyph: BANG,
blink: () => ({ duration: 1.6, delay: 0, lo: 0.45 }),
},
- info: { color: "text-blue-500", glyph: INFO },
- paused: { color: "text-muted-foreground", glyph: PAUSE },
- stopped: { color: "text-muted-foreground", glyph: STOP },
- offline: { color: "text-muted-foreground", base: 0.15 },
+ info: { color: 'text-blue-500', glyph: INFO },
+ paused: { color: 'text-muted-foreground', glyph: PAUSE },
+ stopped: { color: 'text-muted-foreground', glyph: STOP },
+ offline: { color: 'text-muted-foreground', base: 0.15 },
} satisfies Record<string, StateConfig>;
export type DotMatrixState = keyof typeof STATES;
const dotMatrixStates = Object.keys(STATES) as readonly DotMatrixState[];
-export type DotMatrixProps = Omit<ComponentProps<"span">, "children"> & {
+export type DotMatrixProps = Omit<ComponentProps<'span'>, 'children'> & {
state?: DotMatrixState;
label?: string;
};
@@ -207,33 +181,22 @@ const DOT_MATRIX_CSS =
* <DotMatrix state={isRunning ? "loading" : "success"} />
* ```
*/
-function DotMatrix({
- className,
- state = "loading",
- label,
- ...props
-}: DotMatrixProps) {
+function DotMatrix({ className, state = 'loading', label, ...props }: DotMatrixProps) {
const config: StateConfig = STATES[state];
return (
<span
data-slot="dot-matrix"
data-state={state}
role="status"
- className={cn("inline-block size-4 shrink-0", config.color, className)}
- {...props}
- >
+ className={cn('inline-block size-4 shrink-0', config.color, className)}
+ {...props}>
<span className="sr-only">{label ?? state}</span>
{/* Hoisted and deduplicated across instances by React; must live in HTML scope, inside the SVG it would be an SVG-namespace element React does not hoist. */}
<style href="aui-dot-matrix" precedence="low">
{DOT_MATRIX_CSS}
</style>
- <svg
- aria-hidden
- viewBox="0 0 20 20"
- fill="currentColor"
- className="size-full"
- >
- {DOT_INDEXES.map((i) => {
+ <svg aria-hidden viewBox="0 0 20 20" fill="currentColor" className="size-full">
+ {DOT_INDEXES.map(i => {
const row = Math.floor(i / GRID);
const col = i % GRID;
const on = !config.glyph || config.glyph.has(i);
@@ -252,8 +215,8 @@ function DotMatrix({
opacity: hi,
animationDuration: `${blink?.duration ?? 1}s`,
animationDelay: `${blink?.delay ?? 0}s`,
- "--aui-dot-matrix-hi": hi,
- "--aui-dot-matrix-lo": blink?.lo ?? hi,
+ '--aui-dot-matrix-hi': hi,
+ '--aui-dot-matrix-lo': blink?.lo ?? hi,
} as CSSProperties
}
/>
diff --git a/app/src/components/assistant-ui/file.tsx b/app/src/components/assistant-ui/file.tsx
index 047d3bd89a..a5907668eb 100644
--- a/app/src/components/assistant-ui/file.tsx
+++ b/app/src/components/assistant-ui/file.tsx
@@ -1,79 +1,73 @@
-"use client";
+'use client';
-import { memo, type FC } from "react";
-import { cva, type VariantProps } from "class-variance-authority";
+import { cn } from '@/components/assistant-ui/lib/utils';
+import type { FileMessagePartComponent } from '@assistant-ui/react';
+import { cva, type VariantProps } from 'class-variance-authority';
import {
+ BracesIcon,
+ DownloadIcon,
FileIcon,
FileTextIcon,
ImageIcon,
MusicIcon,
VideoIcon,
- BracesIcon,
- DownloadIcon,
-} from "lucide-react";
-import type { FileMessagePartComponent } from "@assistant-ui/react";
-import { cn } from "@/components/assistant-ui/lib/utils";
+} from 'lucide-react';
+import { type FC, memo } from 'react';
const fileVariants = cva(
- "aui-file-root inline-flex items-center gap-3 rounded-lg transition-colors",
+ 'aui-file-root inline-flex items-center gap-3 rounded-lg transition-colors',
{
variants: {
variant: {
- outline: "border-border hover:bg-muted/50 border",
- ghost: "hover:bg-muted/50",
- muted: "bg-muted/50 hover:bg-muted/70",
+ outline: 'border-border hover:bg-muted/50 border',
+ ghost: 'hover:bg-muted/50',
+ muted: 'bg-muted/50 hover:bg-muted/70',
},
size: {
- sm: "px-2.5 py-1.5 text-xs",
- default: "px-3 py-2 text-sm",
- lg: "px-4 py-3 text-base",
+ sm: 'px-2.5 py-1.5 text-xs',
+ default: 'px-3 py-2 text-sm',
+ lg: 'px-4 py-3 text-base',
},
},
- defaultVariants: {
- variant: "outline",
- size: "default",
- },
- },
+ defaultVariants: { variant: 'outline', size: 'default' },
+ }
);
function getMimeTypeIcon(mimeType: string): FC<{ className?: string }> {
const type = mimeType.toLowerCase();
- if (type.startsWith("image/")) {
+ if (type.startsWith('image/')) {
return ImageIcon;
}
- if (type === "application/pdf") {
+ if (type === 'application/pdf') {
return FileTextIcon;
}
- if (type === "application/json") {
+ if (type === 'application/json') {
return BracesIcon;
}
- if (type.startsWith("text/")) {
+ if (type.startsWith('text/')) {
return FileTextIcon;
}
- if (type.startsWith("audio/")) {
+ if (type.startsWith('audio/')) {
return MusicIcon;
}
- if (type.startsWith("video/")) {
+ if (type.startsWith('video/')) {
return VideoIcon;
}
return FileIcon;
}
-export type FileDataKind = "data-uri" | "url" | "base64" | "id";
+export type FileDataKind = 'data-uri' | 'url' | 'base64' | 'id';
-function getFileDataKind(
- data: string,
- sourceType?: "url" | "id",
-): FileDataKind {
- if (sourceType === "url" && /^data:/i.test(data)) return "data-uri";
+function getFileDataKind(data: string, sourceType?: 'url' | 'id'): FileDataKind {
+ if (sourceType === 'url' && /^data:/i.test(data)) return 'data-uri';
if (sourceType) return sourceType;
- if (/^data:/i.test(data)) return "data-uri";
- if (/^https?:\/\//i.test(data)) return "url";
- return "base64";
+ if (/^data:/i.test(data)) return 'data-uri';
+ if (/^https?:\/\//i.test(data)) return 'url';
+ return 'base64';
}
function getBase64Size(base64: string): number {
- const commaIndex = base64.indexOf(",");
+ const commaIndex = base64.indexOf(',');
const base64Data = commaIndex >= 0 ? base64.slice(commaIndex + 1) : base64;
const padding = (base64Data.match(/=/g) || []).length;
return Math.floor((base64Data.length * 3) / 4) - padding;
@@ -89,89 +83,65 @@ function formatFileSize(bytes: number): string {
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
}
-export type FileRootProps = React.ComponentProps<"div"> &
- VariantProps<typeof fileVariants>;
+export type FileRootProps = React.ComponentProps<'div'> & VariantProps<typeof fileVariants>;
-function FileRoot({
- className,
- variant,
- size,
- children,
- ...props
-}: FileRootProps) {
+function FileRoot({ className, variant, size, children, ...props }: FileRootProps) {
return (
<div
data-slot="file-root"
data-variant={variant}
data-size={size}
className={cn(fileVariants({ variant, size, className }))}
- {...props}
- >
+ {...props}>
{children}
</div>
);
}
-type FileIconDisplayProps = React.ComponentProps<"span"> & {
- mimeType?: string;
-};
+type FileIconDisplayProps = React.ComponentProps<'span'> & { mimeType?: string };
-function FileIconDisplay({
- mimeType,
- className,
- children,
- ...props
-}: FileIconDisplayProps) {
+function FileIconDisplay({ mimeType, className, children, ...props }: FileIconDisplayProps) {
const IconComponent = mimeType ? getMimeTypeIcon(mimeType) : FileIcon;
return (
<span
data-slot="file-icon"
- className={cn("text-muted-foreground shrink-0", className)}
- {...props}
- >
+ className={cn('text-muted-foreground shrink-0', className)}
+ {...props}>
{children ?? <IconComponent className="size-5" />}
</span>
);
}
-function FileName({
- className,
- children,
- ...props
-}: React.ComponentProps<"span">) {
+function FileName({ className, children, ...props }: React.ComponentProps<'span'>) {
return (
<span
data-slot="file-name"
- className={cn("min-w-0 flex-1 truncate font-medium", className)}
- {...props}
- >
- {children || "Unnamed file"}
+ className={cn('min-w-0 flex-1 truncate font-medium', className)}
+ {...props}>
+ {children || 'Unnamed file'}
</span>
);
}
-type FileSizeProps = React.ComponentProps<"span"> & {
- bytes: number;
-};
+type FileSizeProps = React.ComponentProps<'span'> & { bytes: number };
function FileSize({ bytes, className, ...props }: FileSizeProps) {
return (
<span
data-slot="file-size"
- className={cn("text-muted-foreground shrink-0", className)}
- {...props}
- >
+ className={cn('text-muted-foreground shrink-0', className)}
+ {...props}>
{formatFileSize(bytes)}
</span>
);
}
-type FileDownloadProps = Omit<React.ComponentProps<"a">, "href"> & {
+type FileDownloadProps = Omit<React.ComponentProps<'a'>, 'href'> & {
data: string;
mimeType: string;
filename?: string;
- sourceType?: "url" | "id";
+ sourceType?: 'url' | 'id';
};
function FileDownload({
@@ -183,47 +153,38 @@ function FileDownload({
children,
...props
}: FileDownloadProps) {
- if (typeof data !== "string") return null;
+ if (typeof data !== 'string') return null;
const kind = getFileDataKind(data, sourceType);
- if (kind === "id") return null;
- if (kind === "url" && !/^(https?:\/\/|blob:)/i.test(data)) return null;
- const href = kind === "base64" ? `data:${mimeType};base64,${data}` : data;
+ if (kind === 'id') return null;
+ if (kind === 'url' && !/^(https?:\/\/|blob:)/i.test(data)) return null;
+ const href = kind === 'base64' ? `data:${mimeType};base64,${data}` : data;
return (
<a
data-slot="file-download"
href={href}
- download={filename || "download"}
- {...(kind === "url" && { target: "_blank", rel: "noopener noreferrer" })}
+ download={filename || 'download'}
+ {...(kind === 'url' && { target: '_blank', rel: 'noopener noreferrer' })}
className={cn(
- "text-muted-foreground hover:bg-accent hover:text-accent-foreground shrink-0 rounded-md p-1 transition-colors",
- className,
+ 'text-muted-foreground hover:bg-accent hover:text-accent-foreground shrink-0 rounded-md p-1 transition-colors',
+ className
)}
- {...props}
- >
+ {...props}>
{children || <DownloadIcon className="size-4" />}
</a>
);
}
-const FileImpl: FileMessagePartComponent = ({
- filename,
- data,
- mimeType,
- sourceType,
-}) => {
+const FileImpl: FileMessagePartComponent = ({ filename, data, mimeType, sourceType }) => {
const kind = getFileDataKind(data, sourceType);
- const showSize =
- typeof data === "string" && (kind === "base64" || kind === "data-uri");
+ const showSize = typeof data === 'string' && (kind === 'base64' || kind === 'data-uri');
return (
<FileRoot>
<FileIconDisplay mimeType={mimeType} />
<div className="flex min-w-0 flex-1 flex-col gap-0.5">
<FileName>{filename}</FileName>
- {showSize && (
- <FileSize bytes={getBase64Size(data)} className="text-xs" />
- )}
+ {showSize && <FileSize bytes={getBase64Size(data)} className="text-xs" />}
</div>
<FileDownload
data={data}
@@ -243,7 +204,7 @@ const File = memo(FileImpl) as unknown as FileMessagePartComponent & {
Download: typeof FileDownload;
};
-File.displayName = "File";
+File.displayName = 'File';
File.Root = FileRoot;
File.Icon = FileIconDisplay;
File.Name = FileName;
diff --git a/app/src/components/assistant-ui/follow-up-suggestions.tsx b/app/src/components/assistant-ui/follow-up-suggestions.tsx
index 1125c59485..ccdb0b2bc4 100644
--- a/app/src/components/assistant-ui/follow-up-suggestions.tsx
+++ b/app/src/components/assistant-ui/follow-up-suggestions.tsx
@@ -1,10 +1,10 @@
-"use client";
+'use client';
-import { AuiIf, useAuiState, ThreadPrimitive } from "@assistant-ui/react";
-import { useCallback, useEffect, useRef, useState, type FC } from "react";
+import { AuiIf, ThreadPrimitive, useAuiState } from '@assistant-ui/react';
+import { type FC, useCallback, useEffect, useRef, useState } from 'react';
const FollowupSuggestionsRow: FC = () => {
- const suggestions = useAuiState((s) => s.thread.suggestions);
+ const suggestions = useAuiState(s => s.thread.suggestions);
const scrollRef = useRef<HTMLDivElement>(null);
const rtlRef = useRef<boolean | null>(null);
const [fades, setFades] = useState({ left: false, right: false });
@@ -16,11 +16,11 @@ const FollowupSuggestionsRow: FC = () => {
// scrollLeft runs 0..-max in RTL; normalize to hidden width per physical edge.
const fromStart = Math.abs(el.scrollLeft);
// getComputedStyle forces a style recalc per scroll event; direction is stable, read it once.
- const rtl = (rtlRef.current ??= getComputedStyle(el).direction === "rtl");
+ const rtl = (rtlRef.current ??= getComputedStyle(el).direction === 'rtl');
const [left, right] = rtl
? [maxScroll - fromStart, fromStart]
: [fromStart, maxScroll - fromStart];
- setFades((prev) => {
+ setFades(prev => {
const next = { left: left > 1, right: right > 1 };
return prev.left === next.left && prev.right === next.right ? prev : next;
});
@@ -37,8 +37,8 @@ const FollowupSuggestionsRow: FC = () => {
}, [updateFades]);
const maskImage = `linear-gradient(to right, ${
- fades.left ? "transparent, black 2rem" : "black"
- }, ${fades.right ? "black calc(100% - 2rem), transparent" : "black"})`;
+ fades.left ? 'transparent, black 2rem' : 'black'
+ }, ${fades.right ? 'black calc(100% - 2rem), transparent' : 'black'})`;
return (
<div
@@ -46,8 +46,7 @@ const FollowupSuggestionsRow: FC = () => {
onScroll={updateFades}
// overflow-x clips both axes; py-1/-my-1 gives focus rings vertical room without changing outer height.
className="aui-thread-followup-suggestions -my-1 w-full overflow-x-auto py-1 [-ms-overflow-style:none] scrollbar-none [&::-webkit-scrollbar]:hidden"
- style={{ maskImage, WebkitMaskImage: maskImage }}
- >
+ style={{ maskImage, WebkitMaskImage: maskImage }}>
<div className="mx-auto flex min-h-8 w-max items-center gap-2 px-0.5">
{suggestions.map((suggestion, idx) => (
<ThreadPrimitive.Suggestion
@@ -55,8 +54,7 @@ const FollowupSuggestionsRow: FC = () => {
className="aui-thread-followup-suggestion bg-background hover:bg-muted/80 rounded-full border px-3 py-1 text-sm whitespace-nowrap transition-colors ease-in"
prompt={suggestion.prompt}
method="replace"
- autoSend
- >
+ autoSend>
{suggestion.title ?? suggestion.prompt}
{suggestion.label && (
<span className="aui-thread-followup-suggestion-label text-muted-foreground ms-1">
@@ -72,12 +70,7 @@ const FollowupSuggestionsRow: FC = () => {
export const ThreadFollowupSuggestions: FC = () => (
<AuiIf
- condition={(s) =>
- !s.thread.isEmpty &&
- !s.thread.isRunning &&
- s.thread.suggestions.length > 0
- }
- >
+ condition={s => !s.thread.isEmpty && !s.thread.isRunning && s.thread.suggestions.length > 0}>
<FollowupSuggestionsRow />
</AuiIf>
);
diff --git a/app/src/components/assistant-ui/image.tsx b/app/src/components/assistant-ui/image.tsx
index 8fa219f28b..2c36cfc175 100644
--- a/app/src/components/assistant-ui/image.tsx
+++ b/app/src/components/assistant-ui/image.tsx
@@ -1,14 +1,8 @@
-"use client";
+'use client';
-import {
- memo,
- useState,
- useEffect,
- useRef,
- type PropsWithChildren,
-} from "react";
-import { createPortal } from "react-dom";
-import { cva, type VariantProps } from "class-variance-authority";
+import { cn } from '@/components/assistant-ui/lib/utils';
+import type { ImageMessagePart, ImageMessagePartComponent } from '@assistant-ui/react';
+import { cva, type VariantProps } from 'class-variance-authority';
import {
CopyIcon,
DownloadIcon,
@@ -17,40 +11,35 @@ import {
Loader2Icon,
RefreshCwIcon,
ShieldAlertIcon,
-} from "lucide-react";
-import type {
- ImageMessagePart,
- ImageMessagePartComponent,
-} from "@assistant-ui/react";
-import { cn } from "@/components/assistant-ui/lib/utils";
+} from 'lucide-react';
+import { memo, type PropsWithChildren, useEffect, useRef, useState } from 'react';
+import { createPortal } from 'react-dom';
const extensionForMimeType = (mimeType?: string): string => {
switch (mimeType) {
- case "image/png":
- return "png";
- case "image/jpeg":
- case "image/jpg":
- return "jpg";
- case "image/webp":
- return "webp";
- case "image/gif":
- return "gif";
- case "image/svg+xml":
- return "svg";
+ case 'image/png':
+ return 'png';
+ case 'image/jpeg':
+ case 'image/jpg':
+ return 'jpg';
+ case 'image/webp':
+ return 'webp';
+ case 'image/gif':
+ return 'gif';
+ case 'image/svg+xml':
+ return 'svg';
default:
- return "png";
+ return 'png';
}
};
const dataUriToBlob = (dataUri: string): Blob => {
- const commaIndex = dataUri.indexOf(",");
+ const commaIndex = dataUri.indexOf(',');
const meta = commaIndex >= 0 ? dataUri.slice(0, commaIndex) : dataUri;
- const data = commaIndex >= 0 ? dataUri.slice(commaIndex + 1) : "";
- const mime =
- meta.match(/data:([^;]+)/i)?.[1]?.toLowerCase() ??
- "application/octet-stream";
+ const data = commaIndex >= 0 ? dataUri.slice(commaIndex + 1) : '';
+ const mime = meta.match(/data:([^;]+)/i)?.[1]?.toLowerCase() ?? 'application/octet-stream';
if (!/;base64/i.test(meta)) {
- const text = data.replace(/(?:%[0-9A-Fa-f]{2})+/g, (seq) => {
+ const text = data.replace(/(?:%[0-9A-Fa-f]{2})+/g, seq => {
try {
return decodeURIComponent(seq);
} catch {
@@ -68,91 +57,62 @@ const dataUriToBlob = (dataUri: string): Blob => {
const mimeFromImage = (image: string): string | undefined =>
image.match(/^data:([^;,]+)/i)?.[1]?.toLowerCase();
-const downloadImagePart = (
- part: Pick<ImageMessagePart, "image" | "filename">,
-): void => {
- if (typeof document === "undefined") return;
+const downloadImagePart = (part: Pick<ImageMessagePart, 'image' | 'filename'>): void => {
+ if (typeof document === 'undefined') return;
const ext = extensionForMimeType(mimeFromImage(part.image));
const filename = part.filename ?? `image.${ext}`;
const isDataUri = /^data:/i.test(part.image);
- const objectUrl = isDataUri
- ? URL.createObjectURL(dataUriToBlob(part.image))
- : null;
+ const objectUrl = isDataUri ? URL.createObjectURL(dataUriToBlob(part.image)) : null;
const href = objectUrl ?? part.image;
- const a = document.createElement("a");
+ const a = document.createElement('a');
a.href = href;
a.download = filename;
- a.rel = "noopener";
+ a.rel = 'noopener';
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
if (objectUrl) setTimeout(() => URL.revokeObjectURL(objectUrl), 40_000);
};
-const copyImagePart = async (
- part: Pick<ImageMessagePart, "image">,
-): Promise<void> => {
+const copyImagePart = async (part: Pick<ImageMessagePart, 'image'>): Promise<void> => {
if (
- typeof navigator === "undefined" ||
+ typeof navigator === 'undefined' ||
!navigator.clipboard ||
- typeof ClipboardItem === "undefined"
+ typeof ClipboardItem === 'undefined'
) {
- throw new Error("Clipboard API is not available in this environment.");
+ throw new Error('Clipboard API is not available in this environment.');
}
const blob = /^data:/i.test(part.image)
? dataUriToBlob(part.image)
- : await fetch(part.image).then((r) => r.blob());
- const mime = mimeFromImage(part.image) ?? blob.type ?? "image/png";
+ : await fetch(part.image).then(r => r.blob());
+ const mime = mimeFromImage(part.image) ?? blob.type ?? 'image/png';
await navigator.clipboard.write([new ClipboardItem({ [mime]: blob })]);
};
-const imageVariants = cva(
- "aui-image-root relative overflow-hidden rounded-lg",
- {
- variants: {
- variant: {
- outline: "border-border border",
- ghost: "",
- muted: "bg-muted/50",
- },
- size: {
- sm: "max-w-64",
- default: "max-w-96",
- lg: "max-w-[512px]",
- full: "w-full",
- },
- },
- defaultVariants: {
- variant: "outline",
- size: "default",
- },
+const imageVariants = cva('aui-image-root relative overflow-hidden rounded-lg', {
+ variants: {
+ variant: { outline: 'border-border border', ghost: '', muted: 'bg-muted/50' },
+ size: { sm: 'max-w-64', default: 'max-w-96', lg: 'max-w-[512px]', full: 'w-full' },
},
-);
+ defaultVariants: { variant: 'outline', size: 'default' },
+});
-export type ImageRootProps = React.ComponentProps<"div"> &
- VariantProps<typeof imageVariants>;
+export type ImageRootProps = React.ComponentProps<'div'> & VariantProps<typeof imageVariants>;
-function ImageRoot({
- className,
- variant,
- size,
- children,
- ...props
-}: ImageRootProps) {
+function ImageRoot({ className, variant, size, children, ...props }: ImageRootProps) {
return (
<div
data-slot="image-root"
data-variant={variant}
data-size={size}
className={cn(imageVariants({ variant, size, className }))}
- {...props}
- >
+ {...props}>
{children}
</div>
);
}
-type ImagePreviewProps = Omit<React.ComponentProps<"img">, "children"> & {
+type ImagePreviewProps = Omit<React.ComponentProps<'img'>, 'children'> & {
containerClassName?: string;
};
@@ -161,7 +121,7 @@ function ImagePreview({
containerClassName,
onLoad,
onError,
- alt = "Image content",
+ alt = 'Image content',
src,
...props
}: ImagePreviewProps) {
@@ -173,33 +133,24 @@ function ImagePreview({
const error = errorSrc === src;
useEffect(() => {
- if (
- typeof src === "string" &&
- imgRef.current?.complete &&
- imgRef.current.naturalWidth > 0
- ) {
+ if (typeof src === 'string' && imgRef.current?.complete && imgRef.current.naturalWidth > 0) {
setLoadedSrc(src);
}
}, [src]);
return (
- <div
- data-slot="image-preview"
- className={cn("relative min-h-32", containerClassName)}
- >
+ <div data-slot="image-preview" className={cn('relative min-h-32', containerClassName)}>
{!loaded && !error && (
<div
data-slot="image-preview-loading"
- className="bg-muted/50 absolute inset-0 flex items-center justify-center"
- >
+ className="bg-muted/50 absolute inset-0 flex items-center justify-center">
<ImageIcon className="text-muted-foreground size-8 animate-pulse" />
</div>
)}
{error ? (
<div
data-slot="image-preview-error"
- className="bg-muted/50 flex min-h-32 items-center justify-center p-4"
- >
+ className="bg-muted/50 flex min-h-32 items-center justify-center p-4">
<ImageOffIcon className="text-muted-foreground size-8" />
</div>
) : (
@@ -207,17 +158,13 @@ function ImagePreview({
ref={imgRef}
src={src}
alt={alt}
- className={cn(
- "block h-auto w-full object-contain",
- !loaded && "invisible",
- className,
- )}
- onLoad={(e) => {
- if (typeof src === "string") setLoadedSrc(src);
+ className={cn('block h-auto w-full object-contain', !loaded && 'invisible', className)}
+ onLoad={e => {
+ if (typeof src === 'string') setLoadedSrc(src);
onLoad?.(e);
}}
- onError={(e) => {
- if (typeof src === "string") setErrorSrc(src);
+ onError={e => {
+ if (typeof src === 'string') setErrorSrc(src);
onError?.(e);
}}
{...props}
@@ -227,33 +174,22 @@ function ImagePreview({
);
}
-function ImageFilename({
- className,
- children,
- ...props
-}: React.ComponentProps<"span">) {
+function ImageFilename({ className, children, ...props }: React.ComponentProps<'span'>) {
if (!children) return null;
return (
<span
data-slot="image-filename"
- className={cn(
- "text-muted-foreground block truncate px-2 py-1.5 text-xs",
- className,
- )}
- {...props}
- >
+ className={cn('text-muted-foreground block truncate px-2 py-1.5 text-xs', className)}
+ {...props}>
{children}
</span>
);
}
-type ImageZoomProps = PropsWithChildren<{
- src: string;
- alt?: string;
-}>;
+type ImageZoomProps = PropsWithChildren<{ src: string; alt?: string }>;
-function ImageZoom({ src, alt = "Image preview", children }: ImageZoomProps) {
+function ImageZoom({ src, alt = 'Image preview', children }: ImageZoomProps) {
const [isMounted, setIsMounted] = useState(false);
const [isOpen, setIsOpen] = useState(false);
@@ -267,16 +203,16 @@ function ImageZoom({ src, alt = "Image preview", children }: ImageZoomProps) {
useEffect(() => {
if (!isOpen) return;
const handleKeyDown = (e: KeyboardEvent) => {
- if (e.key === "Escape") setIsOpen(false);
+ if (e.key === 'Escape') setIsOpen(false);
};
- document.addEventListener("keydown", handleKeyDown);
- return () => document.removeEventListener("keydown", handleKeyDown);
+ document.addEventListener('keydown', handleKeyDown);
+ return () => document.removeEventListener('keydown', handleKeyDown);
}, [isOpen]);
useEffect(() => {
if (!isOpen) return;
const originalOverflow = document.body.style.overflow;
- document.body.style.overflow = "hidden";
+ document.body.style.overflow = 'hidden';
return () => {
document.body.style.overflow = originalOverflow;
};
@@ -286,12 +222,11 @@ function ImageZoom({ src, alt = "Image preview", children }: ImageZoomProps) {
<>
<div
onClick={handleOpen}
- onKeyDown={(e) => e.key === "Enter" && handleOpen()}
+ onKeyDown={e => e.key === 'Enter' && handleOpen()}
role="button"
tabIndex={0}
className="aui-image-zoom-trigger cursor-zoom-in"
- aria-label="Click to zoom image"
- >
+ aria-label="Click to zoom image">
{children}
</div>
{isMounted &&
@@ -303,21 +238,20 @@ function ImageZoom({ src, alt = "Image preview", children }: ImageZoomProps) {
tabIndex={0}
className="aui-image-zoom-overlay fade-in animate-in fixed inset-0 z-50 flex items-center justify-center bg-black/80 duration-200"
onClick={handleClose}
- onKeyDown={(e) => e.key === "Enter" && handleClose()}
- aria-label="Close zoomed image"
- >
+ onKeyDown={e => e.key === 'Enter' && handleClose()}
+ aria-label="Close zoomed image">
<img
data-slot="image-zoom-content"
src={src}
alt={alt}
className="aui-image-zoom-content fade-in zoom-in-95 animate-in max-h-[90vh] max-w-[90vw] cursor-zoom-out object-contain duration-200"
- onClick={(e) => {
+ onClick={e => {
e.stopPropagation();
handleClose();
}}
/>
</div>,
- document.body,
+ document.body
)}
</>
);
@@ -327,32 +261,21 @@ function ImageGenerating({ className }: { className?: string }) {
return (
<div
data-slot="image-generating"
- className={cn(
- "bg-muted/50 flex min-h-32 items-center justify-center p-4",
- className,
- )}
- >
+ className={cn('bg-muted/50 flex min-h-32 items-center justify-center p-4', className)}>
<Loader2Icon className="text-muted-foreground size-8 animate-spin" />
<span className="sr-only">Generating image…</span>
</div>
);
}
-function ImageContentFilterError({
- className,
- reason,
-}: {
- className?: string;
- reason?: string;
-}) {
+function ImageContentFilterError({ className, reason }: { className?: string; reason?: string }) {
return (
<div
data-slot="image-content-filter-error"
className={cn(
- "bg-muted/50 flex min-h-32 flex-col items-center justify-center gap-2 p-4 text-center",
- className,
- )}
- >
+ 'bg-muted/50 flex min-h-32 flex-col items-center justify-center gap-2 p-4 text-center',
+ className
+ )}>
<ShieldAlertIcon className="text-muted-foreground size-8" />
<p className="text-sm font-medium">Image could not be generated</p>
{reason && <p className="text-muted-foreground text-xs">{reason}</p>}
@@ -370,11 +293,7 @@ export type ImageActionsProps = {
className?: string;
};
-function RegenerateButton({
- onRegenerate,
-}: {
- onRegenerate: () => void | Promise<void>;
-}) {
+function RegenerateButton({ onRegenerate }: { onRegenerate: () => void | Promise<void> }) {
const [isRegenerating, setIsRegenerating] = useState(false);
return (
<button
@@ -390,28 +309,21 @@ function RegenerateButton({
disabled={isRegenerating}
data-slot="image-regenerate"
aria-label="Regenerate image"
- className="hover:bg-muted inline-flex size-7 items-center justify-center rounded disabled:opacity-50"
- >
- <RefreshCwIcon
- className={cn("size-4", isRegenerating && "animate-spin")}
- />
+ className="hover:bg-muted inline-flex size-7 items-center justify-center rounded disabled:opacity-50">
+ <RefreshCwIcon className={cn('size-4', isRegenerating && 'animate-spin')} />
</button>
);
}
function ImageActions({ part, onRegenerate, className }: ImageActionsProps) {
return (
- <div
- data-slot="image-actions"
- className={cn("flex items-center gap-1 p-1", className)}
- >
+ <div data-slot="image-actions" className={cn('flex items-center gap-1 p-1', className)}>
<button
type="button"
onClick={() => downloadImagePart(part)}
data-slot="image-download"
aria-label="Download image"
- className="hover:bg-muted inline-flex size-7 items-center justify-center rounded"
- >
+ className="hover:bg-muted inline-flex size-7 items-center justify-center rounded">
<DownloadIcon className="size-4" />
</button>
<button
@@ -421,8 +333,7 @@ function ImageActions({ part, onRegenerate, className }: ImageActionsProps) {
}}
data-slot="image-copy"
aria-label="Copy image"
- className="hover:bg-muted inline-flex size-7 items-center justify-center rounded"
- >
+ className="hover:bg-muted inline-flex size-7 items-center justify-center rounded">
<CopyIcon className="size-4" />
</button>
{onRegenerate && <RegenerateButton onRegenerate={onRegenerate} />}
@@ -430,10 +341,10 @@ function ImageActions({ part, onRegenerate, className }: ImageActionsProps) {
);
}
-const ImageImpl: ImageMessagePartComponent = (props) => {
+const ImageImpl: ImageMessagePartComponent = props => {
const { image, filename, status } = props;
- if (status?.type === "running") {
+ if (status?.type === 'running') {
return (
<ImageRoot>
<ImageGenerating />
@@ -442,7 +353,7 @@ const ImageImpl: ImageMessagePartComponent = (props) => {
);
}
- if (status?.type === "incomplete" && status.reason === "content-filter") {
+ if (status?.type === 'incomplete' && status.reason === 'content-filter') {
return (
<ImageRoot>
<ImageContentFilterError reason="The provider blocked this image." />
@@ -452,8 +363,8 @@ const ImageImpl: ImageMessagePartComponent = (props) => {
return (
<ImageRoot>
- <ImageZoom src={image} alt={filename || "Image content"}>
- <ImagePreview src={image} alt={filename || "Image content"} />
+ <ImageZoom src={image} alt={filename || 'Image content'}>
+ <ImagePreview src={image} alt={filename || 'Image content'} />
</ImageZoom>
<ImageFilename>{filename}</ImageFilename>
</ImageRoot>
@@ -470,7 +381,7 @@ const Image = memo(ImageImpl) as unknown as ImageMessagePartComponent & {
ContentFilterError: typeof ImageContentFilterError;
};
-Image.displayName = "Image";
+Image.displayName = 'Image';
Image.Root = ImageRoot;
Image.Preview = ImagePreview;
Image.Filename = ImageFilename;
diff --git a/app/src/components/assistant-ui/markdown-text.tsx b/app/src/components/assistant-ui/markdown-text.tsx
index b1d610ef29..ef3985f8d7 100644
--- a/app/src/components/assistant-ui/markdown-text.tsx
+++ b/app/src/components/assistant-ui/markdown-text.tsx
@@ -1,19 +1,17 @@
-"use client";
-
-import "@assistant-ui/react-markdown/styles/dot.css";
+'use client';
+import { cn } from '@/components/assistant-ui/lib/utils';
+import { TooltipIconButton } from '@/components/assistant-ui/tooltip-icon-button';
import {
type CodeHeaderProps,
MarkdownTextPrimitive,
unstable_memoizeMarkdownComponents as memoizeMarkdownComponents,
useIsMarkdownCodeBlock,
-} from "@assistant-ui/react-markdown";
-import remarkGfm from "remark-gfm";
-import { type FC, memo, useState } from "react";
-import { CheckIcon, CopyIcon } from "lucide-react";
-
-import { TooltipIconButton } from "@/components/assistant-ui/tooltip-icon-button";
-import { cn } from "@/components/assistant-ui/lib/utils";
+} from '@assistant-ui/react-markdown';
+import '@assistant-ui/react-markdown/styles/dot.css';
+import { CheckIcon, CopyIcon } from 'lucide-react';
+import { type FC, memo, useState } from 'react';
+import remarkGfm from 'remark-gfm';
const MarkdownTextImpl = () => {
return (
@@ -41,26 +39,18 @@ const CodeHeader: FC<CodeHeaderProps> = ({ language, code }) => {
{language}
</span>
<TooltipIconButton tooltip="Copy" onClick={onCopy}>
- {!isCopied && (
- <CopyIcon className="animate-in zoom-in-75 fade-in duration-150" />
- )}
- {isCopied && (
- <CheckIcon className="animate-in zoom-in-50 fade-in duration-200 ease-out" />
- )}
+ {!isCopied && <CopyIcon className="animate-in zoom-in-75 fade-in duration-150" />}
+ {isCopied && <CheckIcon className="animate-in zoom-in-50 fade-in duration-200 ease-out" />}
</TooltipIconButton>
</div>
);
};
-const useCopyToClipboard = ({
- copiedDuration = 3000,
-}: {
- copiedDuration?: number;
-} = {}) => {
+const useCopyToClipboard = ({ copiedDuration = 3000 }: { copiedDuration?: number } = {}) => {
const [isCopied, setIsCopied] = useState<boolean>(false);
const copyToClipboard = (value: string) => {
- if (!value || typeof navigator === "undefined" || !navigator.clipboard) {
+ if (!value || typeof navigator === 'undefined' || !navigator.clipboard) {
return;
}
@@ -69,7 +59,7 @@ const useCopyToClipboard = ({
setIsCopied(true);
setTimeout(() => setIsCopied(false), copiedDuration);
},
- () => {},
+ () => {}
);
};
@@ -80,8 +70,8 @@ const defaultComponents = memoizeMarkdownComponents({
h1: ({ className, ...props }) => (
<h1
className={cn(
- "aui-md-h1 mt-5 mb-2 scroll-m-20 text-xl font-semibold first:mt-0 last:mb-0",
- className,
+ 'aui-md-h1 mt-5 mb-2 scroll-m-20 text-xl font-semibold first:mt-0 last:mb-0',
+ className
)}
{...props}
/>
@@ -89,8 +79,8 @@ const defaultComponents = memoizeMarkdownComponents({
h2: ({ className, ...props }) => (
<h2
className={cn(
- "aui-md-h2 mt-5 mb-2 scroll-m-20 text-lg font-semibold first:mt-0 last:mb-0",
- className,
+ 'aui-md-h2 mt-5 mb-2 scroll-m-20 text-lg font-semibold first:mt-0 last:mb-0',
+ className
)}
{...props}
/>
@@ -98,8 +88,8 @@ const defaultComponents = memoizeMarkdownComponents({
h3: ({ className, ...props }) => (
<h3
className={cn(
- "aui-md-h3 mt-4 mb-1.5 scroll-m-20 text-base font-semibold first:mt-0 last:mb-0",
- className,
+ 'aui-md-h3 mt-4 mb-1.5 scroll-m-20 text-base font-semibold first:mt-0 last:mb-0',
+ className
)}
{...props}
/>
@@ -107,44 +97,32 @@ const defaultComponents = memoizeMarkdownComponents({
h4: ({ className, ...props }) => (
<h4
className={cn(
- "aui-md-h4 mt-3.5 mb-1 scroll-m-20 text-base font-medium first:mt-0 last:mb-0",
- className,
+ 'aui-md-h4 mt-3.5 mb-1 scroll-m-20 text-base font-medium first:mt-0 last:mb-0',
+ className
)}
{...props}
/>
),
h5: ({ className, ...props }) => (
<h5
- className={cn(
- "aui-md-h5 mt-3 mb-1 text-sm font-semibold first:mt-0 last:mb-0",
- className,
- )}
+ className={cn('aui-md-h5 mt-3 mb-1 text-sm font-semibold first:mt-0 last:mb-0', className)}
{...props}
/>
),
h6: ({ className, ...props }) => (
<h6
- className={cn(
- "aui-md-h6 mt-3 mb-1 text-sm font-medium first:mt-0 last:mb-0",
- className,
- )}
+ className={cn('aui-md-h6 mt-3 mb-1 text-sm font-medium first:mt-0 last:mb-0', className)}
{...props}
/>
),
p: ({ className, ...props }) => (
- <p
- className={cn(
- "aui-md-p my-3 leading-relaxed first:mt-0 last:mb-0",
- className,
- )}
- {...props}
- />
+ <p className={cn('aui-md-p my-3 leading-relaxed first:mt-0 last:mb-0', className)} {...props} />
),
a: ({ className, ...props }) => (
<a
className={cn(
- "aui-md-a text-primary hover:text-primary/80 underline underline-offset-2",
- className,
+ 'aui-md-a text-primary hover:text-primary/80 underline underline-offset-2',
+ className
)}
{...props}
/>
@@ -152,8 +130,8 @@ const defaultComponents = memoizeMarkdownComponents({
blockquote: ({ className, ...props }) => (
<blockquote
className={cn(
- "aui-md-blockquote border-muted-foreground/30 text-muted-foreground my-3 border-s-2 ps-4",
- className,
+ 'aui-md-blockquote border-muted-foreground/30 text-muted-foreground my-3 border-s-2 ps-4',
+ className
)}
{...props}
/>
@@ -161,8 +139,8 @@ const defaultComponents = memoizeMarkdownComponents({
ul: ({ className, ...props }) => (
<ul
className={cn(
- "aui-md-ul marker:text-muted-foreground my-3 ms-5 list-disc [&>li]:mt-1",
- className,
+ 'aui-md-ul marker:text-muted-foreground my-3 ms-5 list-disc [&>li]:mt-1',
+ className
)}
{...props}
/>
@@ -170,23 +148,20 @@ const defaultComponents = memoizeMarkdownComponents({
ol: ({ className, ...props }) => (
<ol
className={cn(
- "aui-md-ol marker:text-muted-foreground my-3 ms-5 list-decimal [&>li]:mt-1",
- className,
+ 'aui-md-ol marker:text-muted-foreground my-3 ms-5 list-decimal [&>li]:mt-1',
+ className
)}
{...props}
/>
),
hr: ({ className, ...props }) => (
- <hr
- className={cn("aui-md-hr border-muted-foreground/20 my-3", className)}
- {...props}
- />
+ <hr className={cn('aui-md-hr border-muted-foreground/20 my-3', className)} {...props} />
),
table: ({ className, ...props }) => (
<table
className={cn(
- "aui-md-table my-3 w-full border-separate border-spacing-0 overflow-y-auto",
- className,
+ 'aui-md-table my-3 w-full border-separate border-spacing-0 overflow-y-auto',
+ className
)}
{...props}
/>
@@ -194,8 +169,8 @@ const defaultComponents = memoizeMarkdownComponents({
th: ({ className, ...props }) => (
<th
className={cn(
- "aui-md-th bg-muted px-3 py-1.5 text-start font-medium first:rounded-ss-lg last:rounded-se-lg [[align=center]]:text-center [[align=right]]:text-right",
- className,
+ 'aui-md-th bg-muted px-3 py-1.5 text-start font-medium first:rounded-ss-lg last:rounded-se-lg [[align=center]]:text-center [[align=right]]:text-right',
+ className
)}
{...props}
/>
@@ -203,8 +178,8 @@ const defaultComponents = memoizeMarkdownComponents({
td: ({ className, ...props }) => (
<td
className={cn(
- "aui-md-td border-muted-foreground/20 border-s border-b px-3 py-1.5 text-start last:border-e [[align=center]]:text-center [[align=right]]:text-right",
- className,
+ 'aui-md-td border-muted-foreground/20 border-s border-b px-3 py-1.5 text-start last:border-e [[align=center]]:text-center [[align=right]]:text-right',
+ className
)}
{...props}
/>
@@ -212,32 +187,26 @@ const defaultComponents = memoizeMarkdownComponents({
tr: ({ className, ...props }) => (
<tr
className={cn(
- "aui-md-tr m-0 border-b p-0 first:border-t [&:last-child>td:first-child]:rounded-es-lg [&:last-child>td:last-child]:rounded-ee-lg",
- className,
+ 'aui-md-tr m-0 border-b p-0 first:border-t [&:last-child>td:first-child]:rounded-es-lg [&:last-child>td:last-child]:rounded-ee-lg',
+ className
)}
{...props}
/>
),
li: ({ className, ...props }) => (
- <li className={cn("aui-md-li leading-relaxed", className)} {...props} />
+ <li className={cn('aui-md-li leading-relaxed', className)} {...props} />
),
strong: ({ className, ...props }) => (
- <strong
- className={cn("aui-md-strong font-semibold", className)}
- {...props}
- />
+ <strong className={cn('aui-md-strong font-semibold', className)} {...props} />
),
sup: ({ className, ...props }) => (
- <sup
- className={cn("aui-md-sup [&>a]:text-xs [&>a]:no-underline", className)}
- {...props}
- />
+ <sup className={cn('aui-md-sup [&>a]:text-xs [&>a]:no-underline', className)} {...props} />
),
pre: ({ className, ...props }) => (
<pre
className={cn(
- "aui-md-pre border-border/50 bg-muted/30 overflow-x-auto rounded-t-none rounded-b-xl border border-t-0 p-3.5 text-[13px] leading-relaxed",
- className,
+ 'aui-md-pre border-border/50 bg-muted/30 overflow-x-auto rounded-t-none rounded-b-xl border border-t-0 p-3.5 text-[13px] leading-relaxed',
+ className
)}
{...props}
/>
@@ -248,8 +217,8 @@ const defaultComponents = memoizeMarkdownComponents({
<code
className={cn(
!isCodeBlock &&
- "aui-md-inline-code bg-muted rounded-md px-1.5 py-0.5 font-mono text-[0.85em]",
- className,
+ 'aui-md-inline-code bg-muted rounded-md px-1.5 py-0.5 font-mono text-[0.85em]',
+ className
)}
{...props}
/>
diff --git a/app/src/components/assistant-ui/message-timing.tsx b/app/src/components/assistant-ui/message-timing.tsx
index 984876ac48..2d4ca22f10 100644
--- a/app/src/components/assistant-ui/message-timing.tsx
+++ b/app/src/components/assistant-ui/message-timing.tsx
@@ -1,17 +1,17 @@
-"use client";
+'use client';
-import { useMessageTiming } from "@assistant-ui/react";
+import { cn } from '@/components/assistant-ui/lib/utils';
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
-} from "@/components/assistant-ui/ui/tooltip";
-import { cn } from "@/components/assistant-ui/lib/utils";
-import type { FC } from "react";
+} from '@/components/assistant-ui/ui/tooltip';
+import { useMessageTiming } from '@assistant-ui/react';
+import type { FC } from 'react';
const formatTimingMs = (ms: number | undefined): string => {
- if (ms === undefined) return "—";
+ if (ms === undefined) return '—';
if (ms < 1000) return `${Math.round(ms)}ms`;
return `${(ms / 1000).toFixed(2)}s`;
};
@@ -38,8 +38,8 @@ const formatTimingMs = (ms: number | undefined): string => {
*/
export const MessageTiming: FC<{
className?: string;
- side?: "top" | "right" | "bottom" | "left";
-}> = ({ className, side = "right" }) => {
+ side?: 'top' | 'right' | 'bottom' | 'left';
+}> = ({ className, side = 'right' }) => {
const timing = useMessageTiming();
if (timing?.totalStreamTime === undefined) return null;
@@ -53,20 +53,18 @@ export const MessageTiming: FC<{
data-slot="message-timing-trigger"
aria-label="Message timing"
className={cn(
- "text-muted-foreground hover:bg-accent hover:text-accent-foreground flex items-center rounded-md p-1 font-mono text-xs tabular-nums transition-colors",
- className,
+ 'text-muted-foreground hover:bg-accent hover:text-accent-foreground flex items-center rounded-md p-1 font-mono text-xs tabular-nums transition-colors',
+ className
)}
/>
- }
- >
+ }>
{formatTimingMs(timing.totalStreamTime)}
</TooltipTrigger>
<TooltipContent
side={side}
sideOffset={8}
data-slot="message-timing-popover"
- className="bg-popover text-popover-foreground rounded-lg border px-3 py-2 [&_span>svg]:hidden!"
- >
+ className="bg-popover text-popover-foreground rounded-lg border px-3 py-2 [&_span>svg]:hidden!">
<div className="grid min-w-35 gap-1.5 text-xs">
{timing.firstTokenTime !== undefined && (
<div className="flex items-center justify-between gap-4">
@@ -92,9 +90,7 @@ export const MessageTiming: FC<{
)}
<div className="flex items-center justify-between gap-4">
<span className="text-muted-foreground">Chunks</span>
- <span className="font-mono tabular-nums">
- {timing.totalChunks}
- </span>
+ <span className="font-mono tabular-nums">{timing.totalChunks}</span>
</div>
</div>
</TooltipContent>
diff --git a/app/src/components/assistant-ui/model-selector.tsx b/app/src/components/assistant-ui/model-selector.tsx
index 72ac1d6e44..5dccce2cda 100644
--- a/app/src/components/assistant-ui/model-selector.tsx
+++ b/app/src/components/assistant-ui/model-selector.tsx
@@ -1,26 +1,6 @@
-"use client";
+'use client';
-import {
- memo,
- useCallback,
- useEffect,
- useMemo,
- useRef,
- useState,
- createContext,
- useContext,
- type ComponentPropsWithoutRef,
- type ReactNode,
-} from "react";
-import { cva, type VariantProps } from "class-variance-authority";
-import { CheckIcon, ChevronDownIcon } from "lucide-react";
-import { useAui } from "@assistant-ui/react";
-import { cn } from "@/components/assistant-ui/lib/utils";
-import {
- Popover,
- PopoverContent,
- PopoverTrigger,
-} from "@/components/assistant-ui/ui/popover";
+import { cn } from '@/components/assistant-ui/lib/utils';
import {
Command,
CommandEmpty,
@@ -29,19 +9,32 @@ import {
CommandItem,
CommandList,
CommandSeparator,
-} from "@/components/assistant-ui/ui/command";
-import { RadioGroup } from "@base-ui/react/radio-group";
-import { Radio } from "@base-ui/react/radio";
+} from '@/components/assistant-ui/ui/command';
+import { Popover, PopoverContent, PopoverTrigger } from '@/components/assistant-ui/ui/popover';
+import { useAui } from '@assistant-ui/react';
+import { Radio } from '@base-ui/react/radio';
+import { RadioGroup } from '@base-ui/react/radio-group';
+import { cva, type VariantProps } from 'class-variance-authority';
+import { CheckIcon, ChevronDownIcon } from 'lucide-react';
+import {
+ type ComponentPropsWithoutRef,
+ createContext,
+ memo,
+ type ReactNode,
+ useCallback,
+ useContext,
+ useEffect,
+ useMemo,
+ useRef,
+ useState,
+} from 'react';
-export type ModelSelectorEffortOption = {
- id: string;
- name: string;
-};
+export type ModelSelectorEffortOption = { id: string; name: string };
export const DEFAULT_EFFORT_OPTIONS: readonly ModelSelectorEffortOption[] = [
- { id: "low", name: "Low" },
- { id: "medium", name: "Med" },
- { id: "high", name: "High" },
+ { id: 'low', name: 'Low' },
+ { id: 'medium', name: 'Med' },
+ { id: 'high', name: 'High' },
];
export type ModelOption = {
@@ -61,7 +54,7 @@ export type ModelOption = {
};
function getModelEfforts(
- model: ModelOption | undefined,
+ model: ModelOption | undefined
): readonly ModelSelectorEffortOption[] | undefined {
if (!model?.efforts) return undefined;
return model.efforts === true ? DEFAULT_EFFORT_OPTIONS : model.efforts;
@@ -69,10 +62,10 @@ function getModelEfforts(
function resolveEffort(
efforts: readonly ModelSelectorEffortOption[] | undefined,
- effort: string | undefined,
+ effort: string | undefined
): string | undefined {
if (effort === undefined) return undefined;
- return efforts?.some((e) => e.id === effort) ? effort : undefined;
+ return efforts?.some(e => e.id === effort) ? effort : undefined;
}
/**
@@ -83,12 +76,9 @@ function resolveEffort(
export function resolveModelEffort(
models: readonly ModelOption[],
modelId: string | undefined,
- effort: string | undefined,
+ effort: string | undefined
): string | undefined {
- return resolveEffort(
- getModelEfforts(models.find((m) => m.id === modelId)),
- effort,
- );
+ return resolveEffort(getModelEfforts(models.find(m => m.id === modelId)), effort);
}
function useControllableState<T>({
@@ -114,7 +104,7 @@ function useControllableState<T>({
if (!isControlled) setInternal(next);
onChangeRef.current?.(next);
},
- [isControlled],
+ [isControlled]
);
return [value, setValue] as const;
}
@@ -133,16 +123,12 @@ type ModelSelectorContextValue = {
setOpen: (open: boolean) => void;
};
-const ModelSelectorContext = createContext<ModelSelectorContextValue | null>(
- null,
-);
+const ModelSelectorContext = createContext<ModelSelectorContextValue | null>(null);
function useModelSelectorContext() {
const ctx = useContext(ModelSelectorContext);
if (!ctx) {
- throw new Error(
- "ModelSelector sub-components must be used within ModelSelector.Root",
- );
+ throw new Error('ModelSelector sub-components must be used within ModelSelector.Root');
}
return ctx;
}
@@ -205,7 +191,7 @@ function ModelSelectorRoot({
onChange: onOpenChange,
});
- const selectedModel = models.find((m) => m.id === value);
+ const selectedModel = models.find(m => m.id === value);
const efforts = getModelEfforts(selectedModel);
const activeEffort = resolveEffort(efforts, effort);
const contextValue = useMemo(
@@ -219,16 +205,7 @@ function ModelSelectorRoot({
setEffort,
setOpen,
}),
- [
- models,
- value,
- setValue,
- selectedModel,
- efforts,
- activeEffort,
- setEffort,
- setOpen,
- ],
+ [models, value, setValue, selectedModel, efforts, activeEffort, setEffort, setOpen]
);
return (
@@ -245,27 +222,17 @@ export const modelSelectorTriggerVariants = cva(
{
variants: {
variant: {
- outline:
- "border-input hover:bg-accent hover:text-accent-foreground border bg-transparent",
- ghost: "hover:bg-accent hover:text-accent-foreground",
- muted: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
- },
- size: {
- default: "h-9 px-3 py-2",
- sm: "h-8 px-2.5 py-1.5 text-xs",
- lg: "h-10 px-4 py-2.5",
+ outline: 'border-input hover:bg-accent hover:text-accent-foreground border bg-transparent',
+ ghost: 'hover:bg-accent hover:text-accent-foreground',
+ muted: 'bg-secondary text-secondary-foreground hover:bg-secondary/80',
},
+ size: { default: 'h-9 px-3 py-2', sm: 'h-8 px-2.5 py-1.5 text-xs', lg: 'h-10 px-4 py-2.5' },
},
- defaultVariants: {
- variant: "outline",
- size: "default",
- },
- },
+ defaultVariants: { variant: 'outline', size: 'default' },
+ }
);
-export type ModelSelectorTriggerProps = ComponentPropsWithoutRef<
- typeof PopoverTrigger
-> &
+export type ModelSelectorTriggerProps = ComponentPropsWithoutRef<typeof PopoverTrigger> &
VariantProps<typeof modelSelectorTriggerVariants>;
function ModelSelectorTrigger({
@@ -281,23 +248,22 @@ function ModelSelectorTrigger({
return (
<PopoverTrigger
data-slot="model-selector-trigger"
- data-variant={variant ?? "outline"}
- data-size={size ?? "default"}
+ data-variant={variant ?? 'outline'}
+ data-size={size ?? 'default'}
role="combobox"
aria-haspopup="listbox"
className={cn(modelSelectorTriggerVariants({ variant, size }), className)}
- onKeyDown={(e) => {
+ onKeyDown={e => {
onKeyDown?.(e);
if (e.defaultPrevented) return;
// ARIA combobox: arrows open the listbox from a focused trigger.
// Popover leaves this to the consumer.
- if (e.key === "ArrowDown" || e.key === "ArrowUp") {
+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
e.preventDefault();
setOpen(true);
}
}}
- {...props}
- >
+ {...props}>
{children ?? <ModelSelectorValue />}
<ChevronDownIcon className="size-4 opacity-50" />
</PopoverTrigger>
@@ -311,27 +277,20 @@ export type ModelSelectorValueProps = {
className?: string;
};
-function ModelIcon({
- children,
- className,
-}: {
- children: ReactNode;
- className?: string;
-}) {
+function ModelIcon({ children, className }: { children: ReactNode; className?: string }) {
return (
<span
className={cn(
- "flex size-3.5 shrink-0 items-center justify-center [&_svg]:size-3.5",
- className,
- )}
- >
+ 'flex size-3.5 shrink-0 items-center justify-center [&_svg]:size-3.5',
+ className
+ )}>
{children}
</span>
);
}
function ModelSelectorValue({
- placeholder = "Select model",
+ placeholder = 'Select model',
showEffort = true,
className,
}: ModelSelectorValueProps) {
@@ -339,31 +298,23 @@ function ModelSelectorValue({
if (!selectedModel) {
return (
- <span
- data-slot="model-selector-value"
- className={cn("text-muted-foreground", className)}
- >
+ <span data-slot="model-selector-value" className={cn('text-muted-foreground', className)}>
{placeholder}
</span>
);
}
const effortName =
- showEffort && effort !== undefined
- ? efforts?.find((e) => e.id === effort)?.name
- : undefined;
+ showEffort && effort !== undefined ? efforts?.find(e => e.id === effort)?.name : undefined;
return (
<span
data-slot="model-selector-value"
- className={cn("flex min-w-0 items-center gap-2", className)}
- >
+ className={cn('flex min-w-0 items-center gap-2', className)}>
{selectedModel.icon && <ModelIcon>{selectedModel.icon}</ModelIcon>}
<span className="truncate font-medium">{selectedModel.name}</span>
{effortName && (
- <span className="text-muted-foreground min-w-7.5 truncate text-center">
- {effortName}
- </span>
+ <span className="text-muted-foreground min-w-7.5 truncate text-center">{effortName}</span>
)}
</span>
);
@@ -371,14 +322,14 @@ function ModelSelectorValue({
export type ModelSelectorContentProps = Omit<
ComponentPropsWithoutRef<typeof PopoverContent>,
- "side"
+ 'side'
> & {
/**
* Preferred side for the initial placement. Once the popover is open, the
* rendered side takes over until it closes, so the popup does not jump
* between sides while filtering resizes the list.
*/
- side?: ComponentPropsWithoutRef<typeof PopoverContent>["side"];
+ side?: ComponentPropsWithoutRef<typeof PopoverContent>['side'];
searchable?: boolean;
};
@@ -388,10 +339,10 @@ export type ModelSelectorContentProps = Omit<
// Combobox positioner, so mirror it here: feed the rendered side back as the
// preferred side, making the popup keep its side until it no longer fits.
function useLazyFlipSide(): {
- side: ModelSelectorContentProps["side"];
+ side: ModelSelectorContentProps['side'];
popupRef: (node: HTMLDivElement | null) => void;
} {
- const [side, setSide] = useState<ModelSelectorContentProps["side"]>();
+ const [side, setSide] = useState<ModelSelectorContentProps['side']>();
const observerRef = useRef<MutationObserver | null>(null);
const popupRef = useCallback((node: HTMLDivElement | null) => {
observerRef.current?.disconnect();
@@ -401,15 +352,12 @@ function useLazyFlipSide(): {
return;
}
const sync = () => {
- const rendered = node.getAttribute("data-side");
- if (rendered) setSide(rendered as ModelSelectorContentProps["side"]);
+ const rendered = node.getAttribute('data-side');
+ if (rendered) setSide(rendered as ModelSelectorContentProps['side']);
};
sync();
const observer = new MutationObserver(sync);
- observer.observe(node, {
- attributes: true,
- attributeFilter: ["data-side"],
- });
+ observer.observe(node, { attributes: true, attributeFilter: ['data-side'] });
observerRef.current = observer;
}, []);
return { side, popupRef };
@@ -430,7 +378,7 @@ function ModelSelectorFocusAnchor() {
function ModelSelectorContent({
className,
- align = "start",
+ align = 'start',
side,
sideOffset = 6,
searchable,
@@ -439,27 +387,24 @@ function ModelSelectorContent({
}: ModelSelectorContentProps) {
const { value } = useModelSelectorContext();
const { side: renderedSide, popupRef } = useLazyFlipSide();
- const unfiltered =
- searchable === false || (!searchable && children === undefined);
+ const unfiltered = searchable === false || (!searchable && children === undefined);
return (
<PopoverContent
ref={popupRef}
data-slot="model-selector-content"
align={align}
- side={renderedSide ?? side ?? "bottom"}
+ side={renderedSide ?? side ?? 'bottom'}
sideOffset={sideOffset}
className={cn(
- "bg-popover w-72 min-w-(--anchor-width) overflow-hidden rounded-xl p-0",
- className,
+ 'bg-popover w-72 min-w-(--anchor-width) overflow-hidden rounded-xl p-0',
+ className
)}
- {...props}
- >
+ {...props}>
<Command
className="bg-transparent"
shouldFilter={!unfiltered}
- {...(value !== undefined ? { defaultValue: value } : {})}
- >
+ {...(value !== undefined ? { defaultValue: value } : {})}>
{unfiltered && <ModelSelectorFocusAnchor />}
{children ?? (
<>
@@ -473,48 +418,33 @@ function ModelSelectorContent({
);
}
-export type ModelSelectorSearchProps = ComponentPropsWithoutRef<
- typeof CommandInput
->;
+export type ModelSelectorSearchProps = ComponentPropsWithoutRef<typeof CommandInput>;
function ModelSelectorSearch({
- placeholder = "Search models...",
+ placeholder = 'Search models...',
...props
}: ModelSelectorSearchProps) {
- return (
- <CommandInput
- data-slot="model-selector-search"
- placeholder={placeholder}
- {...props}
- />
- );
+ return <CommandInput data-slot="model-selector-search" placeholder={placeholder} {...props} />;
}
-export type ModelSelectorListProps = ComponentPropsWithoutRef<
- typeof CommandList
->;
+export type ModelSelectorListProps = ComponentPropsWithoutRef<typeof CommandList>;
-function ModelSelectorList({
- className,
- children,
- ...props
-}: ModelSelectorListProps) {
+function ModelSelectorList({ className, children, ...props }: ModelSelectorListProps) {
const { models } = useModelSelectorContext();
return (
<CommandList
data-slot="model-selector-list"
className={cn(
- "[-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
- className,
+ '[-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden',
+ className
)}
- {...props}
- >
+ {...props}>
{children ?? (
<>
<ModelSelectorEmpty />
<CommandGroup>
- {models.map((model) => (
+ {models.map(model => (
<ModelSelectorItem key={model.id} model={model} />
))}
</CommandGroup>
@@ -524,38 +454,29 @@ function ModelSelectorList({
);
}
-export type ModelSelectorEmptyProps = ComponentPropsWithoutRef<
- typeof CommandEmpty
->;
+export type ModelSelectorEmptyProps = ComponentPropsWithoutRef<typeof CommandEmpty>;
function ModelSelectorEmpty({ children, ...props }: ModelSelectorEmptyProps) {
return (
<CommandEmpty data-slot="model-selector-empty" {...props}>
- {children ?? "No models found."}
+ {children ?? 'No models found.'}
</CommandEmpty>
);
}
-export type ModelSelectorGroupProps = ComponentPropsWithoutRef<
- typeof CommandGroup
->;
+export type ModelSelectorGroupProps = ComponentPropsWithoutRef<typeof CommandGroup>;
function ModelSelectorGroup(props: ModelSelectorGroupProps) {
return <CommandGroup data-slot="model-selector-group" {...props} />;
}
-export type ModelSelectorSeparatorProps = ComponentPropsWithoutRef<
- typeof CommandSeparator
->;
+export type ModelSelectorSeparatorProps = ComponentPropsWithoutRef<typeof CommandSeparator>;
function ModelSelectorSeparator(props: ModelSelectorSeparatorProps) {
return <CommandSeparator data-slot="model-selector-separator" {...props} />;
}
-export type ModelSelectorItemProps = Omit<
- ComponentPropsWithoutRef<typeof CommandItem>,
- "value"
-> & {
+export type ModelSelectorItemProps = Omit<ComponentPropsWithoutRef<typeof CommandItem>, 'value'> & {
model: ModelOption;
};
@@ -575,28 +496,23 @@ function ModelSelectorItem({
value={model.id}
keywords={[model.name, ...(model.keywords ?? [])]}
{...(model.disabled ? { disabled: true } : undefined)}
- onSelect={(selectedValue) => {
+ onSelect={selectedValue => {
setValue(model.id);
setOpen(false);
onSelect?.(selectedValue);
}}
className={cn(
"relative items-start gap-2 rounded-lg py-2 ps-3 pe-9 [&_svg:not([class*='size-'])]:size-3.5",
- className,
+ className
)}
- {...props}
- >
+ {...props}>
{children ?? (
<>
- {model.icon && (
- <ModelIcon className="mt-[3px]">{model.icon}</ModelIcon>
- )}
+ {model.icon && <ModelIcon className="mt-[3px]">{model.icon}</ModelIcon>}
<span className="flex min-w-0 flex-col">
<span className="truncate font-medium">{model.name}</span>
{model.description && (
- <span className="text-muted-foreground truncate text-xs">
- {model.description}
- </span>
+ <span className="text-muted-foreground truncate text-xs">{model.description}</span>
)}
</span>
</>
@@ -610,12 +526,10 @@ function ModelSelectorItem({
);
}
-export type ModelSelectorEffortProps = ComponentPropsWithoutRef<"div"> & {
- label?: ReactNode;
-};
+export type ModelSelectorEffortProps = ComponentPropsWithoutRef<'div'> & { label?: ReactNode };
function ModelSelectorEffort({
- label = "Thinking",
+ label = 'Thinking',
className,
onKeyDown,
onKeyDownCapture,
@@ -629,13 +543,13 @@ function ModelSelectorEffort({
<div
data-slot="model-selector-effort"
className={cn(
- "flex cursor-default items-center justify-between gap-3 border-t px-3 py-2",
- className,
+ 'flex cursor-default items-center justify-between gap-3 border-t px-3 py-2',
+ className
)}
- onKeyDownCapture={(e) => {
+ onKeyDownCapture={e => {
onKeyDownCapture?.(e);
if (e.defaultPrevented) return;
- if (e.key !== "ArrowUp" && e.key !== "ArrowDown") return;
+ if (e.key !== 'ArrowUp' && e.key !== 'ArrowDown') return;
// Base UI's RadioGroup composite claims vertical arrows for roving
// focus (orientation "both", not configurable), so intercept them in
// capture and hand the keypress to cmdk: the model list owns vertical
@@ -643,50 +557,45 @@ function ModelSelectorEffort({
onKeyDown?.(e);
if (e.defaultPrevented) return;
const input = e.currentTarget
- .closest("[cmdk-root]")
- ?.querySelector<HTMLInputElement>("[cmdk-input]");
+ .closest('[cmdk-root]')
+ ?.querySelector<HTMLInputElement>('[cmdk-input]');
if (!input) return;
e.preventDefault();
e.stopPropagation();
input.focus();
- input.dispatchEvent(new KeyboardEvent("keydown", e.nativeEvent));
+ input.dispatchEvent(new KeyboardEvent('keydown', e.nativeEvent));
}}
- onKeyDown={(e) => {
- if (e.key === "ArrowUp" || e.key === "ArrowDown") return;
+ onKeyDown={e => {
+ if (e.key === 'ArrowUp' || e.key === 'ArrowDown') return;
onKeyDown?.(e);
if (e.defaultPrevented) return;
// Base UI's radio composite ignores Home/End and cmdk's Command
// root would claim them to jump the model list; move radio focus
// here so only the radiogroup reacts.
- if (e.key === "Home" || e.key === "End") {
+ if (e.key === 'Home' || e.key === 'End') {
e.preventDefault();
e.stopPropagation();
const radios = Array.from(
- e.currentTarget.querySelectorAll<HTMLElement>(
- '[role="radio"]:not([data-disabled])',
- ),
+ e.currentTarget.querySelectorAll<HTMLElement>('[role="radio"]:not([data-disabled])')
);
- (e.key === "Home" ? radios[0] : radios[radios.length - 1])?.focus();
+ (e.key === 'Home' ? radios[0] : radios[radios.length - 1])?.focus();
}
}}
- {...props}
- >
+ {...props}>
<span className="text-muted-foreground text-xs">{label}</span>
<RadioGroup
- value={effort ?? ""}
+ value={effort ?? ''}
onValueChange={setEffort}
- aria-label={typeof label === "string" ? label : "Reasoning effort"}
- className="flex items-center gap-0.5"
- >
- {efforts.map((option) => (
+ aria-label={typeof label === 'string' ? label : 'Reasoning effort'}
+ className="flex items-center gap-0.5">
+ {efforts.map(option => (
<Radio.Root
key={option.id}
value={option.id}
className={cn(
- "focus-visible:ring-ring/50 text-muted-foreground hover:text-foreground rounded-md px-2 py-1 text-xs transition-colors outline-none focus-visible:ring-1",
- "data-checked:bg-accent data-checked:text-accent-foreground data-checked:font-medium",
- )}
- >
+ 'focus-visible:ring-ring/50 text-muted-foreground hover:text-foreground rounded-md px-2 py-1 text-xs transition-colors outline-none focus-visible:ring-1',
+ 'data-checked:bg-accent data-checked:text-accent-foreground data-checked:font-medium'
+ )}>
{option.name}
</Radio.Root>
))}
@@ -695,13 +604,13 @@ function ModelSelectorEffort({
);
}
-export type ModelSelectorProps = Omit<ModelSelectorRootProps, "children"> &
+export type ModelSelectorProps = Omit<ModelSelectorRootProps, 'children'> &
VariantProps<typeof modelSelectorTriggerVariants> & {
/** Render a search input above the model list. */
searchable?: boolean;
/** Alignment of the dropdown relative to the trigger. Use `"end"` when the
* trigger sits at the right edge of its container. */
- align?: ModelSelectorContentProps["align"];
+ align?: ModelSelectorContentProps['align'];
className?: string;
contentClassName?: string;
};
@@ -720,9 +629,7 @@ function ModelSelectorModelContext() {
...(effort !== undefined ? { reasoningEffort: effort } : undefined),
},
};
- return api.modelContext.register({
- getModelContext: () => config,
- });
+ return api.modelContext.register({ getModelContext: () => config });
}, [api, value, effort]);
return null;
@@ -740,11 +647,7 @@ const ModelSelectorImpl = ({
return (
<ModelSelectorRoot {...rootProps}>
<ModelSelectorModelContext />
- <ModelSelectorTrigger
- variant={variant}
- size={size}
- className={className}
- />
+ <ModelSelectorTrigger variant={variant} size={size} className={className} />
<ModelSelectorContent
{...(align !== undefined ? { align } : {})}
className={contentClassName}
@@ -770,11 +673,9 @@ type ModelSelectorComponent = typeof ModelSelectorImpl & {
Effort: typeof ModelSelectorEffort;
};
-const ModelSelector = memo(
- ModelSelectorImpl,
-) as unknown as ModelSelectorComponent;
+const ModelSelector = memo(ModelSelectorImpl) as unknown as ModelSelectorComponent;
-ModelSelector.displayName = "ModelSelector";
+ModelSelector.displayName = 'ModelSelector';
ModelSelector.Root = ModelSelectorRoot;
ModelSelector.Trigger = ModelSelectorTrigger;
ModelSelector.Value = ModelSelectorValue;
diff --git a/app/src/components/assistant-ui/quote.tsx b/app/src/components/assistant-ui/quote.tsx
index 76bf512e3f..4e67f94f3b 100644
--- a/app/src/components/assistant-ui/quote.tsx
+++ b/app/src/components/assistant-ui/quote.tsx
@@ -1,48 +1,39 @@
-"use client";
+'use client';
-import { memo, type ComponentProps, type FC } from "react";
+import { cn } from '@/components/assistant-ui/lib/utils';
import {
ComposerPrimitive,
type QuoteMessagePartComponent,
SelectionToolbarPrimitive,
-} from "@assistant-ui/react";
-import { QuoteIcon, XIcon } from "lucide-react";
-import { cn } from "@/components/assistant-ui/lib/utils";
+} from '@assistant-ui/react';
+import { QuoteIcon, XIcon } from 'lucide-react';
+import { type ComponentProps, type FC, memo } from 'react';
-function QuoteBlockRoot({ className, ...props }: ComponentProps<"div">) {
+function QuoteBlockRoot({ className, ...props }: ComponentProps<'div'>) {
return (
<div
data-slot="quote-block"
- className={cn("mb-2 flex items-start gap-1.5", className)}
+ className={cn('mb-2 flex items-start gap-1.5', className)}
{...props}
/>
);
}
-function QuoteBlockIcon({
- className,
- ...props
-}: ComponentProps<typeof QuoteIcon>) {
+function QuoteBlockIcon({ className, ...props }: ComponentProps<typeof QuoteIcon>) {
return (
<QuoteIcon
data-slot="quote-block-icon"
- className={cn(
- "text-muted-foreground/60 mt-0.5 size-3 shrink-0",
- className,
- )}
+ className={cn('text-muted-foreground/60 mt-0.5 size-3 shrink-0', className)}
{...props}
/>
);
}
-function QuoteBlockText({ className, ...props }: ComponentProps<"p">) {
+function QuoteBlockText({ className, ...props }: ComponentProps<'p'>) {
return (
<p
data-slot="quote-block-text"
- className={cn(
- "text-muted-foreground/80 line-clamp-2 min-w-0 text-sm italic",
- className,
- )}
+ className={cn('text-muted-foreground/80 line-clamp-2 min-w-0 text-sm italic', className)}
{...props}
/>
);
@@ -69,15 +60,13 @@ const QuoteBlockImpl: QuoteMessagePartComponent = ({ text }) => {
);
};
-const QuoteBlock = memo(
- QuoteBlockImpl,
-) as unknown as QuoteMessagePartComponent & {
+const QuoteBlock = memo(QuoteBlockImpl) as unknown as QuoteMessagePartComponent & {
Root: typeof QuoteBlockRoot;
Icon: typeof QuoteBlockIcon;
Text: typeof QuoteBlockText;
};
-QuoteBlock.displayName = "QuoteBlock";
+QuoteBlock.displayName = 'QuoteBlock';
QuoteBlock.Root = QuoteBlockRoot;
QuoteBlock.Icon = QuoteBlockIcon;
QuoteBlock.Text = QuoteBlockText;
@@ -89,10 +78,7 @@ function SelectionToolbarRoot({
return (
<SelectionToolbarPrimitive.Root
data-slot="selection-toolbar"
- className={cn(
- "bg-popover flex items-center gap-1 rounded-lg border px-1 py-1",
- className,
- )}
+ className={cn('bg-popover flex items-center gap-1 rounded-lg border px-1 py-1', className)}
{...props}
/>
);
@@ -107,11 +93,10 @@ function SelectionToolbarQuote({
<SelectionToolbarPrimitive.Quote
data-slot="selection-toolbar-quote"
className={cn(
- "text-popover-foreground hover:bg-accent flex items-center gap-1.5 rounded-md px-2.5 py-1 text-sm transition-colors",
- className,
+ 'text-popover-foreground hover:bg-accent flex items-center gap-1.5 rounded-md px-2.5 py-1 text-sm transition-colors',
+ className
)}
- {...props}
- >
+ {...props}>
{children ?? (
<>
<QuoteIcon className="size-3.5" />
@@ -146,14 +131,12 @@ const SelectionToolbarImpl: FC<ComponentProps<typeof SelectionToolbarRoot>> = ({
);
};
-const SelectionToolbar = memo(
- SelectionToolbarImpl,
-) as unknown as typeof SelectionToolbarImpl & {
+const SelectionToolbar = memo(SelectionToolbarImpl) as unknown as typeof SelectionToolbarImpl & {
Root: typeof SelectionToolbarRoot;
Quote: typeof SelectionToolbarQuote;
};
-SelectionToolbar.displayName = "SelectionToolbar";
+SelectionToolbar.displayName = 'SelectionToolbar';
SelectionToolbar.Root = SelectionToolbarRoot;
SelectionToolbar.Quote = SelectionToolbarQuote;
@@ -164,26 +147,17 @@ function ComposerQuotePreviewRoot({
return (
<ComposerPrimitive.Quote
data-slot="composer-quote"
- className={cn(
- "bg-muted/60 mx-3 mt-2 flex items-start gap-2 rounded-lg px-3 py-2",
- className,
- )}
+ className={cn('bg-muted/60 mx-3 mt-2 flex items-start gap-2 rounded-lg px-3 py-2', className)}
{...props}
/>
);
}
-function ComposerQuotePreviewIcon({
- className,
- ...props
-}: ComponentProps<typeof QuoteIcon>) {
+function ComposerQuotePreviewIcon({ className, ...props }: ComponentProps<typeof QuoteIcon>) {
return (
<QuoteIcon
data-slot="composer-quote-icon"
- className={cn(
- "text-muted-foreground/70 mt-0.5 size-3.5 shrink-0",
- className,
- )}
+ className={cn('text-muted-foreground/70 mt-0.5 size-3.5 shrink-0', className)}
{...props}
/>
);
@@ -196,10 +170,7 @@ function ComposerQuotePreviewText({
return (
<ComposerPrimitive.QuoteText
data-slot="composer-quote-text"
- className={cn(
- "text-muted-foreground line-clamp-2 min-w-0 flex-1 text-sm",
- className,
- )}
+ className={cn('text-muted-foreground line-clamp-2 min-w-0 flex-1 text-sm', className)}
{...props}
/>
);
@@ -211,20 +182,18 @@ function ComposerQuotePreviewDismiss({
...props
}: ComponentProps<typeof ComposerPrimitive.QuoteDismiss>) {
const defaultClassName =
- "shrink-0 rounded-sm p-0.5 text-muted-foreground/70 transition-colors hover:bg-accent hover:text-foreground";
+ 'shrink-0 rounded-sm p-0.5 text-muted-foreground/70 transition-colors hover:bg-accent hover:text-foreground';
return (
<ComposerPrimitive.QuoteDismiss
data-slot="composer-quote-dismiss"
className={children ? className : undefined}
- {...props}
- >
+ {...props}>
{children ?? (
<button
type="button"
aria-label="Dismiss quote"
- className={cn(defaultClassName, className)}
- >
+ className={cn(defaultClassName, className)}>
<XIcon className="size-3.5" />
</button>
)}
@@ -246,9 +215,10 @@ function ComposerQuotePreviewDismiss({
* </ComposerPrimitive.Root>
* ```
*/
-const ComposerQuotePreviewImpl: FC<
- ComponentProps<typeof ComposerQuotePreviewRoot>
-> = ({ className, ...props }) => {
+const ComposerQuotePreviewImpl: FC<ComponentProps<typeof ComposerQuotePreviewRoot>> = ({
+ className,
+ ...props
+}) => {
return (
<ComposerQuotePreviewRoot className={className} {...props}>
<ComposerQuotePreviewIcon />
@@ -259,7 +229,7 @@ const ComposerQuotePreviewImpl: FC<
};
const ComposerQuotePreview = memo(
- ComposerQuotePreviewImpl,
+ ComposerQuotePreviewImpl
) as unknown as typeof ComposerQuotePreviewImpl & {
Root: typeof ComposerQuotePreviewRoot;
Icon: typeof ComposerQuotePreviewIcon;
@@ -267,7 +237,7 @@ const ComposerQuotePreview = memo(
Dismiss: typeof ComposerQuotePreviewDismiss;
};
-ComposerQuotePreview.displayName = "ComposerQuotePreview";
+ComposerQuotePreview.displayName = 'ComposerQuotePreview';
ComposerQuotePreview.Root = ComposerQuotePreviewRoot;
ComposerQuotePreview.Icon = ComposerQuotePreviewIcon;
ComposerQuotePreview.Text = ComposerQuotePreviewText;
diff --git a/app/src/components/assistant-ui/reasoning.tsx b/app/src/components/assistant-ui/reasoning.tsx
index 1fe4da26b3..e6c7c4edfa 100644
--- a/app/src/components/assistant-ui/reasoning.tsx
+++ b/app/src/components/assistant-ui/reasoning.tsx
@@ -1,5 +1,20 @@
-"use client";
+'use client';
+import { cn } from '@/components/assistant-ui/lib/utils';
+import { MarkdownText } from '@/components/assistant-ui/markdown-text';
+import {
+ Collapsible,
+ CollapsibleContent,
+ CollapsibleTrigger,
+} from '@/components/assistant-ui/ui/collapsible';
+import {
+ type ReasoningGroupComponent,
+ type ReasoningMessagePartComponent,
+ useAuiState,
+ useScrollLock,
+} from '@assistant-ui/react';
+import { cva, type VariantProps } from 'class-variance-authority';
+import { BrainIcon, ChevronDownIcon } from 'lucide-react';
import {
createContext,
memo,
@@ -9,43 +24,26 @@ import {
useLayoutEffect,
useRef,
useState,
-} from "react";
-import { cva, type VariantProps } from "class-variance-authority";
-import { BrainIcon, ChevronDownIcon } from "lucide-react";
-import {
- useScrollLock,
- useAuiState,
- type ReasoningMessagePartComponent,
- type ReasoningGroupComponent,
-} from "@assistant-ui/react";
-import { MarkdownText } from "@/components/assistant-ui/markdown-text";
-import {
- Collapsible,
- CollapsibleContent,
- CollapsibleTrigger,
-} from "@/components/assistant-ui/ui/collapsible";
-import { cn } from "@/components/assistant-ui/lib/utils";
+} from 'react';
const ANIMATION_DURATION = 200;
const ReasoningPreviewContext = createContext(false);
-const reasoningVariants = cva("aui-reasoning-root mb-4 w-full", {
+const reasoningVariants = cva('aui-reasoning-root mb-4 w-full', {
variants: {
variant: {
- outline: "rounded-lg border px-3 py-2",
- ghost: "",
- muted: "bg-muted/50 rounded-lg px-3 py-2",
+ outline: 'rounded-lg border px-3 py-2',
+ ghost: '',
+ muted: 'bg-muted/50 rounded-lg px-3 py-2',
},
},
- defaultVariants: {
- variant: "outline",
- },
+ defaultVariants: { variant: 'outline' },
});
export type ReasoningRootProps = Omit<
React.ComponentProps<typeof Collapsible>,
- "open" | "onOpenChange"
+ 'open' | 'onOpenChange'
> &
VariantProps<typeof reasoningVariants> & {
open?: boolean;
@@ -103,7 +101,7 @@ function ReasoningRoot({
}
controlledOnOpenChange?.(open);
},
- [lockScroll, isControlled, controlledOnOpenChange],
+ [lockScroll, isControlled, controlledOnOpenChange]
);
return (
@@ -113,17 +111,9 @@ function ReasoningRoot({
data-variant={variant}
open={isOpen}
onOpenChange={handleOpenChange}
- className={cn(
- "group/reasoning-root",
- reasoningVariants({ variant, className }),
- )}
- style={
- {
- "--animation-duration": `${ANIMATION_DURATION}ms`,
- } as React.CSSProperties
- }
- {...props}
- >
+ className={cn('group/reasoning-root', reasoningVariants({ variant, className }))}
+ style={{ '--animation-duration': `${ANIMATION_DURATION}ms` } as React.CSSProperties}
+ {...props}>
<ReasoningPreviewContext.Provider value={isPreview}>
{children}
</ReasoningPreviewContext.Provider>
@@ -132,21 +122,21 @@ function ReasoningRoot({
}
function ReasoningFade({
- side = "bottom",
+ side = 'bottom',
className,
...props
-}: React.ComponentProps<"div"> & { side?: "top" | "bottom" }) {
- if (side === "top") {
+}: React.ComponentProps<'div'> & { side?: 'top' | 'bottom' }) {
+ if (side === 'top') {
return (
<div
data-slot="reasoning-fade"
className={cn(
- "aui-reasoning-fade pointer-events-none absolute inset-x-0 top-0 z-10 h-8",
- "bg-[linear-gradient(to_bottom,var(--color-background),transparent)]",
- "group-data-[variant=muted]/reasoning-root:bg-[linear-gradient(to_bottom,color-mix(in_oklab,var(--color-muted)_50%,var(--color-background)),transparent)]",
- "fade-in-0 animate-in",
- "animation-duration-(--animation-duration)",
- className,
+ 'aui-reasoning-fade pointer-events-none absolute inset-x-0 top-0 z-10 h-8',
+ 'bg-[linear-gradient(to_bottom,var(--color-background),transparent)]',
+ 'group-data-[variant=muted]/reasoning-root:bg-[linear-gradient(to_bottom,color-mix(in_oklab,var(--color-muted)_50%,var(--color-background)),transparent)]',
+ 'fade-in-0 animate-in',
+ 'animation-duration-(--animation-duration)',
+ className
)}
{...props}
/>
@@ -157,12 +147,12 @@ function ReasoningFade({
<div
data-slot="reasoning-fade"
className={cn(
- "aui-reasoning-fade pointer-events-none absolute inset-x-0 bottom-0 z-10 h-8",
- "bg-[linear-gradient(to_top,var(--color-background),transparent)]",
- "group-data-[variant=muted]/reasoning-root:bg-[linear-gradient(to_top,color-mix(in_oklab,var(--color-muted)_50%,var(--color-background)),transparent)]",
- "fade-in-0 animate-in",
- "animation-duration-(--animation-duration)",
- className,
+ 'aui-reasoning-fade pointer-events-none absolute inset-x-0 bottom-0 z-10 h-8',
+ 'bg-[linear-gradient(to_top,var(--color-background),transparent)]',
+ 'group-data-[variant=muted]/reasoning-root:bg-[linear-gradient(to_top,color-mix(in_oklab,var(--color-muted)_50%,var(--color-background)),transparent)]',
+ 'fade-in-0 animate-in',
+ 'animation-duration-(--animation-duration)',
+ className
)}
{...props}
/>
@@ -174,36 +164,30 @@ function ReasoningTrigger({
duration,
className,
...props
-}: React.ComponentProps<typeof CollapsibleTrigger> & {
- active?: boolean;
- duration?: number;
-}) {
- const durationText = duration ? ` (${duration}s)` : "";
+}: React.ComponentProps<typeof CollapsibleTrigger> & { active?: boolean; duration?: number }) {
+ const durationText = duration ? ` (${duration}s)` : '';
return (
<CollapsibleTrigger
data-slot="reasoning-trigger"
className={cn(
- "aui-reasoning-trigger group/trigger text-muted-foreground hover:text-foreground flex max-w-[75%] origin-left items-center gap-2 py-1.5 text-sm transition-[color,scale] active:scale-[0.98]",
- className,
+ 'aui-reasoning-trigger group/trigger text-muted-foreground hover:text-foreground flex max-w-[75%] origin-left items-center gap-2 py-1.5 text-sm transition-[color,scale] active:scale-[0.98]',
+ className
)}
- {...props}
- >
+ {...props}>
<BrainIcon
data-slot="reasoning-trigger-icon"
className="aui-reasoning-trigger-icon size-4 shrink-0"
/>
<span
data-slot="reasoning-trigger-label"
- className="aui-reasoning-trigger-label-wrapper relative inline-block leading-none tabular-nums"
- >
+ className="aui-reasoning-trigger-label-wrapper relative inline-block leading-none tabular-nums">
<span>Reasoning{durationText}</span>
{active ? (
<span
aria-hidden
data-slot="reasoning-trigger-shimmer"
- className="aui-reasoning-trigger-shimmer shimmer pointer-events-none absolute inset-0 motion-reduce:animate-none"
- >
+ className="aui-reasoning-trigger-shimmer shimmer pointer-events-none absolute inset-0 motion-reduce:animate-none">
Reasoning{durationText}
</span>
) : null}
@@ -211,11 +195,11 @@ function ReasoningTrigger({
<ChevronDownIcon
data-slot="reasoning-trigger-chevron"
className={cn(
- "aui-reasoning-trigger-chevron mt-0.5 size-4 shrink-0",
- "transition-transform duration-(--animation-duration) ease-[cubic-bezier(0.32,0.72,0,1)] motion-reduce:transition-none",
- "-rotate-90",
- "group-data-open/trigger:rotate-0",
- "group-data-panel-open/trigger:rotate-0",
+ 'aui-reasoning-trigger-chevron mt-0.5 size-4 shrink-0',
+ 'transition-transform duration-(--animation-duration) ease-[cubic-bezier(0.32,0.72,0,1)] motion-reduce:transition-none',
+ '-rotate-90',
+ 'group-data-open/trigger:rotate-0',
+ 'group-data-panel-open/trigger:rotate-0'
)}
/>
</CollapsibleTrigger>
@@ -233,17 +217,16 @@ function ReasoningContent({
<CollapsibleContent
data-slot="reasoning-content"
className={cn(
- "aui-reasoning-content text-muted-foreground relative overflow-hidden text-sm outline-hidden",
- "group/collapsible-content ease-[cubic-bezier(0.32,0.72,0,1)] motion-reduce:animate-none",
- "data-closed:animate-collapsible-up",
- "data-open:animate-collapsible-down",
- "data-closed:fill-mode-forwards",
- "data-closed:pointer-events-none",
- "[--tw-duration:var(--animation-duration)]",
- className,
+ 'aui-reasoning-content text-muted-foreground relative overflow-hidden text-sm outline-hidden',
+ 'group/collapsible-content ease-[cubic-bezier(0.32,0.72,0,1)] motion-reduce:animate-none',
+ 'data-closed:animate-collapsible-up',
+ 'data-open:animate-collapsible-down',
+ 'data-closed:fill-mode-forwards',
+ 'data-closed:pointer-events-none',
+ '[--tw-duration:var(--animation-duration)]',
+ className
)}
- {...props}
- >
+ {...props}>
<ReasoningFade side="top" />
{children}
{isPreview ? <ReasoningFade /> : null}
@@ -251,11 +234,7 @@ function ReasoningContent({
);
}
-function ReasoningText({
- className,
- children,
- ...props
-}: React.ComponentProps<"div">) {
+function ReasoningText({ className, children, ...props }: React.ComponentProps<'div'>) {
const isPreview = useContext(ReasoningPreviewContext);
const scrollRef = useRef<HTMLDivElement>(null);
const contentRef = useRef<HTMLDivElement>(null);
@@ -270,9 +249,8 @@ function ReasoningText({
let lastScrollTop = scrollEl.scrollTop;
let lastScrollHeight = scrollEl.scrollHeight;
const isAtBottom = () =>
- Math.abs(
- scrollEl.scrollHeight - scrollEl.scrollTop - scrollEl.clientHeight,
- ) <= 1 || scrollEl.scrollHeight <= scrollEl.clientHeight;
+ Math.abs(scrollEl.scrollHeight - scrollEl.scrollTop - scrollEl.clientHeight) <= 1 ||
+ scrollEl.scrollHeight <= scrollEl.clientHeight;
const pin = () => {
if (!pinned) return;
@@ -284,10 +262,7 @@ function ReasoningText({
const onScroll = () => {
if (isAtBottom()) {
pinned = true;
- } else if (
- scrollEl.scrollTop < lastScrollTop &&
- scrollEl.scrollHeight === lastScrollHeight
- ) {
+ } else if (scrollEl.scrollTop < lastScrollTop && scrollEl.scrollHeight === lastScrollHeight) {
pinned = false;
}
lastScrollTop = scrollEl.scrollTop;
@@ -295,11 +270,11 @@ function ReasoningText({
};
pin();
- scrollEl.addEventListener("scroll", onScroll);
+ scrollEl.addEventListener('scroll', onScroll);
const observer = new ResizeObserver(pin);
observer.observe(contentEl);
return () => {
- scrollEl.removeEventListener("scroll", onScroll);
+ scrollEl.removeEventListener('scroll', onScroll);
observer.disconnect();
};
}, [isPreview]);
@@ -309,23 +284,22 @@ function ReasoningText({
ref={scrollRef}
data-slot="reasoning-text"
className={cn(
- "aui-reasoning-text relative z-0 max-h-64 overflow-y-auto ps-6 pt-2 pb-2 leading-relaxed text-pretty",
- "transform-gpu transition-[transform,opacity] ease-[cubic-bezier(0.32,0.72,0,1)]",
- "motion-reduce:animate-none",
- "group-data-open/collapsible-content:animate-in",
- "group-data-closed/collapsible-content:animate-out",
- "group-data-open/collapsible-content:fade-in-0",
- "group-data-closed/collapsible-content:fade-out-0",
- "group-data-open/collapsible-content:slide-in-from-top-4",
- "group-data-closed/collapsible-content:slide-out-to-top-4",
- "group-data-open/collapsible-content:blur-in-[2px]",
- "group-data-closed/collapsible-content:blur-out-[2px]",
- "group-data-open/collapsible-content:animation-duration-(--animation-duration)",
- "group-data-closed/collapsible-content:animation-duration-(--animation-duration)",
- className,
+ 'aui-reasoning-text relative z-0 max-h-64 overflow-y-auto ps-6 pt-2 pb-2 leading-relaxed text-pretty',
+ 'transform-gpu transition-[transform,opacity] ease-[cubic-bezier(0.32,0.72,0,1)]',
+ 'motion-reduce:animate-none',
+ 'group-data-open/collapsible-content:animate-in',
+ 'group-data-closed/collapsible-content:animate-out',
+ 'group-data-open/collapsible-content:fade-in-0',
+ 'group-data-closed/collapsible-content:fade-out-0',
+ 'group-data-open/collapsible-content:slide-in-from-top-4',
+ 'group-data-closed/collapsible-content:slide-out-to-top-4',
+ 'group-data-open/collapsible-content:blur-in-[2px]',
+ 'group-data-closed/collapsible-content:blur-out-[2px]',
+ 'group-data-open/collapsible-content:animation-duration-(--animation-duration)',
+ 'group-data-closed/collapsible-content:animation-duration-(--animation-duration)',
+ className
)}
- {...props}
- >
+ {...props}>
<div ref={contentRef} className="aui-reasoning-text-content space-y-4">
{children}
</div>
@@ -335,15 +309,11 @@ function ReasoningText({
const ReasoningImpl: ReasoningMessagePartComponent = () => <MarkdownText />;
-const ReasoningGroupImpl: ReasoningGroupComponent = ({
- children,
- startIndex,
- endIndex,
-}) => {
- const isReasoningStreaming = useAuiState((s) => {
- if (s.message.status?.type !== "running") return false;
+const ReasoningGroupImpl: ReasoningGroupComponent = ({ children, startIndex, endIndex }) => {
+ const isReasoningStreaming = useAuiState(s => {
+ if (s.message.status?.type !== 'running') return false;
for (let index = startIndex; index <= endIndex; index++) {
- if (s.message.parts[index]?.status.type === "running") return true;
+ if (s.message.parts[index]?.status.type === 'running') return true;
}
return false;
});
@@ -358,9 +328,7 @@ const ReasoningGroupImpl: ReasoningGroupComponent = ({
);
};
-const Reasoning = memo(
- ReasoningImpl,
-) as unknown as ReasoningMessagePartComponent & {
+const Reasoning = memo(ReasoningImpl) as unknown as ReasoningMessagePartComponent & {
Root: typeof ReasoningRoot;
Trigger: typeof ReasoningTrigger;
Content: typeof ReasoningContent;
@@ -368,7 +336,7 @@ const Reasoning = memo(
Fade: typeof ReasoningFade;
};
-Reasoning.displayName = "Reasoning";
+Reasoning.displayName = 'Reasoning';
Reasoning.Root = ReasoningRoot;
Reasoning.Trigger = ReasoningTrigger;
Reasoning.Content = ReasoningContent;
@@ -383,7 +351,7 @@ Reasoning.Fade = ReasoningFade;
* See `thread.tsx` for an example.
*/
const ReasoningGroup = memo(ReasoningGroupImpl);
-ReasoningGroup.displayName = "ReasoningGroup";
+ReasoningGroup.displayName = 'ReasoningGroup';
export {
Reasoning,
diff --git a/app/src/components/assistant-ui/thread-list.tsx b/app/src/components/assistant-ui/thread-list.tsx
index 9c0d22e04c..d5dcdd973c 100644
--- a/app/src/components/assistant-ui/thread-list.tsx
+++ b/app/src/components/assistant-ui/thread-list.tsx
@@ -1,9 +1,9 @@
-"use client";
+'use client';
-import { Button } from "@/components/assistant-ui/ui/button";
-import { Input } from "@/components/assistant-ui/ui/input";
-import { Skeleton } from "@/components/assistant-ui/ui/skeleton";
-import { cn } from "@/components/assistant-ui/lib/utils";
+import { cn } from '@/components/assistant-ui/lib/utils';
+import { Button } from '@/components/assistant-ui/ui/button';
+import { Input } from '@/components/assistant-ui/ui/input';
+import { Skeleton } from '@/components/assistant-ui/ui/skeleton';
import {
AuiIf,
ThreadListItemMorePrimitive,
@@ -11,7 +11,7 @@ import {
ThreadListPrimitive,
useAui,
useAuiState,
-} from "@assistant-ui/react";
+} from '@assistant-ui/react';
import {
ArchiveIcon,
Loader2Icon,
@@ -20,36 +20,34 @@ import {
PlusIcon,
SearchIcon,
TrashIcon,
-} from "lucide-react";
+} from 'lucide-react';
import {
+ type ComponentPropsWithoutRef,
+ type FC,
forwardRef,
Fragment,
useEffect,
useMemo,
useRef,
useState,
- type ComponentPropsWithoutRef,
- type FC,
-} from "react";
+} from 'react';
export const ThreadList: FC = () => {
- const [search, setSearch] = useState("");
- const hasThreads = useAuiState((s) => s.threads.threadIds.length > 0);
+ const [search, setSearch] = useState('');
+ const hasThreads = useAuiState(s => s.threads.threadIds.length > 0);
return (
<ThreadListRoot>
<ThreadListNew />
- {hasThreads && (
- <ThreadListSearch value={search} onValueChange={setSearch} />
- )}
- <ThreadListItems searchQuery={hasThreads ? search : ""} />
+ {hasThreads && <ThreadListSearch value={search} onValueChange={setSearch} />}
+ <ThreadListItems searchQuery={hasThreads ? search : ''} />
</ThreadListRoot>
);
};
export const ThreadListSearch = forwardRef<
HTMLInputElement,
- Omit<ComponentPropsWithoutRef<typeof Input>, "value" | "onChange"> & {
+ Omit<ComponentPropsWithoutRef<typeof Input>, 'value' | 'onChange'> & {
value: string;
onValueChange: (value: string) => void;
}
@@ -64,43 +62,45 @@ export const ThreadListSearch = forwardRef<
ref={ref}
type="search"
value={value}
- onChange={(event) => onValueChange(event.target.value)}
+ onChange={event => onValueChange(event.target.value)}
aria-label="Search threads"
placeholder="Search threads"
- className={cn("h-8 ps-8 text-sm", className)}
+ className={cn('h-8 ps-8 text-sm', className)}
{...props}
/>
</div>
);
});
-ThreadListSearch.displayName = "ThreadListSearch";
+ThreadListSearch.displayName = 'ThreadListSearch';
-export const ThreadListRoot: FC<
- ComponentPropsWithoutRef<typeof ThreadListPrimitive.Root>
-> = ({ className, ...props }) => {
+export const ThreadListRoot: FC<ComponentPropsWithoutRef<typeof ThreadListPrimitive.Root>> = ({
+ className,
+ ...props
+}) => {
return (
<ThreadListPrimitive.Root
data-slot="aui_thread-list-root"
- className={cn("flex flex-col gap-0.5", className)}
+ className={cn('flex flex-col gap-0.5', className)}
{...props}
/>
);
};
-export const ThreadListItems: FC<
- ComponentPropsWithoutRef<"div"> & { searchQuery?: string }
-> = ({ className, searchQuery = "", ...props }) => {
+export const ThreadListItems: FC<ComponentPropsWithoutRef<'div'> & { searchQuery?: string }> = ({
+ className,
+ searchQuery = '',
+ ...props
+}) => {
return (
<div
data-slot="aui_thread-list-items"
- className={cn("flex flex-col gap-0.5", className)}
- {...props}
- >
- <AuiIf condition={(s) => s.threads.isLoading}>
+ className={cn('flex flex-col gap-0.5', className)}
+ {...props}>
+ <AuiIf condition={s => s.threads.isLoading}>
<ThreadListSkeleton />
</AuiIf>
- <AuiIf condition={(s) => !s.threads.isLoading}>
+ <AuiIf condition={s => !s.threads.isLoading}>
<ThreadListItemGroups searchQuery={searchQuery} />
</AuiIf>
</div>
@@ -109,50 +109,36 @@ export const ThreadListItems: FC<
const DAY_IN_MS = 86_400_000;
-const dateGroupLabel = (
- date: Date | undefined,
- startOfToday: number,
-): string => {
- if (!date || date.getTime() >= startOfToday) return "Today";
- if (date.getTime() >= startOfToday - DAY_IN_MS) return "Yesterday";
- return "Earlier";
+const dateGroupLabel = (date: Date | undefined, startOfToday: number): string => {
+ if (!date || date.getTime() >= startOfToday) return 'Today';
+ if (date.getTime() >= startOfToday - DAY_IN_MS) return 'Yesterday';
+ return 'Earlier';
};
type ThreadListGroup = { label: string; indices: number[] };
-const ThreadListItemGroups: FC<{ searchQuery?: string }> = ({
- searchQuery = "",
-}) => {
- const threadIds = useAuiState((s) => s.threads.threadIds);
- const threadItems = useAuiState((s) => s.threads.threadItems);
+const ThreadListItemGroups: FC<{ searchQuery?: string }> = ({ searchQuery = '' }) => {
+ const threadIds = useAuiState(s => s.threads.threadIds);
+ const threadItems = useAuiState(s => s.threads.threadItems);
const query = searchQuery.trim().toLowerCase();
const { filteredIndices, groups } = useMemo(() => {
- const itemsById = new Map(threadItems.map((item) => [item.id, item]));
- const dates = threadIds.map((id) => itemsById.get(id)?.lastMessageAt);
+ const itemsById = new Map(threadItems.map(item => [item.id, item]));
+ const dates = threadIds.map(id => itemsById.get(id)?.lastMessageAt);
const filteredIndices = threadIds
.map((id, index) => ({ id, index }))
.filter(
- ({ id }) =>
- !query ||
- (itemsById.get(id)?.title || "New Chat")
- .toLowerCase()
- .includes(query),
+ ({ id }) => !query || (itemsById.get(id)?.title || 'New Chat').toLowerCase().includes(query)
)
.map(({ index }) => index);
- if (!filteredIndices.some((index) => dates[index])) {
+ if (!filteredIndices.some(index => dates[index])) {
return { filteredIndices, groups: null };
}
const now = new Date();
- const startOfToday = new Date(
- now.getFullYear(),
- now.getMonth(),
- now.getDate(),
- ).getTime();
- const time = (index: number) =>
- dates[index]?.getTime() ?? Number.MAX_SAFE_INTEGER;
+ const startOfToday = new Date(now.getFullYear(), now.getMonth(), now.getDate()).getTime();
+ const time = (index: number) => dates[index]?.getTime() ?? Number.MAX_SAFE_INTEGER;
const sorted = [...filteredIndices].sort((a, b) => time(b) - time(a));
const result: ThreadListGroup[] = [];
@@ -170,17 +156,14 @@ const ThreadListItemGroups: FC<{ searchQuery?: string }> = ({
if (query && filteredIndices.length === 0) {
return (
- <div
- data-slot="aui_thread-list-empty"
- className="text-muted-foreground px-2.5 py-4 text-sm"
- >
+ <div data-slot="aui_thread-list-empty" className="text-muted-foreground px-2.5 py-4 text-sm">
No threads found
</div>
);
}
if (!groups) {
- return filteredIndices.map((index) => (
+ return filteredIndices.map(index => (
<ThreadListPrimitive.ItemByIndex
key={threadIds[index]}
index={index}
@@ -189,15 +172,14 @@ const ThreadListItemGroups: FC<{ searchQuery?: string }> = ({
));
}
- return groups.map((group) => (
+ return groups.map(group => (
<Fragment key={group.label}>
<div
data-slot="aui_thread-list-group-label"
- className="text-muted-foreground px-2.5 pt-3 pb-1 text-xs font-medium"
- >
+ className="text-muted-foreground px-2.5 pt-3 pb-1 text-xs font-medium">
{group.label}
</div>
- {group.indices.map((index) => (
+ {group.indices.map(index => (
<ThreadListPrimitive.ItemByIndex
key={threadIds[index]}
index={index}
@@ -213,27 +195,34 @@ export const ThreadListNew = forwardRef<
ComponentPropsWithoutRef<typeof Button> & { labelClassName?: string }
>(({ className, labelClassName, children, ...props }, ref) => {
return (
- <ThreadListPrimitive.New render={<Button ref={ref} variant="ghost" data-slot="aui_thread-list-new" className={cn(
- "hover:bg-muted data-active:bg-muted h-8 justify-start gap-2 rounded-md px-2.5 text-sm font-normal",
- className,
- )} {...props} />}>{children ?? (
- <>
- <PlusIcon
- data-slot="aui_thread-list-new-icon"
- className="size-4 shrink-0"
- />
- <span
- data-slot="aui_thread-list-new-label"
- className={cn("whitespace-nowrap", labelClassName)}
- >
- New Thread
- </span>
- </>
- )}</ThreadListPrimitive.New>
+ <ThreadListPrimitive.New
+ render={
+ <Button
+ ref={ref}
+ variant="ghost"
+ data-slot="aui_thread-list-new"
+ className={cn(
+ 'hover:bg-muted data-active:bg-muted h-8 justify-start gap-2 rounded-md px-2.5 text-sm font-normal',
+ className
+ )}
+ {...props}
+ />
+ }>
+ {children ?? (
+ <>
+ <PlusIcon data-slot="aui_thread-list-new-icon" className="size-4 shrink-0" />
+ <span
+ data-slot="aui_thread-list-new-label"
+ className={cn('whitespace-nowrap', labelClassName)}>
+ New Thread
+ </span>
+ </>
+ )}
+ </ThreadListPrimitive.New>
);
});
-ThreadListNew.displayName = "ThreadListNew";
+ThreadListNew.displayName = 'ThreadListNew';
const ThreadListSkeleton: FC = () => {
return (
@@ -244,12 +233,8 @@ const ThreadListSkeleton: FC = () => {
role="status"
aria-label="Loading threads"
data-slot="aui_thread-list-skeleton-wrapper"
- className="flex h-8 items-center px-2.5"
- >
- <Skeleton
- data-slot="aui_thread-list-skeleton"
- className="h-3.5 w-full"
- />
+ className="flex h-8 items-center px-2.5">
+ <Skeleton data-slot="aui_thread-list-skeleton" className="h-3.5 w-full" />
</div>
))}
</div>
@@ -257,7 +242,7 @@ const ThreadListSkeleton: FC = () => {
};
export const ThreadListItem: FC = () => {
- const isRunning = useAuiState((s) => s.threadListItem.isRunning);
+ const isRunning = useAuiState(s => s.threadListItem.isRunning);
const [isRenaming, setIsRenaming] = useState(false);
const triggerRef = useRef<HTMLButtonElement>(null);
const restoreFocusRef = useRef(false);
@@ -271,11 +256,10 @@ export const ThreadListItem: FC = () => {
return (
<ThreadListItemPrimitive.Root
data-slot="aui_thread-list-item"
- className="group hover:bg-muted focus-visible:bg-muted data-active:bg-muted has-focus-visible:bg-muted has-data-[state=open]:bg-muted relative flex h-8 items-center rounded-md transition-colors focus-visible:outline-none"
- >
+ className="group hover:bg-muted focus-visible:bg-muted data-active:bg-muted has-focus-visible:bg-muted has-data-[state=open]:bg-muted relative flex h-8 items-center rounded-md transition-colors focus-visible:outline-none">
{isRenaming ? (
<ThreadListItemRename
- onDone={(restoreFocus) => {
+ onDone={restoreFocus => {
restoreFocusRef.current = restoreFocus;
setIsRenaming(false);
}}
@@ -284,8 +268,7 @@ export const ThreadListItem: FC = () => {
<ThreadListItemPrimitive.Trigger
ref={triggerRef}
data-slot="aui_thread-list-item-trigger"
- className="focus-visible:ring-ring/50 flex h-full min-w-0 flex-1 items-center rounded-md px-2.5 text-start text-sm outline-none group-hover:pe-9 group-has-focus-visible:pe-9 group-has-data-[state=open]:pe-9 group-data-active:pe-9 focus-visible:ring-1"
- >
+ className="focus-visible:ring-ring/50 flex h-full min-w-0 flex-1 items-center rounded-md px-2.5 text-start text-sm outline-none group-hover:pe-9 group-has-focus-visible:pe-9 group-has-data-[state=open]:pe-9 group-data-active:pe-9 focus-visible:ring-1">
{isRunning && (
<Loader2Icon
aria-hidden
@@ -293,10 +276,7 @@ export const ThreadListItem: FC = () => {
className="text-muted-foreground me-1.5 size-3.5 shrink-0 animate-spin"
/>
)}
- <span
- data-slot="aui_thread-list-item-title"
- className="min-w-0 flex-1 truncate"
- >
+ <span data-slot="aui_thread-list-item-title" className="min-w-0 flex-1 truncate">
<ThreadListItemPrimitive.Title fallback="New Chat" />
</span>
{isRunning && <span className="sr-only">Running</span>}
@@ -307,11 +287,9 @@ export const ThreadListItem: FC = () => {
);
};
-const ThreadListItemRename: FC<{
- onDone: (restoreFocus: boolean) => void;
-}> = ({ onDone }) => {
+const ThreadListItemRename: FC<{ onDone: (restoreFocus: boolean) => void }> = ({ onDone }) => {
const aui = useAui();
- const title = useAuiState((s) => s.threadListItem.title) ?? "";
+ const title = useAuiState(s => s.threadListItem.title) ?? '';
const [value, setValue] = useState(title);
const inputRef = useRef<HTMLInputElement>(null);
const settledRef = useRef(false);
@@ -338,7 +316,7 @@ const ThreadListItemRename: FC<{
() => {
settledRef.current = false;
if (restoreFocus) inputRef.current?.focus();
- },
+ }
);
};
@@ -356,13 +334,13 @@ const ThreadListItemRename: FC<{
aria-label="Rename thread"
value={value}
className="h-7 min-w-0 flex-1 ps-2.5 pe-9 text-sm"
- onChange={(event) => setValue(event.target.value)}
+ onChange={event => setValue(event.target.value)}
onBlur={() => commit(false)}
- onKeyDown={(event) => {
- if (event.key === "Enter") {
+ onKeyDown={event => {
+ if (event.key === 'Enter') {
event.preventDefault();
commit(true);
- } else if (event.key === "Escape") {
+ } else if (event.key === 'Escape') {
event.preventDefault();
cancel();
}
@@ -374,26 +352,51 @@ const ThreadListItemRename: FC<{
const ThreadListItemMore: FC<{ onRename: () => void }> = ({ onRename }) => {
return (
<ThreadListItemMorePrimitive.Root sharedFocusGroup>
- <ThreadListItemMorePrimitive.Trigger render={<Button variant="ghost" size="icon" data-slot="aui_thread-list-item-more" className="data-[state=open]:bg-accent absolute end-1.5 top-1/2 size-6 -translate-y-1/2 p-0 opacity-0 group-hover:opacity-100 group-has-focus-visible:opacity-100 group-data-active:opacity-100 data-[state=open]:opacity-100" />}><MoreHorizontalIcon className="size-3.5" /><span className="sr-only">More options</span></ThreadListItemMorePrimitive.Trigger>
+ <ThreadListItemMorePrimitive.Trigger
+ render={
+ <Button
+ variant="ghost"
+ size="icon"
+ data-slot="aui_thread-list-item-more"
+ className="data-[state=open]:bg-accent absolute end-1.5 top-1/2 size-6 -translate-y-1/2 p-0 opacity-0 group-hover:opacity-100 group-has-focus-visible:opacity-100 group-data-active:opacity-100 data-[state=open]:opacity-100"
+ />
+ }>
+ <MoreHorizontalIcon className="size-3.5" />
+ <span className="sr-only">More options</span>
+ </ThreadListItemMorePrimitive.Trigger>
<ThreadListItemMorePrimitive.Content
side="right"
align="start"
sideOffset={6}
data-slot="aui_thread-list-item-more-content"
- className="bg-popover text-popover-foreground data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=open]:animate-in data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=closed]:animate-out 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-32 overflow-hidden rounded-xl border p-1.5"
- >
+ className="bg-popover text-popover-foreground data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=open]:animate-in data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=closed]:animate-out 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-32 overflow-hidden rounded-xl border p-1.5">
<ThreadListItemMorePrimitive.Item
data-slot="aui_thread-list-item-more-item"
className="hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground flex cursor-pointer items-center gap-2 rounded-lg px-2.5 py-1.5 text-sm outline-none select-none"
- onSelect={onRename}
- >
+ onSelect={onRename}>
<PencilIcon className="size-4" />
Rename
</ThreadListItemMorePrimitive.Item>
- <ThreadListItemPrimitive.Archive render={<ThreadListItemMorePrimitive.Item data-slot="aui_thread-list-item-more-item" className="hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground flex cursor-pointer items-center gap-2 rounded-lg px-2.5 py-1.5 text-sm outline-none select-none" />}><ArchiveIcon className="size-4" />Archive
- </ThreadListItemPrimitive.Archive>
- <ThreadListItemPrimitive.Delete render={<ThreadListItemMorePrimitive.Item data-slot="aui_thread-list-item-more-item" className="text-destructive hover:bg-destructive/10 hover:text-destructive focus:bg-destructive/10 focus:text-destructive flex cursor-pointer items-center gap-2 rounded-lg px-2.5 py-1.5 text-sm outline-none select-none" />}><TrashIcon className="size-4" />Delete
- </ThreadListItemPrimitive.Delete>
+ <ThreadListItemPrimitive.Archive
+ render={
+ <ThreadListItemMorePrimitive.Item
+ data-slot="aui_thread-list-item-more-item"
+ className="hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground flex cursor-pointer items-center gap-2 rounded-lg px-2.5 py-1.5 text-sm outline-none select-none"
+ />
+ }>
+ <ArchiveIcon className="size-4" />
+ Archive
+ </ThreadListItemPrimitive.Archive>
+ <ThreadListItemPrimitive.Delete
+ render={
+ <ThreadListItemMorePrimitive.Item
+ data-slot="aui_thread-list-item-more-item"
+ className="text-destructive hover:bg-destructive/10 hover:text-destructive focus:bg-destructive/10 focus:text-destructive flex cursor-pointer items-center gap-2 rounded-lg px-2.5 py-1.5 text-sm outline-none select-none"
+ />
+ }>
+ <TrashIcon className="size-4" />
+ Delete
+ </ThreadListItemPrimitive.Delete>
</ThreadListItemMorePrimitive.Content>
</ThreadListItemMorePrimitive.Root>
);
diff --git a/app/src/components/assistant-ui/tool-fallback.tsx b/app/src/components/assistant-ui/tool-fallback.tsx
index e02395a43e..dcacc9c7bb 100644
--- a/app/src/components/assistant-ui/tool-fallback.tsx
+++ b/app/src/components/assistant-ui/tool-fallback.tsx
@@ -1,42 +1,32 @@
-"use client";
+'use client';
-import { memo, useCallback, useRef, useState } from "react";
+import { cn } from '@/components/assistant-ui/lib/utils';
+import { Button } from '@/components/assistant-ui/ui/button';
import {
- AlertCircleIcon,
- CheckIcon,
- ChevronDownIcon,
- LoaderIcon,
- XCircleIcon,
-} from "lucide-react";
+ Collapsible,
+ CollapsibleContent,
+ CollapsibleTrigger,
+} from '@/components/assistant-ui/ui/collapsible';
import {
- useScrollLock,
- useToolCallElapsed,
type ToolApprovalOption,
type ToolCallMessagePart,
+ type ToolCallMessagePartComponent,
type ToolCallMessagePartProps,
type ToolCallMessagePartStatus,
- type ToolCallMessagePartComponent,
-} from "@assistant-ui/react";
-import {
- Collapsible,
- CollapsibleContent,
- CollapsibleTrigger,
-} from "@/components/assistant-ui/ui/collapsible";
-import { cn } from "@/components/assistant-ui/lib/utils";
-import { Button } from "@/components/assistant-ui/ui/button";
+ useScrollLock,
+ useToolCallElapsed,
+} from '@assistant-ui/react';
+import { AlertCircleIcon, CheckIcon, ChevronDownIcon, LoaderIcon, XCircleIcon } from 'lucide-react';
+import { memo, useCallback, useRef, useState } from 'react';
const ANIMATION_DURATION = 200;
-const pressable = "active:scale-[0.98]";
+const pressable = 'active:scale-[0.98]';
export type ToolFallbackRootProps = Omit<
React.ComponentProps<typeof Collapsible>,
- "open" | "onOpenChange"
-> & {
- open?: boolean;
- onOpenChange?: (open: boolean) => void;
- defaultOpen?: boolean;
-};
+ 'open' | 'onOpenChange'
+> & { open?: boolean; onOpenChange?: (open: boolean) => void; defaultOpen?: boolean };
function ToolFallbackRoot({
className,
@@ -61,7 +51,7 @@ function ToolFallbackRoot({
}
controlledOnOpenChange?.(open);
},
- [lockScroll, isControlled, controlledOnOpenChange],
+ [lockScroll, isControlled, controlledOnOpenChange]
);
return (
@@ -70,43 +60,32 @@ function ToolFallbackRoot({
data-slot="tool-fallback-root"
open={isOpen}
onOpenChange={handleOpenChange}
- className={cn(
- "aui-tool-fallback-root group/tool-fallback-root w-full",
- className,
- )}
- style={
- {
- "--animation-duration": `${ANIMATION_DURATION}ms`,
- } as React.CSSProperties
- }
- {...props}
- >
+ className={cn('aui-tool-fallback-root group/tool-fallback-root w-full', className)}
+ style={{ '--animation-duration': `${ANIMATION_DURATION}ms` } as React.CSSProperties}
+ {...props}>
{children}
</Collapsible>
);
}
-type ToolStatus = ToolCallMessagePartStatus["type"];
+type ToolStatus = ToolCallMessagePartStatus['type'];
const statusIconMap: Record<ToolStatus, React.ElementType> = {
running: LoaderIcon,
complete: CheckIcon,
incomplete: XCircleIcon,
- "requires-action": AlertCircleIcon,
+ 'requires-action': AlertCircleIcon,
};
const formatToolDuration = (ms: number) => {
- if (ms < 1000) return "<1s";
+ if (ms < 1000) return '<1s';
const seconds = ms / 1000;
if (seconds < 10) return `${(Math.floor(seconds * 10) / 10).toFixed(1)}s`;
if (seconds < 60) return `${Math.floor(seconds)}s`;
return `${Math.floor(seconds / 60)}m ${Math.floor(seconds % 60)}s`;
};
-function ToolFallbackDuration({
- className,
- ...props
-}: React.ComponentProps<"span">) {
+function ToolFallbackDuration({ className, ...props }: React.ComponentProps<'span'>) {
const elapsedMs = useToolCallElapsed();
if (elapsedMs === undefined) return null;
@@ -114,11 +93,10 @@ function ToolFallbackDuration({
<span
data-slot="tool-fallback-duration"
className={cn(
- "aui-tool-fallback-duration text-muted-foreground text-xs tabular-nums",
- className,
+ 'aui-tool-fallback-duration text-muted-foreground text-xs tabular-nums',
+ className
)}
- {...props}
- >
+ {...props}>
{formatToolDuration(elapsedMs)}
</span>
);
@@ -133,38 +111,35 @@ function ToolFallbackTrigger({
toolName: string;
status?: ToolCallMessagePartStatus;
}) {
- const statusType = status?.type ?? "complete";
- const isRunning = statusType === "running";
- const isCancelled =
- status?.type === "incomplete" && status.reason === "cancelled";
+ const statusType = status?.type ?? 'complete';
+ const isRunning = statusType === 'running';
+ const isCancelled = status?.type === 'incomplete' && status.reason === 'cancelled';
const Icon = statusIconMap[statusType];
- const label = isCancelled ? "Cancelled tool" : "Used tool";
+ const label = isCancelled ? 'Cancelled tool' : 'Used tool';
return (
<CollapsibleTrigger
data-slot="tool-fallback-trigger"
className={cn(
- "aui-tool-fallback-trigger group/trigger text-muted-foreground hover:text-foreground flex w-fit origin-left items-center gap-2 py-1.5 text-sm transition-[color,scale] active:scale-[0.98]",
- className,
+ 'aui-tool-fallback-trigger group/trigger text-muted-foreground hover:text-foreground flex w-fit origin-left items-center gap-2 py-1.5 text-sm transition-[color,scale] active:scale-[0.98]',
+ className
)}
- {...props}
- >
+ {...props}>
<Icon
data-slot="tool-fallback-trigger-icon"
className={cn(
- "aui-tool-fallback-trigger-icon size-4 shrink-0",
- isCancelled && "text-muted-foreground",
- isRunning && "animate-spin [animation-duration:0.6s]",
+ 'aui-tool-fallback-trigger-icon size-4 shrink-0',
+ isCancelled && 'text-muted-foreground',
+ isRunning && 'animate-spin [animation-duration:0.6s]'
)}
/>
<span
data-slot="tool-fallback-trigger-label"
className={cn(
- "aui-tool-fallback-trigger-label-wrapper relative inline-block text-start leading-none",
- isCancelled && "text-muted-foreground line-through",
- )}
- >
+ 'aui-tool-fallback-trigger-label-wrapper relative inline-block text-start leading-none',
+ isCancelled && 'text-muted-foreground line-through'
+ )}>
<span>
{label}: <b>{toolName}</b>
</span>
@@ -172,8 +147,7 @@ function ToolFallbackTrigger({
<span
aria-hidden
data-slot="tool-fallback-trigger-shimmer"
- className="aui-tool-fallback-trigger-shimmer shimmer pointer-events-none absolute inset-0 motion-reduce:animate-none"
- >
+ className="aui-tool-fallback-trigger-shimmer shimmer pointer-events-none absolute inset-0 motion-reduce:animate-none">
{label}: <b>{toolName}</b>
</span>
)}
@@ -182,11 +156,11 @@ function ToolFallbackTrigger({
<ChevronDownIcon
data-slot="tool-fallback-trigger-chevron"
className={cn(
- "aui-tool-fallback-trigger-chevron size-4 shrink-0",
- "transition-transform duration-(--animation-duration) ease-[cubic-bezier(0.32,0.72,0,1)] motion-reduce:transition-none",
- "-rotate-90",
- "group-data-open/trigger:rotate-0",
- "group-data-panel-open/trigger:rotate-0",
+ 'aui-tool-fallback-trigger-chevron size-4 shrink-0',
+ 'transition-transform duration-(--animation-duration) ease-[cubic-bezier(0.32,0.72,0,1)] motion-reduce:transition-none',
+ '-rotate-90',
+ 'group-data-open/trigger:rotate-0',
+ 'group-data-panel-open/trigger:rotate-0'
)}
/>
</CollapsibleTrigger>
@@ -202,25 +176,23 @@ function ToolFallbackContent({
<CollapsibleContent
data-slot="tool-fallback-content"
className={cn(
- "aui-tool-fallback-content relative overflow-hidden text-sm outline-hidden",
- "group/collapsible-content ease-[cubic-bezier(0.32,0.72,0,1)] motion-reduce:animate-none",
- "data-closed:animate-collapsible-up",
- "data-open:animate-collapsible-down",
- "data-closed:fill-mode-forwards",
- "data-closed:pointer-events-none",
- "[--tw-duration:var(--animation-duration)]",
- className,
+ 'aui-tool-fallback-content relative overflow-hidden text-sm outline-hidden',
+ 'group/collapsible-content ease-[cubic-bezier(0.32,0.72,0,1)] motion-reduce:animate-none',
+ 'data-closed:animate-collapsible-up',
+ 'data-open:animate-collapsible-down',
+ 'data-closed:fill-mode-forwards',
+ 'data-closed:pointer-events-none',
+ '[--tw-duration:var(--animation-duration)]',
+ className
)}
- {...props}
- >
+ {...props}>
<div
className={cn(
- "flex flex-col gap-2 ps-6 pt-1 pb-2 ease-[cubic-bezier(0.32,0.72,0,1)] motion-reduce:animate-none",
- "group-data-open/collapsible-content:animate-in group-data-open/collapsible-content:fade-in-0 group-data-open/collapsible-content:blur-in-[2px] group-data-open/collapsible-content:slide-in-from-top-1",
- "group-data-closed/collapsible-content:animate-out group-data-closed/collapsible-content:fade-out-0 group-data-closed/collapsible-content:blur-out-[2px] group-data-closed/collapsible-content:slide-out-to-top-1",
- "group-data-closed/collapsible-content:animation-duration-(--animation-duration) group-data-open/collapsible-content:animation-duration-(--animation-duration)",
- )}
- >
+ 'flex flex-col gap-2 ps-6 pt-1 pb-2 ease-[cubic-bezier(0.32,0.72,0,1)] motion-reduce:animate-none',
+ 'group-data-open/collapsible-content:animate-in group-data-open/collapsible-content:fade-in-0 group-data-open/collapsible-content:blur-in-[2px] group-data-open/collapsible-content:slide-in-from-top-1',
+ 'group-data-closed/collapsible-content:animate-out group-data-closed/collapsible-content:fade-out-0 group-data-closed/collapsible-content:blur-out-[2px] group-data-closed/collapsible-content:slide-out-to-top-1',
+ 'group-data-closed/collapsible-content:animation-duration-(--animation-duration) group-data-open/collapsible-content:animation-duration-(--animation-duration)'
+ )}>
{children}
</div>
</CollapsibleContent>
@@ -231,17 +203,14 @@ function ToolFallbackArgs({
argsText,
className,
...props
-}: React.ComponentProps<"div"> & {
- argsText?: string;
-}) {
+}: React.ComponentProps<'div'> & { argsText?: string }) {
if (!argsText) return null;
return (
<div
data-slot="tool-fallback-args"
- className={cn("aui-tool-fallback-args", className)}
- {...props}
- >
+ className={cn('aui-tool-fallback-args', className)}
+ {...props}>
<pre className="aui-tool-fallback-args-value bg-muted/50 text-foreground/90 rounded-md p-2.5 text-xs whitespace-pre-wrap">
{argsText}
</pre>
@@ -253,22 +222,19 @@ function ToolFallbackResult({
result,
className,
...props
-}: React.ComponentProps<"div"> & {
- result?: unknown;
-}) {
+}: React.ComponentProps<'div'> & { result?: unknown }) {
if (result === undefined) return null;
return (
<div
data-slot="tool-fallback-result"
- className={cn("aui-tool-fallback-result", className)}
- {...props}
- >
+ className={cn('aui-tool-fallback-result', className)}
+ {...props}>
<p className="aui-tool-fallback-result-header text-muted-foreground text-xs font-medium">
Result:
</p>
<pre className="aui-tool-fallback-result-content bg-muted/50 text-foreground/90 mt-1 rounded-md p-2.5 text-xs whitespace-pre-wrap">
- {typeof result === "string" ? result : JSON.stringify(result, null, 2)}
+ {typeof result === 'string' ? result : JSON.stringify(result, null, 2)}
</pre>
</div>
);
@@ -278,51 +244,41 @@ function ToolFallbackError({
status,
className,
...props
-}: React.ComponentProps<"div"> & {
- status?: ToolCallMessagePartStatus;
-}) {
- if (status?.type !== "incomplete") return null;
+}: React.ComponentProps<'div'> & { status?: ToolCallMessagePartStatus }) {
+ if (status?.type !== 'incomplete') return null;
const error = status.error;
- const errorText = error
- ? typeof error === "string"
- ? error
- : JSON.stringify(error)
- : null;
+ const errorText = error ? (typeof error === 'string' ? error : JSON.stringify(error)) : null;
if (!errorText) return null;
- const isCancelled = status.reason === "cancelled";
- const headerText = isCancelled ? "Cancelled reason:" : "Error:";
+ const isCancelled = status.reason === 'cancelled';
+ const headerText = isCancelled ? 'Cancelled reason:' : 'Error:';
return (
<div
data-slot="tool-fallback-error"
- className={cn("aui-tool-fallback-error", className)}
- {...props}
- >
+ className={cn('aui-tool-fallback-error', className)}
+ {...props}>
<p className="aui-tool-fallback-error-header text-muted-foreground font-semibold">
{headerText}
</p>
- <p className="aui-tool-fallback-error-reason text-muted-foreground">
- {errorText}
- </p>
+ <p className="aui-tool-fallback-error-reason text-muted-foreground">{errorText}</p>
</div>
);
}
-const APPROVED_RESULT = "Approved by user";
-const DENIED_RESULT = "User denied tool execution";
+const APPROVED_RESULT = 'Approved by user';
+const DENIED_RESULT = 'User denied tool execution';
const APPROVAL_OPTION_DEFAULT_LABELS: Record<string, string> = {
- "allow-once": "Allow",
- "allow-always": "Always allow",
- "reject-once": "Deny",
- "reject-always": "Always deny",
+ 'allow-once': 'Allow',
+ 'allow-always': 'Always allow',
+ 'reject-once': 'Deny',
+ 'reject-always': 'Always deny',
};
-const isAllowKind = (kind: string) =>
- kind === "allow-once" || kind === "allow-always";
+const isAllowKind = (kind: string) => kind === 'allow-once' || kind === 'allow-always';
const approvalOptionLabel = (option: ToolApprovalOption) =>
option.label ??
@@ -333,11 +289,11 @@ const approvalOptionLabel = (option: ToolApprovalOption) =>
const offersInterruptAction = (
status: ToolCallMessagePartStatus | undefined,
- approval: ToolCallMessagePart["approval"],
- interrupt: ToolCallMessagePart["interrupt"],
+ approval: ToolCallMessagePart['approval'],
+ interrupt: ToolCallMessagePart['interrupt']
) =>
- status?.type !== "requires-action" ||
- status.reason !== "interrupt" ||
+ status?.type !== 'requires-action' ||
+ status.reason !== 'interrupt' ||
approval != null ||
interrupt != null;
@@ -350,23 +306,17 @@ function ToolFallbackApproval({
respondToApproval,
status,
...props
-}: React.ComponentProps<"div"> &
+}: React.ComponentProps<'div'> &
Partial<
- Pick<
- ToolCallMessagePartProps,
- "addResult" | "resume" | "respondToApproval" | "status"
- >
+ Pick<ToolCallMessagePartProps, 'addResult' | 'resume' | 'respondToApproval' | 'status'>
> & {
- interrupt?: ToolCallMessagePart["interrupt"];
- approval?: ToolCallMessagePart["approval"];
+ interrupt?: ToolCallMessagePart['interrupt'];
+ approval?: ToolCallMessagePart['approval'];
}) {
const [submitted, setSubmitted] = useState(false);
const [confirmingId, setConfirmingId] = useState<string | null>(null);
- if (
- approval != null &&
- (approval.approved !== undefined || approval.resolution !== undefined)
- )
+ if (approval != null && (approval.approved !== undefined || approval.resolution !== undefined))
return null;
if (!offersInterruptAction(status, approval, interrupt)) return null;
@@ -376,24 +326,17 @@ function ToolFallbackApproval({
// a host constraint: the kit never adds an approval path beyond it, but
// always preserves a refusal path.
const declaredOptions = respondToApproval ? approval?.options : undefined;
- const options = declaredOptions?.filter((o) =>
- Object.hasOwn(APPROVAL_OPTION_DEFAULT_LABELS, o.kind),
+ const options = declaredOptions?.filter(o =>
+ Object.hasOwn(APPROVAL_OPTION_DEFAULT_LABELS, o.kind)
);
const respond = (approved: boolean) => {
if (submitted) return;
- if (
- approval != null &&
- approval.approved === undefined &&
- respondToApproval
- ) {
+ if (approval != null && approval.approved === undefined && respondToApproval) {
respondToApproval({ approved });
} else if (interrupt) {
resume?.({ approved });
- } else if (
- status?.type === "requires-action" &&
- status.reason === "interrupt"
- ) {
+ } else if (status?.type === 'requires-action' && status.reason === 'interrupt') {
return;
} else {
addResult?.(approved ? APPROVED_RESULT : DENIED_RESULT);
@@ -416,25 +359,16 @@ function ToolFallbackApproval({
}
};
- const confirming =
- confirmingId != null
- ? options?.find((o) => o.id === confirmingId)
- : undefined;
+ const confirming = confirmingId != null ? options?.find(o => o.id === confirmingId) : undefined;
if (confirming) {
- const confirmMeta =
- typeof confirming.confirm === "object" ? confirming.confirm : undefined;
- const confirmDescription =
- confirmMeta?.description ?? confirming.description;
+ const confirmMeta = typeof confirming.confirm === 'object' ? confirming.confirm : undefined;
+ const confirmDescription = confirmMeta?.description ?? confirming.description;
return (
<div
data-slot="tool-fallback-approval-confirm"
- className={cn(
- "aui-tool-fallback-approval-confirm flex flex-col gap-2 pt-1",
- className,
- )}
- {...props}
- >
+ className={cn('aui-tool-fallback-approval-confirm flex flex-col gap-2 pt-1', className)}
+ {...props}>
<p className="aui-tool-fallback-approval-confirm-title font-semibold">
{confirmMeta?.title ?? `${approvalOptionLabel(confirming)}?`}
</p>
@@ -445,7 +379,7 @@ function ToolFallbackApproval({
)}
{confirming.grants && confirming.grants.length > 0 && (
<ul className="aui-tool-fallback-approval-confirm-grants flex flex-col gap-1">
- {confirming.grants.map((grant) => (
+ {confirming.grants.map(grant => (
<li key={grant}>
<code className="aui-tool-fallback-approval-confirm-grant bg-muted rounded px-1.5 py-0.5 text-xs">
{grant}
@@ -459,8 +393,7 @@ function ToolFallbackApproval({
size="sm"
className={pressable}
onClick={() => respondWithOption(confirming)}
- disabled={submitted}
- >
+ disabled={submitted}>
Confirm
</Button>
<Button
@@ -468,8 +401,7 @@ function ToolFallbackApproval({
variant="outline"
className={pressable}
onClick={() => setConfirmingId(null)}
- disabled={submitted}
- >
+ disabled={submitted}>
Back
</Button>
</div>
@@ -478,26 +410,24 @@ function ToolFallbackApproval({
}
if (declaredOptions && declaredOptions.length > 0) {
- const allowOptions = options?.filter((o) => isAllowKind(o.kind)) ?? [];
- const rejectOptions = options?.filter((o) => !isAllowKind(o.kind)) ?? [];
+ const allowOptions = options?.filter(o => isAllowKind(o.kind)) ?? [];
+ const rejectOptions = options?.filter(o => !isAllowKind(o.kind)) ?? [];
return (
<div
data-slot="tool-fallback-approval"
className={cn(
- "aui-tool-fallback-approval flex flex-wrap items-center gap-2 pt-1",
- className,
+ 'aui-tool-fallback-approval flex flex-wrap items-center gap-2 pt-1',
+ className
)}
- {...props}
- >
- {[...allowOptions, ...rejectOptions].map((option) => (
+ {...props}>
+ {[...allowOptions, ...rejectOptions].map(option => (
<Button
key={option.id}
size="sm"
- variant={option === allowOptions[0] ? "default" : "outline"}
+ variant={option === allowOptions[0] ? 'default' : 'outline'}
className={pressable}
onClick={() => handleOption(option)}
- disabled={submitted}
- >
+ disabled={submitted}>
{approvalOptionLabel(option)}
</Button>
))}
@@ -507,8 +437,7 @@ function ToolFallbackApproval({
variant="outline"
className={pressable}
onClick={() => respond(false)}
- disabled={submitted}
- >
+ disabled={submitted}>
Deny
</Button>
)}
@@ -519,18 +448,9 @@ function ToolFallbackApproval({
return (
<div
data-slot="tool-fallback-approval"
- className={cn(
- "aui-tool-fallback-approval flex items-center gap-2 pt-1",
- className,
- )}
- {...props}
- >
- <Button
- size="sm"
- className={pressable}
- onClick={() => respond(true)}
- disabled={submitted}
- >
+ className={cn('aui-tool-fallback-approval flex items-center gap-2 pt-1', className)}
+ {...props}>
+ <Button size="sm" className={pressable} onClick={() => respond(true)} disabled={submitted}>
Allow
</Button>
<Button
@@ -538,8 +458,7 @@ function ToolFallbackApproval({
variant="outline"
className={pressable}
onClick={() => respond(false)}
- disabled={submitted}
- >
+ disabled={submitted}>
Deny
</Button>
</div>
@@ -557,15 +476,13 @@ const ToolFallbackImpl: ToolCallMessagePartComponent = ({
approval,
respondToApproval,
}) => {
- const isCancelled =
- status?.type === "incomplete" && status.reason === "cancelled";
- const isRequiresAction = status?.type === "requires-action";
+ const isCancelled = status?.type === 'incomplete' && status.reason === 'cancelled';
+ const isRequiresAction = status?.type === 'requires-action';
const shouldRenderApproval =
isRequiresAction && offersInterruptAction(status, approval, interrupt);
const [open, setOpen] = useState(isRequiresAction);
- const [prevRequiresAction, setPrevRequiresAction] =
- useState(isRequiresAction);
+ const [prevRequiresAction, setPrevRequiresAction] = useState(isRequiresAction);
if (isRequiresAction !== prevRequiresAction) {
setPrevRequiresAction(isRequiresAction);
if (isRequiresAction) setOpen(true);
@@ -576,10 +493,7 @@ const ToolFallbackImpl: ToolCallMessagePartComponent = ({
<ToolFallbackTrigger toolName={toolName} status={status} />
<ToolFallbackContent>
<ToolFallbackError status={status} />
- <ToolFallbackArgs
- argsText={argsText}
- className={cn(isCancelled && "opacity-60")}
- />
+ <ToolFallbackArgs argsText={argsText} className={cn(isCancelled && 'opacity-60')} />
{shouldRenderApproval && (
<ToolFallbackApproval
addResult={addResult}
@@ -596,9 +510,7 @@ const ToolFallbackImpl: ToolCallMessagePartComponent = ({
);
};
-const ToolFallback = memo(
- ToolFallbackImpl,
-) as unknown as ToolCallMessagePartComponent & {
+const ToolFallback = memo(ToolFallbackImpl) as unknown as ToolCallMessagePartComponent & {
Root: typeof ToolFallbackRoot;
Trigger: typeof ToolFallbackTrigger;
Content: typeof ToolFallbackContent;
@@ -608,7 +520,7 @@ const ToolFallback = memo(
Approval: typeof ToolFallbackApproval;
};
-ToolFallback.displayName = "ToolFallback";
+ToolFallback.displayName = 'ToolFallback';
ToolFallback.Root = ToolFallbackRoot;
ToolFallback.Trigger = ToolFallbackTrigger;
ToolFallback.Content = ToolFallbackContent;
diff --git a/app/src/components/assistant-ui/tool-group.tsx b/app/src/components/assistant-ui/tool-group.tsx
index c7c7664551..4f8c9ac318 100644
--- a/app/src/components/assistant-ui/tool-group.tsx
+++ b/app/src/components/assistant-ui/tool-group.tsx
@@ -1,39 +1,32 @@
-"use client";
+'use client';
-import {
- memo,
- useCallback,
- useRef,
- useState,
- type FC,
- type PropsWithChildren,
-} from "react";
-import { ChevronDownIcon, LoaderIcon } from "lucide-react";
-import { cva, type VariantProps } from "class-variance-authority";
-import { useScrollLock } from "@assistant-ui/react";
+import { cn } from '@/components/assistant-ui/lib/utils';
import {
Collapsible,
CollapsibleContent,
CollapsibleTrigger,
-} from "@/components/assistant-ui/ui/collapsible";
-import { cn } from "@/components/assistant-ui/lib/utils";
+} from '@/components/assistant-ui/ui/collapsible';
+import { useScrollLock } from '@assistant-ui/react';
+import { cva, type VariantProps } from 'class-variance-authority';
+import { ChevronDownIcon, LoaderIcon } from 'lucide-react';
+import { type FC, memo, type PropsWithChildren, useCallback, useRef, useState } from 'react';
const ANIMATION_DURATION = 200;
-const toolGroupVariants = cva("aui-tool-group-root group/tool-group w-full", {
+const toolGroupVariants = cva('aui-tool-group-root group/tool-group w-full', {
variants: {
variant: {
- outline: "rounded-lg border py-3",
- ghost: "",
- muted: "border-muted-foreground/30 bg-muted/30 rounded-lg border py-3",
+ outline: 'rounded-lg border py-3',
+ ghost: '',
+ muted: 'border-muted-foreground/30 bg-muted/30 rounded-lg border py-3',
},
},
- defaultVariants: { variant: "outline" },
+ defaultVariants: { variant: 'outline' },
});
export type ToolGroupRootProps = Omit<
React.ComponentProps<typeof Collapsible>,
- "open" | "onOpenChange"
+ 'open' | 'onOpenChange'
> &
VariantProps<typeof toolGroupVariants> & {
open?: boolean;
@@ -65,28 +58,19 @@ function ToolGroupRoot({
}
controlledOnOpenChange?.(open);
},
- [lockScroll, isControlled, controlledOnOpenChange],
+ [lockScroll, isControlled, controlledOnOpenChange]
);
return (
<Collapsible
ref={collapsibleRef}
data-slot="tool-group-root"
- data-variant={variant ?? "outline-solid"}
+ data-variant={variant ?? 'outline-solid'}
open={isOpen}
onOpenChange={handleOpenChange}
- className={cn(
- toolGroupVariants({ variant }),
- "group/tool-group-root",
- className,
- )}
- style={
- {
- "--animation-duration": `${ANIMATION_DURATION}ms`,
- } as React.CSSProperties
- }
- {...props}
- >
+ className={cn(toolGroupVariants({ variant }), 'group/tool-group-root', className)}
+ style={{ '--animation-duration': `${ANIMATION_DURATION}ms` } as React.CSSProperties}
+ {...props}>
{children}
</Collapsible>
);
@@ -97,24 +81,20 @@ function ToolGroupTrigger({
active = false,
className,
...props
-}: React.ComponentProps<typeof CollapsibleTrigger> & {
- count: number;
- active?: boolean;
-}) {
- const label = `${count} tool ${count === 1 ? "call" : "calls"}`;
+}: React.ComponentProps<typeof CollapsibleTrigger> & { count: number; active?: boolean }) {
+ const label = `${count} tool ${count === 1 ? 'call' : 'calls'}`;
return (
<CollapsibleTrigger
data-slot="tool-group-trigger"
className={cn(
- "aui-tool-group-trigger group/trigger flex origin-left items-center gap-2 text-sm transition-[color,scale] active:scale-[0.98]",
- "group-data-[variant=ghost]/tool-group-root:text-muted-foreground group-data-[variant=ghost]/tool-group-root:hover:text-foreground group-data-[variant=ghost]/tool-group-root:py-1.5",
- "group-data-[variant=outline]/tool-group-root:w-full group-data-[variant=outline]/tool-group-root:px-4",
- "group-data-[variant=muted]/tool-group-root:w-full group-data-[variant=muted]/tool-group-root:px-4",
- className,
+ 'aui-tool-group-trigger group/trigger flex origin-left items-center gap-2 text-sm transition-[color,scale] active:scale-[0.98]',
+ 'group-data-[variant=ghost]/tool-group-root:text-muted-foreground group-data-[variant=ghost]/tool-group-root:hover:text-foreground group-data-[variant=ghost]/tool-group-root:py-1.5',
+ 'group-data-[variant=outline]/tool-group-root:w-full group-data-[variant=outline]/tool-group-root:px-4',
+ 'group-data-[variant=muted]/tool-group-root:w-full group-data-[variant=muted]/tool-group-root:px-4',
+ className
)}
- {...props}
- >
+ {...props}>
{active && (
<LoaderIcon
data-slot="tool-group-trigger-loader"
@@ -124,19 +104,17 @@ function ToolGroupTrigger({
<span
data-slot="tool-group-trigger-label"
className={cn(
- "aui-tool-group-trigger-label-wrapper relative inline-block text-start leading-none font-medium",
- "group-data-[variant=ghost]/tool-group-root:font-normal",
- "group-data-[variant=outline]/tool-group-root:grow",
- "group-data-[variant=muted]/tool-group-root:grow",
- )}
- >
+ 'aui-tool-group-trigger-label-wrapper relative inline-block text-start leading-none font-medium',
+ 'group-data-[variant=ghost]/tool-group-root:font-normal',
+ 'group-data-[variant=outline]/tool-group-root:grow',
+ 'group-data-[variant=muted]/tool-group-root:grow'
+ )}>
<span className="text-xs">{label}</span>
{active && (
<span
aria-hidden
data-slot="tool-group-trigger-shimmer"
- className="aui-tool-group-trigger-shimmer shimmer pointer-events-none absolute inset-0 text-xs motion-reduce:animate-none"
- >
+ className="aui-tool-group-trigger-shimmer shimmer pointer-events-none absolute inset-0 text-xs motion-reduce:animate-none">
{label}
</span>
)}
@@ -144,11 +122,11 @@ function ToolGroupTrigger({
<ChevronDownIcon
data-slot="tool-group-trigger-chevron"
className={cn(
- "aui-tool-group-trigger-chevron size-3 shrink-0",
- "transition-transform duration-(--animation-duration) ease-[cubic-bezier(0.32,0.72,0,1)] motion-reduce:transition-none",
- "-rotate-90",
- "group-data-open/trigger:rotate-0",
- "group-data-panel-open/trigger:rotate-0",
+ 'aui-tool-group-trigger-chevron size-3 shrink-0',
+ 'transition-transform duration-(--animation-duration) ease-[cubic-bezier(0.32,0.72,0,1)] motion-reduce:transition-none',
+ '-rotate-90',
+ 'group-data-open/trigger:rotate-0',
+ 'group-data-panel-open/trigger:rotate-0'
)}
/>
</CollapsibleTrigger>
@@ -164,48 +142,46 @@ function ToolGroupContent({
<CollapsibleContent
data-slot="tool-group-content"
className={cn(
- "aui-tool-group-content relative overflow-hidden text-sm outline-hidden",
- "group/collapsible-content ease-[cubic-bezier(0.32,0.72,0,1)] motion-reduce:animate-none",
- "data-closed:animate-collapsible-up",
- "data-open:animate-collapsible-down",
- "data-closed:fill-mode-forwards",
- "data-closed:pointer-events-none",
- "[--tw-duration:var(--animation-duration)]",
- className,
+ 'aui-tool-group-content relative overflow-hidden text-sm outline-hidden',
+ 'group/collapsible-content ease-[cubic-bezier(0.32,0.72,0,1)] motion-reduce:animate-none',
+ 'data-closed:animate-collapsible-up',
+ 'data-open:animate-collapsible-down',
+ 'data-closed:fill-mode-forwards',
+ 'data-closed:pointer-events-none',
+ '[--tw-duration:var(--animation-duration)]',
+ className
)}
- {...props}
- >
+ {...props}>
<div
className={cn(
- "mt-2 flex flex-col gap-2",
- "group-data-[variant=ghost]/tool-group-root:mt-1 group-data-[variant=ghost]/tool-group-root:gap-1",
- "group-data-[variant=outline]/tool-group-root:mt-3 group-data-[variant=outline]/tool-group-root:border-t group-data-[variant=outline]/tool-group-root:px-4 group-data-[variant=outline]/tool-group-root:pt-3",
- "group-data-[variant=muted]/tool-group-root:mt-3 group-data-[variant=muted]/tool-group-root:border-t group-data-[variant=muted]/tool-group-root:px-4 group-data-[variant=muted]/tool-group-root:pt-3",
- "[&>*]:animate-in [&>*]:fade-in-0 [&>*]:blur-in-[2px] [&>*]:slide-in-from-top-1 [&>*]:animation-duration-(--animation-duration) *:ease-[cubic-bezier(0.32,0.72,0,1)]",
- "motion-reduce:*:animate-none",
- "[&>*:nth-child(2)]:[animation-delay:40ms]",
- "[&>*:nth-child(3)]:[animation-delay:80ms]",
- "[&>*:nth-child(4)]:[animation-delay:120ms]",
- "[&>*:nth-child(n+5)]:[animation-delay:160ms]",
- )}
- >
+ 'mt-2 flex flex-col gap-2',
+ 'group-data-[variant=ghost]/tool-group-root:mt-1 group-data-[variant=ghost]/tool-group-root:gap-1',
+ 'group-data-[variant=outline]/tool-group-root:mt-3 group-data-[variant=outline]/tool-group-root:border-t group-data-[variant=outline]/tool-group-root:px-4 group-data-[variant=outline]/tool-group-root:pt-3',
+ 'group-data-[variant=muted]/tool-group-root:mt-3 group-data-[variant=muted]/tool-group-root:border-t group-data-[variant=muted]/tool-group-root:px-4 group-data-[variant=muted]/tool-group-root:pt-3',
+ '[&>*]:animate-in [&>*]:fade-in-0 [&>*]:blur-in-[2px] [&>*]:slide-in-from-top-1 [&>*]:animation-duration-(--animation-duration) *:ease-[cubic-bezier(0.32,0.72,0,1)]',
+ 'motion-reduce:*:animate-none',
+ '[&>*:nth-child(2)]:[animation-delay:40ms]',
+ '[&>*:nth-child(3)]:[animation-delay:80ms]',
+ '[&>*:nth-child(4)]:[animation-delay:120ms]',
+ '[&>*:nth-child(n+5)]:[animation-delay:160ms]'
+ )}>
{children}
</div>
</CollapsibleContent>
);
}
-type ToolGroupComponent = FC<
- PropsWithChildren<{ startIndex: number; endIndex: number }>
-> & {
+type ToolGroupComponent = FC<PropsWithChildren<{ startIndex: number; endIndex: number }>> & {
Root: typeof ToolGroupRoot;
Trigger: typeof ToolGroupTrigger;
Content: typeof ToolGroupContent;
};
-const ToolGroupImpl: FC<
- PropsWithChildren<{ startIndex: number; endIndex: number }>
-> = ({ children, startIndex, endIndex }) => {
+const ToolGroupImpl: FC<PropsWithChildren<{ startIndex: number; endIndex: number }>> = ({
+ children,
+ startIndex,
+ endIndex,
+}) => {
const toolCount = endIndex - startIndex + 1;
return (
@@ -224,15 +200,9 @@ const ToolGroupImpl: FC<
*/
const ToolGroup = memo(ToolGroupImpl) as unknown as ToolGroupComponent;
-ToolGroup.displayName = "ToolGroup";
+ToolGroup.displayName = 'ToolGroup';
ToolGroup.Root = ToolGroupRoot;
ToolGroup.Trigger = ToolGroupTrigger;
ToolGroup.Content = ToolGroupContent;
-export {
- ToolGroup,
- ToolGroupRoot,
- ToolGroupTrigger,
- ToolGroupContent,
- toolGroupVariants,
-};
+export { ToolGroup, ToolGroupRoot, ToolGroupTrigger, ToolGroupContent, toolGroupVariants };
diff --git a/app/src/components/assistant-ui/tooltip-icon-button.tsx b/app/src/components/assistant-ui/tooltip-icon-button.tsx
index 551326449d..b4e892959d 100644
--- a/app/src/components/assistant-ui/tooltip-icon-button.tsx
+++ b/app/src/components/assistant-ui/tooltip-icon-button.tsx
@@ -1,49 +1,43 @@
-"use client";
-
-import { type ComponentPropsWithRef, forwardRef } from "react";
+'use client';
+import { cn } from '@/components/assistant-ui/lib/utils';
+import { Button } from '@/components/assistant-ui/ui/button';
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
-} from "@/components/assistant-ui/ui/tooltip";
-import { Button } from "@/components/assistant-ui/ui/button";
-import { cn } from "@/components/assistant-ui/lib/utils";
+} from '@/components/assistant-ui/ui/tooltip';
+import { type ComponentPropsWithRef, forwardRef } from 'react';
export type TooltipIconButtonProps = ComponentPropsWithRef<typeof Button> & {
tooltip: string;
- side?: "top" | "bottom" | "left" | "right";
+ side?: 'top' | 'bottom' | 'left' | 'right';
};
-export const TooltipIconButton = forwardRef<
- HTMLButtonElement,
- TooltipIconButtonProps
->(({ children, tooltip, side = "bottom", className, ...rest }, ref) => {
- return (
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger
- render={
- <Button
- variant="ghost"
- size="icon"
- {...rest}
- className={cn(
- "aui-button-icon size-6 p-1 active:scale-90",
- className,
- )}
- ref={ref}
- />
- }
- >
- {children}
- <span className="aui-sr-only sr-only">{tooltip}</span>
- </TooltipTrigger>
- <TooltipContent side={side}>{tooltip}</TooltipContent>
- </Tooltip>
- </TooltipProvider>
- );
-});
+export const TooltipIconButton = forwardRef<HTMLButtonElement, TooltipIconButtonProps>(
+ ({ children, tooltip, side = 'bottom', className, ...rest }, ref) => {
+ return (
+ <TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger
+ render={
+ <Button
+ variant="ghost"
+ size="icon"
+ {...rest}
+ className={cn('aui-button-icon size-6 p-1 active:scale-90', className)}
+ ref={ref}
+ />
+ }>
+ {children}
+ <span className="aui-sr-only sr-only">{tooltip}</span>
+ </TooltipTrigger>
+ <TooltipContent side={side}>{tooltip}</TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ );
+ }
+);
-TooltipIconButton.displayName = "TooltipIconButton";
+TooltipIconButton.displayName = 'TooltipIconButton';
diff --git a/app/src/components/assistant-ui/ui/avatar.tsx b/app/src/components/assistant-ui/ui/avatar.tsx
index f7fe4123ba..cc8ca5c06d 100644
--- a/app/src/components/assistant-ui/ui/avatar.tsx
+++ b/app/src/components/assistant-ui/ui/avatar.tsx
@@ -1,109 +1,90 @@
-"use client"
+'use client';
-import * as React from "react"
-import { Avatar as AvatarPrimitive } from "@base-ui/react/avatar"
-
-import { cn } from "@/components/assistant-ui/lib/utils"
+import * as React from 'react';
+import { cn } from '@/components/assistant-ui/lib/utils';
+import { Avatar as AvatarPrimitive } from '@base-ui/react/avatar';
function Avatar({
className,
- size = "default",
+ size = 'default',
...props
-}: AvatarPrimitive.Root.Props & {
- size?: "default" | "sm" | "lg"
-}) {
+}: AvatarPrimitive.Root.Props & { size?: 'default' | 'sm' | 'lg' }) {
return (
<AvatarPrimitive.Root
data-slot="avatar"
data-size={size}
className={cn(
- "group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten",
+ 'group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten',
className
)}
{...props}
/>
- )
+ );
}
function AvatarImage({ className, ...props }: AvatarPrimitive.Image.Props) {
return (
<AvatarPrimitive.Image
data-slot="avatar-image"
- className={cn(
- "aspect-square size-full rounded-full object-cover",
- className
- )}
+ className={cn('aspect-square size-full rounded-full object-cover', className)}
{...props}
/>
- )
+ );
}
-function AvatarFallback({
- className,
- ...props
-}: AvatarPrimitive.Fallback.Props) {
+function AvatarFallback({ className, ...props }: AvatarPrimitive.Fallback.Props) {
return (
<AvatarPrimitive.Fallback
data-slot="avatar-fallback"
className={cn(
- "flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs",
+ 'flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs',
className
)}
{...props}
/>
- )
+ );
}
-function AvatarBadge({ className, ...props }: React.ComponentProps<"span">) {
+function AvatarBadge({ className, ...props }: React.ComponentProps<'span'>) {
return (
<span
data-slot="avatar-badge"
className={cn(
- "absolute right-0 bottom-0 z-10 inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground bg-blend-color ring-2 ring-background select-none",
- "group-data-[size=sm]/avatar:size-2 group-data-[size=sm]/avatar:[&>svg]:hidden",
- "group-data-[size=default]/avatar:size-2.5 group-data-[size=default]/avatar:[&>svg]:size-2",
- "group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2",
+ 'absolute right-0 bottom-0 z-10 inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground bg-blend-color ring-2 ring-background select-none',
+ 'group-data-[size=sm]/avatar:size-2 group-data-[size=sm]/avatar:[&>svg]:hidden',
+ 'group-data-[size=default]/avatar:size-2.5 group-data-[size=default]/avatar:[&>svg]:size-2',
+ 'group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2',
className
)}
{...props}
/>
- )
+ );
}
-function AvatarGroup({ className, ...props }: React.ComponentProps<"div">) {
+function AvatarGroup({ className, ...props }: React.ComponentProps<'div'>) {
return (
<div
data-slot="avatar-group"
className={cn(
- "group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:ring-background",
+ 'group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:ring-background',
className
)}
{...props}
/>
- )
+ );
}
-function AvatarGroupCount({
- className,
- ...props
-}: React.ComponentProps<"div">) {
+function AvatarGroupCount({ className, ...props }: React.ComponentProps<'div'>) {
return (
<div
data-slot="avatar-group-count"
className={cn(
- "relative flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-sm text-muted-foreground ring-2 ring-background group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=sm]/avatar-group:size-6 [&>svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3",
+ 'relative flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-sm text-muted-foreground ring-2 ring-background group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=sm]/avatar-group:size-6 [&>svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3',
className
)}
{...props}
/>
- )
+ );
}
-export {
- Avatar,
- AvatarImage,
- AvatarFallback,
- AvatarGroup,
- AvatarGroupCount,
- AvatarBadge,
-}
+export { Avatar, AvatarImage, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarBadge };
diff --git a/app/src/components/assistant-ui/ui/button.tsx b/app/src/components/assistant-ui/ui/button.tsx
index fce64c57f2..c76c8e212f 100644
--- a/app/src/components/assistant-ui/ui/button.tsx
+++ b/app/src/components/assistant-ui/ui/button.tsx
@@ -1,49 +1,45 @@
-import { Button as ButtonPrimitive } from "@base-ui/react/button"
-import { cva, type VariantProps } from "class-variance-authority"
-
-import { cn } from "@/components/assistant-ui/lib/utils"
+import { cn } from '@/components/assistant-ui/lib/utils';
+import { Button as ButtonPrimitive } from '@base-ui/react/button';
+import { cva, type VariantProps } from 'class-variance-authority';
const buttonVariants = cva(
"group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
{
variants: {
variant: {
- default: "bg-primary text-primary-foreground hover:bg-primary/80",
+ default: 'bg-primary text-primary-foreground hover:bg-primary/80',
outline:
- "border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
+ 'border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50',
secondary:
- "bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
+ 'bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground',
ghost:
- "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
+ 'hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50',
destructive:
- "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
- link: "text-primary underline-offset-4 hover:underline",
+ 'bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40',
+ link: 'text-primary underline-offset-4 hover:underline',
},
size: {
default:
- "h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
+ 'h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2',
xs: "h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
sm: "h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",
- lg: "h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
- icon: "size-8",
- "icon-xs":
+ lg: 'h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2',
+ icon: 'size-8',
+ 'icon-xs':
"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3",
- "icon-sm":
- "size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg",
- "icon-lg": "size-9",
+ 'icon-sm':
+ 'size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg',
+ 'icon-lg': 'size-9',
},
},
- defaultVariants: {
- variant: "default",
- size: "default",
- },
+ defaultVariants: { variant: 'default', size: 'default' },
}
-)
+);
function Button({
className,
- variant = "default",
- size = "default",
+ variant = 'default',
+ size = 'default',
...props
}: ButtonPrimitive.Props & VariantProps<typeof buttonVariants>) {
return (
@@ -52,7 +48,7 @@ function Button({
className={cn(buttonVariants({ variant, size, className }))}
{...props}
/>
- )
+ );
}
-export { Button, buttonVariants }
+export { Button, buttonVariants };
diff --git a/app/src/components/assistant-ui/ui/collapsible.tsx b/app/src/components/assistant-ui/ui/collapsible.tsx
index a23e7a2812..9605c4e41a 100644
--- a/app/src/components/assistant-ui/ui/collapsible.tsx
+++ b/app/src/components/assistant-ui/ui/collapsible.tsx
@@ -1,9 +1,9 @@
-import * as CollapsiblePrimitive from "@radix-ui/react-collapsible"
+import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
-const Collapsible = CollapsiblePrimitive.Root
+const Collapsible = CollapsiblePrimitive.Root;
-const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger
+const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger;
-const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent
+const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent;
-export { Collapsible, CollapsibleTrigger, CollapsibleContent }
+export { Collapsible, CollapsibleTrigger, CollapsibleContent };
diff --git a/app/src/components/assistant-ui/ui/command.tsx b/app/src/components/assistant-ui/ui/command.tsx
index 3d277dc006..f160fb3870 100644
--- a/app/src/components/assistant-ui/ui/command.tsx
+++ b/app/src/components/assistant-ui/ui/command.tsx
@@ -1,49 +1,42 @@
-import * as React from "react"
-import { Command as CommandPrimitive } from "cmdk"
-
-import { cn } from "@/components/assistant-ui/lib/utils"
+import * as React from 'react';
+import { cn } from '@/components/assistant-ui/lib/utils';
import {
Dialog,
DialogContent,
DialogDescription,
DialogHeader,
DialogTitle,
-} from "@/components/assistant-ui/ui/dialog"
-import {
- InputGroup,
- InputGroupAddon,
-} from "@/components/assistant-ui/ui/input-group"
-import { SearchIcon, CheckIcon } from "lucide-react"
+} from '@/components/assistant-ui/ui/dialog';
+import { InputGroup, InputGroupAddon } from '@/components/assistant-ui/ui/input-group';
+import { Command as CommandPrimitive } from 'cmdk';
+import { CheckIcon, SearchIcon } from 'lucide-react';
-function Command({
- className,
- ...props
-}: React.ComponentProps<typeof CommandPrimitive>) {
+function Command({ className, ...props }: React.ComponentProps<typeof CommandPrimitive>) {
return (
<CommandPrimitive
data-slot="command"
className={cn(
- "flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground",
+ 'flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground',
className
)}
{...props}
/>
- )
+ );
}
function CommandDialog({
- title = "Command Palette",
- description = "Search for a command to run...",
+ title = 'Command Palette',
+ description = 'Search for a command to run...',
children,
className,
showCloseButton = false,
...props
-}: Omit<React.ComponentProps<typeof Dialog>, "children"> & {
- title?: string
- description?: string
- className?: string
- showCloseButton?: boolean
- children: React.ReactNode
+}: Omit<React.ComponentProps<typeof Dialog>, 'children'> & {
+ title?: string;
+ description?: string;
+ className?: string;
+ showCloseButton?: boolean;
+ children: React.ReactNode;
}) {
return (
<Dialog {...props}>
@@ -52,16 +45,12 @@ function CommandDialog({
<DialogDescription>{description}</DialogDescription>
</DialogHeader>
<DialogContent
- className={cn(
- "top-1/3 translate-y-0 overflow-hidden rounded-xl! p-0",
- className
- )}
- showCloseButton={showCloseButton}
- >
+ className={cn('top-1/3 translate-y-0 overflow-hidden rounded-xl! p-0', className)}
+ showCloseButton={showCloseButton}>
{children}
</DialogContent>
</Dialog>
- )
+ );
}
function CommandInput({
@@ -74,7 +63,7 @@ function CommandInput({
<CommandPrimitive.Input
data-slot="command-input"
className={cn(
- "w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",
+ 'w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50',
className
)}
{...props}
@@ -84,23 +73,20 @@ function CommandInput({
</InputGroupAddon>
</InputGroup>
</div>
- )
+ );
}
-function CommandList({
- className,
- ...props
-}: React.ComponentProps<typeof CommandPrimitive.List>) {
+function CommandList({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.List>) {
return (
<CommandPrimitive.List
data-slot="command-list"
className={cn(
- "no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none",
+ 'no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none',
className
)}
{...props}
/>
- )
+ );
}
function CommandEmpty({
@@ -110,10 +96,10 @@ function CommandEmpty({
return (
<CommandPrimitive.Empty
data-slot="command-empty"
- className={cn("py-6 text-center text-sm", className)}
+ className={cn('py-6 text-center text-sm', className)}
{...props}
/>
- )
+ );
}
function CommandGroup({
@@ -124,12 +110,12 @@ function CommandGroup({
<CommandPrimitive.Group
data-slot="command-group"
className={cn(
- "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",
+ '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}
/>
- )
+ );
}
function CommandSeparator({
@@ -139,10 +125,10 @@ function CommandSeparator({
return (
<CommandPrimitive.Separator
data-slot="command-separator"
- className={cn("-mx-1 h-px bg-border", className)}
+ className={cn('-mx-1 h-px bg-border', className)}
{...props}
/>
- )
+ );
}
function CommandItem({
@@ -157,28 +143,24 @@ function CommandItem({
"group/command-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none in-data-[slot=dialog-content]:rounded-lg! data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-muted data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-selected:*:[svg]:text-foreground",
className
)}
- {...props}
- >
+ {...props}>
{children}
<CheckIcon className="ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100" />
</CommandPrimitive.Item>
- )
+ );
}
-function CommandShortcut({
- className,
- ...props
-}: React.ComponentProps<"span">) {
+function CommandShortcut({ className, ...props }: React.ComponentProps<'span'>) {
return (
<span
data-slot="command-shortcut"
className={cn(
- "ml-auto text-xs tracking-widest text-muted-foreground group-data-selected/command-item:text-foreground",
+ 'ml-auto text-xs tracking-widest text-muted-foreground group-data-selected/command-item:text-foreground',
className
)}
{...props}
/>
- )
+ );
}
export {
@@ -191,4 +173,4 @@ export {
CommandItem,
CommandShortcut,
CommandSeparator,
-}
+};
diff --git a/app/src/components/assistant-ui/ui/dialog.tsx b/app/src/components/assistant-ui/ui/dialog.tsx
index e8b1c803a2..58b56bfc69 100644
--- a/app/src/components/assistant-ui/ui/dialog.tsx
+++ b/app/src/components/assistant-ui/ui/dialog.tsx
@@ -1,40 +1,36 @@
-import * as React from "react"
-import { Dialog as DialogPrimitive } from "@base-ui/react/dialog"
-
-import { cn } from "@/components/assistant-ui/lib/utils"
-import { Button } from "@/components/assistant-ui/ui/button"
-import { XIcon } from "lucide-react"
+import * as React from 'react';
+import { cn } from '@/components/assistant-ui/lib/utils';
+import { Button } from '@/components/assistant-ui/ui/button';
+import { Dialog as DialogPrimitive } from '@base-ui/react/dialog';
+import { XIcon } from 'lucide-react';
function Dialog({ ...props }: DialogPrimitive.Root.Props) {
- return <DialogPrimitive.Root data-slot="dialog" {...props} />
+ return <DialogPrimitive.Root data-slot="dialog" {...props} />;
}
function DialogTrigger({ ...props }: DialogPrimitive.Trigger.Props) {
- return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />
+ return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />;
}
function DialogPortal({ ...props }: DialogPrimitive.Portal.Props) {
- return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />
+ return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />;
}
function DialogClose({ ...props }: DialogPrimitive.Close.Props) {
- return <DialogPrimitive.Close data-slot="dialog-close" {...props} />
+ return <DialogPrimitive.Close data-slot="dialog-close" {...props} />;
}
-function DialogOverlay({
- className,
- ...props
-}: DialogPrimitive.Backdrop.Props) {
+function DialogOverlay({ className, ...props }: DialogPrimitive.Backdrop.Props) {
return (
<DialogPrimitive.Backdrop
data-slot="dialog-overlay"
className={cn(
- "fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",
+ 'fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0',
className
)}
{...props}
/>
- )
+ );
}
function DialogContent({
@@ -42,50 +38,35 @@ function DialogContent({
children,
showCloseButton = true,
...props
-}: DialogPrimitive.Popup.Props & {
- showCloseButton?: boolean
-}) {
+}: DialogPrimitive.Popup.Props & { showCloseButton?: boolean }) {
return (
<DialogPortal>
<DialogOverlay />
<DialogPrimitive.Popup
data-slot="dialog-content"
className={cn(
- "fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
+ 'fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',
className
)}
- {...props}
- >
+ {...props}>
{children}
{showCloseButton && (
<DialogPrimitive.Close
data-slot="dialog-close"
- render={
- <Button
- variant="ghost"
- className="absolute top-2 right-2"
- size="icon-sm"
- />
- }
- >
- <XIcon
- />
+ render={<Button variant="ghost" className="absolute top-2 right-2" size="icon-sm" />}>
+ <XIcon />
<span className="sr-only">Close</span>
</DialogPrimitive.Close>
)}
</DialogPrimitive.Popup>
</DialogPortal>
- )
+ );
}
-function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
+function DialogHeader({ className, ...props }: React.ComponentProps<'div'>) {
return (
- <div
- data-slot="dialog-header"
- className={cn("flex flex-col gap-2", className)}
- {...props}
- />
- )
+ <div data-slot="dialog-header" className={cn('flex flex-col gap-2', className)} {...props} />
+ );
}
function DialogFooter({
@@ -93,55 +74,44 @@ function DialogFooter({
showCloseButton = false,
children,
...props
-}: React.ComponentProps<"div"> & {
- showCloseButton?: boolean
-}) {
+}: React.ComponentProps<'div'> & { showCloseButton?: boolean }) {
return (
<div
data-slot="dialog-footer"
className={cn(
- "-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end",
+ '-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end',
className
)}
- {...props}
- >
+ {...props}>
{children}
{showCloseButton && (
- <DialogPrimitive.Close render={<Button variant="outline" />}>
- Close
- </DialogPrimitive.Close>
+ <DialogPrimitive.Close render={<Button variant="outline" />}>Close</DialogPrimitive.Close>
)}
</div>
- )
+ );
}
function DialogTitle({ className, ...props }: DialogPrimitive.Title.Props) {
return (
<DialogPrimitive.Title
data-slot="dialog-title"
- className={cn(
- "font-heading text-base leading-none font-medium",
- className
- )}
+ className={cn('font-heading text-base leading-none font-medium', className)}
{...props}
/>
- )
+ );
}
-function DialogDescription({
- className,
- ...props
-}: DialogPrimitive.Description.Props) {
+function DialogDescription({ className, ...props }: DialogPrimitive.Description.Props) {
return (
<DialogPrimitive.Description
data-slot="dialog-description"
className={cn(
- "text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",
+ 'text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground',
className
)}
{...props}
/>
- )
+ );
}
export {
@@ -155,4 +125,4 @@ export {
DialogPortal,
DialogTitle,
DialogTrigger,
-}
+};
diff --git a/app/src/components/assistant-ui/ui/input-group.tsx b/app/src/components/assistant-ui/ui/input-group.tsx
index 743d4bb889..06cb2bdce5 100644
--- a/app/src/components/assistant-ui/ui/input-group.tsx
+++ b/app/src/components/assistant-ui/ui/input-group.tsx
@@ -1,23 +1,22 @@
-import * as React from "react"
-import { cva, type VariantProps } from "class-variance-authority"
+import * as React from 'react';
+import { cn } from '@/components/assistant-ui/lib/utils';
+import { Button } from '@/components/assistant-ui/ui/button';
+import { Input } from '@/components/assistant-ui/ui/input';
+import { Textarea } from '@/components/assistant-ui/ui/textarea';
+import { cva, type VariantProps } from 'class-variance-authority';
-import { cn } from "@/components/assistant-ui/lib/utils"
-import { Button } from "@/components/assistant-ui/ui/button"
-import { Input } from "@/components/assistant-ui/ui/input"
-import { Textarea } from "@/components/assistant-ui/ui/textarea"
-
-function InputGroup({ className, ...props }: React.ComponentProps<"div">) {
+function InputGroup({ className, ...props }: React.ComponentProps<'div'>) {
return (
<div
data-slot="input-group"
role="group"
className={cn(
- "group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5",
+ 'group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5',
className
)}
{...props}
/>
- )
+ );
}
const inputGroupAddonVariants = cva(
@@ -25,72 +24,60 @@ const inputGroupAddonVariants = cva(
{
variants: {
align: {
- "inline-start":
- "order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]",
- "inline-end":
- "order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]",
- "block-start":
- "order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2",
- "block-end":
- "order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2",
+ 'inline-start': 'order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]',
+ 'inline-end': 'order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]',
+ 'block-start':
+ 'order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2',
+ 'block-end':
+ 'order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2',
},
},
- defaultVariants: {
- align: "inline-start",
- },
+ defaultVariants: { align: 'inline-start' },
}
-)
+);
function InputGroupAddon({
className,
- align = "inline-start",
+ align = 'inline-start',
...props
-}: React.ComponentProps<"div"> & VariantProps<typeof inputGroupAddonVariants>) {
+}: React.ComponentProps<'div'> & VariantProps<typeof inputGroupAddonVariants>) {
return (
<div
role="group"
data-slot="input-group-addon"
data-align={align}
className={cn(inputGroupAddonVariants({ align }), className)}
- onClick={(e) => {
- if ((e.target as HTMLElement).closest("button")) {
- return
+ onClick={e => {
+ if ((e.target as HTMLElement).closest('button')) {
+ return;
}
- e.currentTarget.parentElement?.querySelector("input")?.focus()
+ e.currentTarget.parentElement?.querySelector('input')?.focus();
}}
{...props}
/>
- )
+ );
}
-const inputGroupButtonVariants = cva(
- "flex items-center gap-2 text-sm shadow-none",
- {
- variants: {
- size: {
- xs: "h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5",
- sm: "",
- "icon-xs":
- "size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0",
- "icon-sm": "size-8 p-0 has-[>svg]:p-0",
- },
- },
- defaultVariants: {
- size: "xs",
+const inputGroupButtonVariants = cva('flex items-center gap-2 text-sm shadow-none', {
+ variants: {
+ size: {
+ xs: "h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5",
+ sm: '',
+ 'icon-xs': 'size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0',
+ 'icon-sm': 'size-8 p-0 has-[>svg]:p-0',
},
- }
-)
+ },
+ defaultVariants: { size: 'xs' },
+});
function InputGroupButton({
className,
- type = "button",
- variant = "ghost",
- size = "xs",
+ type = 'button',
+ variant = 'ghost',
+ size = 'xs',
...props
-}: Omit<React.ComponentProps<typeof Button>, "size" | "type"> &
- VariantProps<typeof inputGroupButtonVariants> & {
- type?: "button" | "submit" | "reset"
- }) {
+}: Omit<React.ComponentProps<typeof Button>, 'size' | 'type'> &
+ VariantProps<typeof inputGroupButtonVariants> & { type?: 'button' | 'submit' | 'reset' }) {
return (
<Button
type={type}
@@ -99,10 +86,10 @@ function InputGroupButton({
className={cn(inputGroupButtonVariants({ size }), className)}
{...props}
/>
- )
+ );
}
-function InputGroupText({ className, ...props }: React.ComponentProps<"span">) {
+function InputGroupText({ className, ...props }: React.ComponentProps<'span'>) {
return (
<span
className={cn(
@@ -111,39 +98,33 @@ function InputGroupText({ className, ...props }: React.ComponentProps<"span">) {
)}
{...props}
/>
- )
+ );
}
-function InputGroupInput({
- className,
- ...props
-}: React.ComponentProps<"input">) {
+function InputGroupInput({ className, ...props }: React.ComponentProps<'input'>) {
return (
<Input
data-slot="input-group-control"
className={cn(
- "flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent",
+ 'flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent',
className
)}
{...props}
/>
- )
+ );
}
-function InputGroupTextarea({
- className,
- ...props
-}: React.ComponentProps<"textarea">) {
+function InputGroupTextarea({ className, ...props }: React.ComponentProps<'textarea'>) {
return (
<Textarea
data-slot="input-group-control"
className={cn(
- "flex-1 resize-none rounded-none border-0 bg-transparent py-2 shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent",
+ 'flex-1 resize-none rounded-none border-0 bg-transparent py-2 shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent',
className
)}
{...props}
/>
- )
+ );
}
export {
@@ -153,4 +134,4 @@ export {
InputGroupText,
InputGroupInput,
InputGroupTextarea,
-}
+};
diff --git a/app/src/components/assistant-ui/ui/input.tsx b/app/src/components/assistant-ui/ui/input.tsx
index c0c03764e6..ac150dd263 100644
--- a/app/src/components/assistant-ui/ui/input.tsx
+++ b/app/src/components/assistant-ui/ui/input.tsx
@@ -1,20 +1,19 @@
-import * as React from "react"
-import { Input as InputPrimitive } from "@base-ui/react/input"
+import * as React from 'react';
+import { cn } from '@/components/assistant-ui/lib/utils';
+import { Input as InputPrimitive } from '@base-ui/react/input';
-import { cn } from "@/components/assistant-ui/lib/utils"
-
-function Input({ className, type, ...props }: React.ComponentProps<"input">) {
+function Input({ className, type, ...props }: React.ComponentProps<'input'>) {
return (
<InputPrimitive
type={type}
data-slot="input"
className={cn(
- "h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
+ 'h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40',
className
)}
{...props}
/>
- )
+ );
}
-export { Input }
+export { Input };
diff --git a/app/src/components/assistant-ui/ui/popover.tsx b/app/src/components/assistant-ui/ui/popover.tsx
index d3321c19f8..868485a0f7 100644
--- a/app/src/components/assistant-ui/ui/popover.tsx
+++ b/app/src/components/assistant-ui/ui/popover.tsx
@@ -1,28 +1,24 @@
-import * as React from "react"
-import { Popover as PopoverPrimitive } from "@base-ui/react/popover"
-
-import { cn } from "@/components/assistant-ui/lib/utils"
+import * as React from 'react';
+import { cn } from '@/components/assistant-ui/lib/utils';
+import { Popover as PopoverPrimitive } from '@base-ui/react/popover';
function Popover({ ...props }: PopoverPrimitive.Root.Props) {
- return <PopoverPrimitive.Root data-slot="popover" {...props} />
+ return <PopoverPrimitive.Root data-slot="popover" {...props} />;
}
function PopoverTrigger({ ...props }: PopoverPrimitive.Trigger.Props) {
- return <PopoverPrimitive.Trigger data-slot="popover-trigger" {...props} />
+ return <PopoverPrimitive.Trigger data-slot="popover-trigger" {...props} />;
}
function PopoverContent({
className,
- align = "center",
+ align = 'center',
alignOffset = 0,
- side = "bottom",
+ side = 'bottom',
sideOffset = 4,
...props
}: PopoverPrimitive.Popup.Props &
- Pick<
- PopoverPrimitive.Positioner.Props,
- "align" | "alignOffset" | "side" | "sideOffset"
- >) {
+ Pick<PopoverPrimitive.Positioner.Props, 'align' | 'alignOffset' | 'side' | 'sideOffset'>) {
return (
<PopoverPrimitive.Portal>
<PopoverPrimitive.Positioner
@@ -30,59 +26,48 @@ function PopoverContent({
alignOffset={alignOffset}
side={side}
sideOffset={sideOffset}
- className="isolate z-50"
- >
+ className="isolate z-50">
<PopoverPrimitive.Popup
data-slot="popover-content"
className={cn(
- "z-50 flex w-72 origin-(--transform-origin) flex-col gap-2.5 rounded-lg bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
+ 'z-50 flex w-72 origin-(--transform-origin) flex-col gap-2.5 rounded-lg bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',
className
)}
{...props}
/>
</PopoverPrimitive.Positioner>
</PopoverPrimitive.Portal>
- )
+ );
}
-function PopoverHeader({ className, ...props }: React.ComponentProps<"div">) {
+function PopoverHeader({ className, ...props }: React.ComponentProps<'div'>) {
return (
<div
data-slot="popover-header"
- className={cn("flex flex-col gap-0.5 text-sm", className)}
+ className={cn('flex flex-col gap-0.5 text-sm', className)}
{...props}
/>
- )
+ );
}
function PopoverTitle({ className, ...props }: PopoverPrimitive.Title.Props) {
return (
<PopoverPrimitive.Title
data-slot="popover-title"
- className={cn("font-medium", className)}
+ className={cn('font-medium', className)}
{...props}
/>
- )
+ );
}
-function PopoverDescription({
- className,
- ...props
-}: PopoverPrimitive.Description.Props) {
+function PopoverDescription({ className, ...props }: PopoverPrimitive.Description.Props) {
return (
<PopoverPrimitive.Description
data-slot="popover-description"
- className={cn("text-muted-foreground", className)}
+ className={cn('text-muted-foreground', className)}
{...props}
/>
- )
+ );
}
-export {
- Popover,
- PopoverContent,
- PopoverDescription,
- PopoverHeader,
- PopoverTitle,
- PopoverTrigger,
-}
+export { Popover, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger };
diff --git a/app/src/components/assistant-ui/ui/sheet.tsx b/app/src/components/assistant-ui/ui/sheet.tsx
index 041ddce5c3..fba7f36203 100644
--- a/app/src/components/assistant-ui/ui/sheet.tsx
+++ b/app/src/components/assistant-ui/ui/sheet.tsx
@@ -1,24 +1,23 @@
-import * as React from "react"
-import { Dialog as SheetPrimitive } from "@base-ui/react/dialog"
-
-import { cn } from "@/components/assistant-ui/lib/utils"
-import { Button } from "@/components/assistant-ui/ui/button"
-import { XIcon } from "lucide-react"
+import * as React from 'react';
+import { cn } from '@/components/assistant-ui/lib/utils';
+import { Button } from '@/components/assistant-ui/ui/button';
+import { Dialog as SheetPrimitive } from '@base-ui/react/dialog';
+import { XIcon } from 'lucide-react';
function Sheet({ ...props }: SheetPrimitive.Root.Props) {
- return <SheetPrimitive.Root data-slot="sheet" {...props} />
+ return <SheetPrimitive.Root data-slot="sheet" {...props} />;
}
function SheetTrigger({ ...props }: SheetPrimitive.Trigger.Props) {
- return <SheetPrimitive.Trigger data-slot="sheet-trigger" {...props} />
+ return <SheetPrimitive.Trigger data-slot="sheet-trigger" {...props} />;
}
function SheetClose({ ...props }: SheetPrimitive.Close.Props) {
- return <SheetPrimitive.Close data-slot="sheet-close" {...props} />
+ return <SheetPrimitive.Close data-slot="sheet-close" {...props} />;
}
function SheetPortal({ ...props }: SheetPrimitive.Portal.Props) {
- return <SheetPrimitive.Portal data-slot="sheet-portal" {...props} />
+ return <SheetPrimitive.Portal data-slot="sheet-portal" {...props} />;
}
function SheetOverlay({ className, ...props }: SheetPrimitive.Backdrop.Props) {
@@ -26,23 +25,23 @@ function SheetOverlay({ className, ...props }: SheetPrimitive.Backdrop.Props) {
<SheetPrimitive.Backdrop
data-slot="sheet-overlay"
className={cn(
- "fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs",
+ 'fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs',
className
)}
{...props}
/>
- )
+ );
}
function SheetContent({
className,
children,
- side = "right",
+ side = 'right',
showCloseButton = true,
...props
}: SheetPrimitive.Popup.Props & {
- side?: "top" | "right" | "bottom" | "left"
- showCloseButton?: boolean
+ side?: 'top' | 'right' | 'bottom' | 'left';
+ showCloseButton?: boolean;
}) {
return (
<SheetPortal>
@@ -51,77 +50,62 @@ function SheetContent({
data-slot="sheet-content"
data-side={side}
className={cn(
- "fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",
+ 'fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm',
className
)}
- {...props}
- >
+ {...props}>
{children}
{showCloseButton && (
<SheetPrimitive.Close
data-slot="sheet-close"
- render={
- <Button
- variant="ghost"
- className="absolute top-3 right-3"
- size="icon-sm"
- />
- }
- >
- <XIcon
- />
+ render={<Button variant="ghost" className="absolute top-3 right-3" size="icon-sm" />}>
+ <XIcon />
<span className="sr-only">Close</span>
</SheetPrimitive.Close>
)}
</SheetPrimitive.Popup>
</SheetPortal>
- )
+ );
}
-function SheetHeader({ className, ...props }: React.ComponentProps<"div">) {
+function SheetHeader({ className, ...props }: React.ComponentProps<'div'>) {
return (
<div
data-slot="sheet-header"
- className={cn("flex flex-col gap-0.5 p-4", className)}
+ className={cn('flex flex-col gap-0.5 p-4', className)}
{...props}
/>
- )
+ );
}
-function SheetFooter({ className, ...props }: React.ComponentProps<"div">) {
+function SheetFooter({ className, ...props }: React.ComponentProps<'div'>) {
return (
<div
data-slot="sheet-footer"
- className={cn("mt-auto flex flex-col gap-2 p-4", className)}
+ className={cn('mt-auto flex flex-col gap-2 p-4', className)}
{...props}
/>
- )
+ );
}
function SheetTitle({ className, ...props }: SheetPrimitive.Title.Props) {
return (
<SheetPrimitive.Title
data-slot="sheet-title"
- className={cn(
- "font-heading text-base font-medium text-foreground",
- className
- )}
+ className={cn('font-heading text-base font-medium text-foreground', className)}
{...props}
/>
- )
+ );
}
-function SheetDescription({
- className,
- ...props
-}: SheetPrimitive.Description.Props) {
+function SheetDescription({ className, ...props }: SheetPrimitive.Description.Props) {
return (
<SheetPrimitive.Description
data-slot="sheet-description"
- className={cn("text-sm text-muted-foreground", className)}
+ className={cn('text-sm text-muted-foreground', className)}
{...props}
/>
- )
+ );
}
export {
@@ -133,4 +117,4 @@ export {
SheetFooter,
SheetTitle,
SheetDescription,
-}
+};
diff --git a/app/src/components/assistant-ui/ui/skeleton.tsx b/app/src/components/assistant-ui/ui/skeleton.tsx
index 8d44c8e9df..d25e234378 100644
--- a/app/src/components/assistant-ui/ui/skeleton.tsx
+++ b/app/src/components/assistant-ui/ui/skeleton.tsx
@@ -1,13 +1,13 @@
-import { cn } from "@/components/assistant-ui/lib/utils"
+import { cn } from '@/components/assistant-ui/lib/utils';
-function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
+function Skeleton({ className, ...props }: React.ComponentProps<'div'>) {
return (
<div
data-slot="skeleton"
- className={cn("animate-pulse rounded-md bg-muted", className)}
+ className={cn('animate-pulse rounded-md bg-muted', className)}
{...props}
/>
- )
+ );
}
-export { Skeleton }
+export { Skeleton };
diff --git a/app/src/components/assistant-ui/ui/textarea.tsx b/app/src/components/assistant-ui/ui/textarea.tsx
index 91a20395c4..890016864a 100644
--- a/app/src/components/assistant-ui/ui/textarea.tsx
+++ b/app/src/components/assistant-ui/ui/textarea.tsx
@@ -1,18 +1,17 @@
-import * as React from "react"
+import * as React from 'react';
+import { cn } from '@/components/assistant-ui/lib/utils';
-import { cn } from "@/components/assistant-ui/lib/utils"
-
-function Textarea({ className, ...props }: React.ComponentProps<"textarea">) {
+function Textarea({ className, ...props }: React.ComponentProps<'textarea'>) {
return (
<textarea
data-slot="textarea"
className={cn(
- "flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
+ 'flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40',
className
)}
{...props}
/>
- )
+ );
}
-export { Textarea }
+export { Textarea };
diff --git a/app/src/components/assistant-ui/ui/tooltip.tsx b/app/src/components/assistant-ui/ui/tooltip.tsx
index f8dd437185..d76a971725 100644
--- a/app/src/components/assistant-ui/ui/tooltip.tsx
+++ b/app/src/components/assistant-ui/ui/tooltip.tsx
@@ -1,41 +1,28 @@
-import { Tooltip as TooltipPrimitive } from "@base-ui/react/tooltip"
+import { cn } from '@/components/assistant-ui/lib/utils';
+import { Tooltip as TooltipPrimitive } from '@base-ui/react/tooltip';
-import { cn } from "@/components/assistant-ui/lib/utils"
-
-function TooltipProvider({
- delay = 0,
- ...props
-}: TooltipPrimitive.Provider.Props) {
- return (
- <TooltipPrimitive.Provider
- data-slot="tooltip-provider"
- delay={delay}
- {...props}
- />
- )
+function TooltipProvider({ delay = 0, ...props }: TooltipPrimitive.Provider.Props) {
+ return <TooltipPrimitive.Provider data-slot="tooltip-provider" delay={delay} {...props} />;
}
function Tooltip({ ...props }: TooltipPrimitive.Root.Props) {
- return <TooltipPrimitive.Root data-slot="tooltip" {...props} />
+ return <TooltipPrimitive.Root data-slot="tooltip" {...props} />;
}
function TooltipTrigger({ ...props }: TooltipPrimitive.Trigger.Props) {
- return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />
+ return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />;
}
function TooltipContent({
className,
- side = "top",
+ side = 'top',
sideOffset = 4,
- align = "center",
+ align = 'center',
alignOffset = 0,
children,
...props
}: TooltipPrimitive.Popup.Props &
- Pick<
- TooltipPrimitive.Positioner.Props,
- "align" | "alignOffset" | "side" | "sideOffset"
- >) {
+ Pick<TooltipPrimitive.Positioner.Props, 'align' | 'alignOffset' | 'side' | 'sideOffset'>) {
return (
<TooltipPrimitive.Portal>
<TooltipPrimitive.Positioner
@@ -43,22 +30,20 @@ function TooltipContent({
alignOffset={alignOffset}
side={side}
sideOffset={sideOffset}
- className="isolate z-50"
- >
+ className="isolate z-50">
<TooltipPrimitive.Popup
data-slot="tooltip-content"
className={cn(
- "z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
+ 'z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',
className
)}
- {...props}
- >
+ {...props}>
{children}
<TooltipPrimitive.Arrow className="z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5" />
</TooltipPrimitive.Popup>
</TooltipPrimitive.Positioner>
</TooltipPrimitive.Portal>
- )
+ );
}
-export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }
+export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
diff --git a/app/src/index.css b/app/src/index.css
index 6aaccb3ebc..c889eaaa49 100644
--- a/app/src/index.css
+++ b/app/src/index.css
@@ -243,21 +243,15 @@
--shadow-glow: 0 0 20px rgba(91, 155, 243, 0.15);
--shadow-glow-lg: 0 0 40px rgba(91, 155, 243, 0.2);
--shadow-inner-glow: inset 0 0 20px rgba(91, 155, 243, 0.08);
- --shadow-subtle:
- 0 1px 2px 0 rgba(0, 0, 0, 0.03), 0 1px 3px 0 rgba(0, 0, 0, 0.04);
- --shadow-soft:
- 0 2px 8px -2px rgba(0, 0, 0, 0.08), 0 4px 12px -4px rgba(0, 0, 0, 0.08);
- --shadow-medium:
- 0 4px 12px -2px rgba(0, 0, 0, 0.08), 0 8px 16px -4px rgba(0, 0, 0, 0.08);
- --shadow-large:
- 0 8px 24px -4px rgba(0, 0, 0, 0.1), 0 16px 32px -8px rgba(0, 0, 0, 0.1);
- --shadow-float:
- 0 12px 32px -8px rgba(0, 0, 0, 0.12), 0 24px 48px -12px rgba(0, 0, 0, 0.12);
+ --shadow-subtle: 0 1px 2px 0 rgba(0, 0, 0, 0.03), 0 1px 3px 0 rgba(0, 0, 0, 0.04);
+ --shadow-soft: 0 2px 8px -2px rgba(0, 0, 0, 0.08), 0 4px 12px -4px rgba(0, 0, 0, 0.08);
+ --shadow-medium: 0 4px 12px -2px rgba(0, 0, 0, 0.08), 0 8px 16px -4px rgba(0, 0, 0, 0.08);
+ --shadow-large: 0 8px 24px -4px rgba(0, 0, 0, 0.1), 0 16px 32px -8px rgba(0, 0, 0, 0.1);
+ --shadow-float: 0 12px 32px -8px rgba(0, 0, 0, 0.12), 0 24px 48px -12px rgba(0, 0, 0, 0.12);
--shadow-crisp: 0 0 0 1px rgba(0, 0, 0, 0.05), 0 2px 4px rgba(0, 0, 0, 0.08);
--shadow-cmd-palette: var(--cmd-shadow-palette);
--shadow-content-edge:
- inset 0 0 0 1px rgb(var(--line-chrome) / 0.45),
- inset 0 -1px 0 rgb(var(--line-chrome) / 0.7);
+ inset 0 0 0 1px rgb(var(--line-chrome) / 0.45), inset 0 -1px 0 rgb(var(--line-chrome) / 0.7);
--animate-fade-in: fadeIn 0.2s ease-out forwards;
--animate-fade-up: fadeUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
diff --git a/app/src/pages/dev/assistant-ui-demo/BaseDemo.tsx b/app/src/pages/dev/assistant-ui-demo/BaseDemo.tsx
index 940063fccf..a0475008bb 100644
--- a/app/src/pages/dev/assistant-ui-demo/BaseDemo.tsx
+++ b/app/src/pages/dev/assistant-ui-demo/BaseDemo.tsx
@@ -1,55 +1,56 @@
-"use client";
+'use client';
import {
ComposerAddAttachment,
ComposerAttachments,
UserMessageAttachments,
-} from "@/components/assistant-ui/attachment";
-import { MarkdownText } from "@/components/assistant-ui/markdown-text";
-import { DotMatrix } from "@/components/assistant-ui/dot-matrix";
-import { MessageTiming } from "@/components/assistant-ui/message-timing";
-import { ToolFallback } from "@/components/assistant-ui/tool-fallback";
+} from '@/components/assistant-ui/attachment';
+import { ComposerTriggerPopover } from '@/components/assistant-ui/composer-trigger-popover';
+import { DirectiveText } from '@/components/assistant-ui/directive-text';
+import { DotMatrix } from '@/components/assistant-ui/dot-matrix';
+import { cn } from '@/components/assistant-ui/lib/utils';
+import { MarkdownText } from '@/components/assistant-ui/markdown-text';
+import { MessageTiming } from '@/components/assistant-ui/message-timing';
+import { ModelSelector } from '@/components/assistant-ui/model-selector';
import {
- ToolGroupContent,
- ToolGroupRoot,
- ToolGroupTrigger,
-} from "@/components/assistant-ui/tool-group";
-import { CloneThreadShell } from "./CloneThreadShell";
-import { TooltipIconButton } from "@/components/assistant-ui/tooltip-icon-button";
+ ComposerQuotePreview,
+ QuoteBlock,
+ SelectionToolbar,
+} from '@/components/assistant-ui/quote';
import {
Reasoning,
ReasoningContent,
ReasoningRoot,
ReasoningText,
ReasoningTrigger,
-} from "@/components/assistant-ui/reasoning";
-import { Button } from "@/components/assistant-ui/ui/button";
-import { Skeleton } from "@/components/assistant-ui/ui/skeleton";
-import { cn } from "@/components/assistant-ui/lib/utils";
+} from '@/components/assistant-ui/reasoning';
+import { ToolFallback } from '@/components/assistant-ui/tool-fallback';
import {
- ComposerQuotePreview,
- QuoteBlock,
- SelectionToolbar,
-} from "@/components/assistant-ui/quote";
-import { ComposerTriggerPopover } from "@/components/assistant-ui/composer-trigger-popover";
-import { DirectiveText } from "@/components/assistant-ui/directive-text";
+ ToolGroupContent,
+ ToolGroupRoot,
+ ToolGroupTrigger,
+} from '@/components/assistant-ui/tool-group';
+import { TooltipIconButton } from '@/components/assistant-ui/tooltip-icon-button';
+import { Button } from '@/components/assistant-ui/ui/button';
+import { Skeleton } from '@/components/assistant-ui/ui/skeleton';
import {
ActionBarMorePrimitive,
ActionBarPrimitive,
- AuiIf,
type AssistantState,
+ AuiIf,
BranchPickerPrimitive,
ComposerPrimitive,
ErrorPrimitive,
groupPartByType,
MessagePrimitive,
ThreadPrimitive,
+ type Unstable_SlashCommand,
unstable_useMentionAdapter,
unstable_useSlashCommandAdapter,
useAui,
useAuiState,
- type Unstable_SlashCommand,
-} from "@assistant-ui/react";
+} from '@assistant-ui/react';
+import { type DirectiveChipProps, LexicalComposerInput } from '@assistant-ui/react-lexical';
import {
ArrowDownIcon,
ArrowUpIcon,
@@ -77,31 +78,21 @@ import {
SlashIcon,
SquareIcon,
WrenchIcon,
-} from "lucide-react";
-import {
- LexicalComposerInput,
- type DirectiveChipProps,
-} from "@assistant-ui/react-lexical";
-import { useState, type FC, type ReactNode } from "react";
-import { ModelSelector } from "@/components/assistant-ui/model-selector";
-import { DEFAULT_MODEL_ID, demoModelOptions } from "./demoModels";
+} from 'lucide-react';
+import { type FC, type ReactNode, useState } from 'react';
+
+import { CloneThreadShell } from './CloneThreadShell';
+import { DEFAULT_MODEL_ID, demoModelOptions } from './demoModels';
const Logo: FC<{ collapsed?: boolean }> = ({ collapsed = false }) => {
return (
<div
className={cn(
- "flex items-center text-sm font-medium",
- collapsed ? "size-8 shrink-0 justify-center" : "min-w-0 gap-2 px-2",
- )}
- >
- <img
- src="/logo.png"
- alt="logo"
- className="size-5 shrink-0 rounded-sm"
- />
- {!collapsed && (
- <span className="text-foreground/90 truncate">assistant-ui</span>
- )}
+ 'flex items-center text-sm font-medium',
+ collapsed ? 'size-8 shrink-0 justify-center' : 'min-w-0 gap-2 px-2'
+ )}>
+ <img src="/logo.png" alt="logo" className="size-5 shrink-0 rounded-sm" />
+ {!collapsed && <span className="text-foreground/90 truncate">assistant-ui</span>}
</div>
);
};
@@ -122,15 +113,10 @@ const ModelPicker: FC = () => {
const ThreadTitle: FC = () => {
const title = useAuiState(
- (s) =>
- s.threads.threadItems.find((t) => t.id === s.threads.mainThreadId)?.title,
+ s => s.threads.threadItems.find(t => t.id === s.threads.mainThreadId)?.title
);
- return (
- <span className="min-w-0 truncate text-sm font-medium">
- {title ?? "New Chat"}
- </span>
- );
+ return <span className="min-w-0 truncate text-sm font-medium">{title ?? 'New Chat'}</span>;
};
const Header: FC<{
@@ -144,19 +130,17 @@ const Header: FC<{
variant="ghost"
size="icon"
className="size-8 shrink-0 md:hidden"
- onClick={onOpenMobileSidebar}
- >
+ onClick={onOpenMobileSidebar}>
<MenuIcon className="size-4" />
<span className="sr-only">Toggle menu</span>
</Button>
<TooltipIconButton
variant="ghost"
size="icon"
- tooltip={sidebarCollapsed ? "Show sidebar" : "Hide sidebar"}
+ tooltip={sidebarCollapsed ? 'Show sidebar' : 'Hide sidebar'}
side="bottom"
onClick={onToggleSidebar}
- className="hidden size-8 md:flex"
- >
+ className="hidden size-8 md:flex">
<PanelLeftIcon className="size-4" />
</TooltipIconButton>
<ThreadTitle />
@@ -166,8 +150,7 @@ const Header: FC<{
tooltip="Share"
side="bottom"
disabled
- className="ml-auto size-8"
- >
+ className="ml-auto size-8">
<ShareIcon className="size-4" />
</TooltipIconButton>
</header>
@@ -177,8 +160,7 @@ const Header: FC<{
// Startup exposes a loading placeholder thread; treat it as a new chat so
// the composer mounts centered. Loads after startup keep the docked layout.
const isNewChatView = (s: AssistantState) =>
- s.thread.messages.length === 0 &&
- (!s.thread.isLoading || s.threads.isLoading);
+ s.thread.messages.length === 0 && (!s.thread.isLoading || s.threads.isLoading);
// A switched thread that is still fetching its history: skeleton, not welcome.
const isHistoryLoadingView = (s: AssistantState) =>
@@ -191,8 +173,7 @@ const ThreadHistorySkeleton: FC = () => (
<div
data-slot="aui_thread-history-skeleton"
role="status"
- className="animate-in fade-in fill-mode-both mx-auto flex w-full max-w-(--thread-max-width) flex-col gap-y-6 [animation-delay:150ms] [animation-duration:200ms]"
- >
+ className="animate-in fade-in fill-mode-both mx-auto flex w-full max-w-(--thread-max-width) flex-col gap-y-6 [animation-delay:150ms] [animation-duration:200ms]">
<span className="sr-only">Loading conversation</span>
<Skeleton className="ml-auto h-9 w-2/5 rounded-xl motion-reduce:animate-none" />
<div className="flex flex-col gap-y-2">
@@ -215,20 +196,18 @@ const Thread: FC = () => {
<ThreadPrimitive.Root
className="aui-root aui-thread-root bg-background @container flex h-full flex-col"
style={{
- ["--thread-max-width" as string]: "44rem",
- ["--composer-bg" as string]: "var(--color-card)",
- ["--composer-radius" as string]: "1.5rem",
- ["--composer-padding" as string]: "8px",
- }}
- >
+ ['--thread-max-width' as string]: '44rem',
+ ['--composer-bg' as string]: 'var(--color-card)',
+ ['--composer-radius' as string]: '1.5rem',
+ ['--composer-padding' as string]: '8px',
+ }}>
<ThreadPrimitive.Viewport
turnAnchor="top"
data-slot="aui_thread-viewport"
className={cn(
- "relative flex flex-1 flex-col overflow-x-auto overflow-y-scroll scroll-smooth px-4 pt-4",
- isEmpty && "justify-center",
- )}
- >
+ 'relative flex flex-1 flex-col overflow-x-auto overflow-y-scroll scroll-smooth px-4 pt-4',
+ isEmpty && 'justify-center'
+ )}>
<AuiIf condition={isNewChatView}>
<ThreadWelcome />
</AuiIf>
@@ -236,14 +215,11 @@ const Thread: FC = () => {
<ThreadHistorySkeleton />
</AuiIf>
- <div
- data-slot="aui_message-group"
- className="mb-14 flex flex-col gap-y-6 empty:hidden"
- >
+ <div data-slot="aui_message-group" className="mb-14 flex flex-col gap-y-6 empty:hidden">
<ThreadPrimitive.Messages>
{({ message }) => {
if (message.composer.isEditing) return <EditComposer />;
- if (message.role === "user") return <UserMessage />;
+ if (message.role === 'user') return <UserMessage />;
return <AssistantMessage />;
}}
</ThreadPrimitive.Messages>
@@ -251,15 +227,14 @@ const Thread: FC = () => {
<ThreadPrimitive.ViewportFooter
className={cn(
- "aui-thread-viewport-footer bg-background mx-auto flex w-full max-w-(--thread-max-width) flex-col gap-4 overflow-visible pb-4 md:pb-6",
- !isEmpty && "sticky bottom-0 mt-auto rounded-t-(--composer-radius)",
- )}
- >
+ 'aui-thread-viewport-footer bg-background mx-auto flex w-full max-w-(--thread-max-width) flex-col gap-4 overflow-visible pb-4 md:pb-6',
+ !isEmpty && 'sticky bottom-0 mt-auto rounded-t-(--composer-radius)'
+ )}>
<ThreadScrollToBottom />
<Composer />
<AuiIf condition={isNewChatView}>
<div className="aui-thread-welcome-suggestions-shell min-h-19">
- <AuiIf condition={(s) => s.composer.isEmpty}>
+ <AuiIf condition={s => s.composer.isEmpty}>
<ThreadSuggestions />
</AuiIf>
</div>
@@ -278,8 +253,7 @@ const ThreadScrollToBottom: FC = () => {
<TooltipIconButton
tooltip="Scroll to bottom"
variant="outline"
- className="aui-thread-scroll-to-bottom dark:border-border dark:bg-background dark:hover:bg-accent absolute -top-12 z-10 self-center rounded-full p-4 disabled:invisible"
- >
+ className="aui-thread-scroll-to-bottom dark:border-border dark:bg-background dark:hover:bg-accent absolute -top-12 z-10 self-center rounded-full p-4 disabled:invisible">
<ArrowDownIcon />
</TooltipIconButton>
</ThreadPrimitive.ScrollToBottom>
@@ -304,114 +278,90 @@ type SuggestionGroup = {
const SUGGESTION_GROUPS: SuggestionGroup[] = [
{
- label: "Weather",
+ label: 'Weather',
icon: <CloudSunIcon />,
options: [
- {
- label: "in San Francisco",
- prompt: "What's the weather in San Francisco?",
- },
- { label: "in Singapore", prompt: "What's the weather in Singapore?" },
- { label: "in Tokyo", prompt: "What's the weather in Tokyo?" },
- { label: "in London", prompt: "What's the weather in London?" },
+ { label: 'in San Francisco', prompt: "What's the weather in San Francisco?" },
+ { label: 'in Singapore', prompt: "What's the weather in Singapore?" },
+ { label: 'in Tokyo', prompt: "What's the weather in Tokyo?" },
+ { label: 'in London', prompt: "What's the weather in London?" },
],
},
{
- label: "Code",
+ label: 'Code',
icon: <CodeXmlIcon />,
options: [
+ { label: 'explain React hooks', prompt: 'Explain React hooks like useState and useEffect' },
+ { label: 'write a debounce function', prompt: 'Write a debounce function in TypeScript' },
{
- label: "explain React hooks",
- prompt: "Explain React hooks like useState and useEffect",
- },
- {
- label: "write a debounce function",
- prompt: "Write a debounce function in TypeScript",
- },
- {
- label: "review a useEffect cleanup",
- prompt: "Show me the right way to clean up a subscription in useEffect",
+ label: 'review a useEffect cleanup',
+ prompt: 'Show me the right way to clean up a subscription in useEffect',
},
],
},
{
- label: "Write",
+ label: 'Write',
icon: <PencilLineIcon />,
options: [
{
- label: "a birthday card message",
- prompt:
- "Help me write a birthday card message for a friend in the notepad",
+ label: 'a birthday card message',
+ prompt: 'Help me write a birthday card message for a friend in the notepad',
},
{
- label: "a product announcement",
- prompt: "Draft a short product announcement for a new dark mode",
+ label: 'a product announcement',
+ prompt: 'Draft a short product announcement for a new dark mode',
},
{
- label: "release notes",
- prompt:
- "Write release notes for a bugfix release of a React component library",
+ label: 'release notes',
+ prompt: 'Write release notes for a bugfix release of a React component library',
},
{
- label: "a PR description",
- prompt:
- "Write a pull request description for a change that adds keyboard shortcuts",
+ label: 'a PR description',
+ prompt: 'Write a pull request description for a change that adds keyboard shortcuts',
},
],
},
{
- label: "Analyze",
+ label: 'Analyze',
icon: <ChartColumnIcon />,
options: [
+ { label: 'React vs Vue vs Svelte', prompt: 'Compare React, Vue, and Svelte in a table' },
{
- label: "React vs Vue vs Svelte",
- prompt: "Compare React, Vue, and Svelte in a table",
+ label: 'GDP of US, China, Japan',
+ prompt: 'Compare the GDP of the United States, China, and Japan in a table',
},
{
- label: "GDP of US, China, Japan",
- prompt:
- "Compare the GDP of the United States, China, and Japan in a table",
- },
- {
- label: "pros and cons of SSR",
- prompt: "What are the pros and cons of server-side rendering?",
+ label: 'pros and cons of SSR',
+ prompt: 'What are the pros and cons of server-side rendering?',
},
],
},
{
- label: "Brainstorm",
+ label: 'Brainstorm',
icon: <LightbulbIcon />,
options: [
{
- label: "side project ideas",
- prompt: "Brainstorm five side project ideas for a React developer",
- },
- {
- label: "names for a dev tool",
- prompt: "Brainstorm names for a developer tools startup",
- },
- {
- label: "talk topics",
- prompt: "Brainstorm talk topics for a React meetup",
+ label: 'side project ideas',
+ prompt: 'Brainstorm five side project ideas for a React developer',
},
+ { label: 'names for a dev tool', prompt: 'Brainstorm names for a developer tools startup' },
+ { label: 'talk topics', prompt: 'Brainstorm talk topics for a React meetup' },
],
},
];
const suggestionChipClass =
- "aui-thread-welcome-suggestion text-foreground hover:bg-muted border-border/60 h-auto gap-1.5 rounded-full border px-3.5 py-1.5 text-sm font-normal whitespace-nowrap transition-colors [&_svg]:size-4";
+ 'aui-thread-welcome-suggestion text-foreground hover:bg-muted border-border/60 h-auto gap-1.5 rounded-full border px-3.5 py-1.5 text-sm font-normal whitespace-nowrap transition-colors [&_svg]:size-4';
const ThreadSuggestions: FC = () => {
const aui = useAui();
const [expandedLabel, setExpandedLabel] = useState<string | null>(null);
- const expandedGroup = SUGGESTION_GROUPS.find(
- (group) => group.label === expandedLabel,
- );
+ const expandedGroup = SUGGESTION_GROUPS.find(group => group.label === expandedLabel);
const sendPrompt = (prompt: string) => {
if (aui.thread.getState().isRunning) return;
aui.thread.append({
- content: [{ type: "text", text: prompt }],
+ content: [{ type: 'text', text: prompt }],
runConfig: aui.composer.getState().runConfig,
});
};
@@ -420,20 +370,12 @@ const ThreadSuggestions: FC = () => {
<div className="aui-thread-welcome-suggestions flex w-full flex-col gap-2 px-4">
<div className="w-full scrollbar-none overflow-x-auto">
<div className="mx-auto flex w-max items-center gap-2">
- {SUGGESTION_GROUPS.map((group) => (
+ {SUGGESTION_GROUPS.map(group => (
<Button
key={group.label}
variant="ghost"
- className={cn(
- suggestionChipClass,
- group.label === expandedLabel && "bg-muted",
- )}
- onClick={() =>
- setExpandedLabel(
- group.label === expandedLabel ? null : group.label,
- )
- }
- >
+ className={cn(suggestionChipClass, group.label === expandedLabel && 'bg-muted')}
+ onClick={() => setExpandedLabel(group.label === expandedLabel ? null : group.label)}>
{group.icon}
{group.label}
</Button>
@@ -443,16 +385,14 @@ const ThreadSuggestions: FC = () => {
{expandedGroup && (
<div
key={expandedGroup.label}
- className="fade-in slide-in-from-top-1 animate-in w-full scrollbar-none overflow-x-auto duration-200"
- >
+ className="fade-in slide-in-from-top-1 animate-in w-full scrollbar-none overflow-x-auto duration-200">
<div className="mx-auto flex w-max items-center gap-2">
- {expandedGroup.options.map((option) => (
+ {expandedGroup.options.map(option => (
<Button
key={option.label}
variant="ghost"
className={suggestionChipClass}
- onClick={() => sendPrompt(option.prompt)}
- >
+ onClick={() => sendPrompt(option.prompt)}>
{option.label}
</Button>
))}
@@ -465,28 +405,28 @@ const ThreadSuggestions: FC = () => {
const slashCommands: readonly Unstable_SlashCommand[] = [
{
- id: "summarize",
- description: "Summarize the conversation",
- icon: "FileText",
- execute: () => console.log("[base example] /summarize invoked"),
+ id: 'summarize',
+ description: 'Summarize the conversation',
+ icon: 'FileText',
+ execute: () => console.log('[base example] /summarize invoked'),
},
{
- id: "translate",
- description: "Translate text to another language",
- icon: "Languages",
- execute: () => console.log("[base example] /translate invoked"),
+ id: 'translate',
+ description: 'Translate text to another language',
+ icon: 'Languages',
+ execute: () => console.log('[base example] /translate invoked'),
},
{
- id: "search",
- description: "Search the web for information",
- icon: "Globe",
- execute: () => console.log("[base example] /search invoked"),
+ id: 'search',
+ description: 'Search the web for information',
+ icon: 'Globe',
+ execute: () => console.log('[base example] /search invoked'),
},
{
- id: "help",
- description: "List available commands",
- icon: "HelpCircle",
- execute: () => console.log("[base example] /help invoked"),
+ id: 'help',
+ description: 'List available commands',
+ icon: 'HelpCircle',
+ execute: () => console.log('[base example] /help invoked'),
},
];
@@ -499,13 +439,12 @@ const slashIconMap: Record<string, FC<{ className?: string }>> = {
function DirectiveChip(props: DirectiveChipProps) {
const { directiveId, directiveType, label } = props;
- const showWrench = directiveType !== "command";
+ const showWrench = directiveType !== 'command';
return (
<span
className="aui-directive-chip"
data-directive-type={directiveType}
- data-directive-id={directiveId}
- >
+ data-directive-id={directiveId}>
{showWrench && (
<span className="aui-directive-chip-icon">
<WrenchIcon className="size-3" />
@@ -530,8 +469,7 @@ const Composer: FC = () => {
<ComposerPrimitive.AttachmentDropzone asChild>
<div
data-slot="aui_composer-shell"
- className="border-border/60 data-[dragging=true]:border-ring focus-within:border-border dark:border-muted-foreground/15 dark:focus-within:border-muted-foreground/30 flex w-full cursor-text flex-col gap-2 rounded-(--composer-radius) border bg-(--composer-bg) p-(--composer-padding) transition-[border-color] data-[dragging=true]:border-dashed data-[dragging=true]:bg-[color-mix(in_oklab,var(--color-accent)_50%,var(--color-background))]"
- >
+ className="border-border/60 data-[dragging=true]:border-ring focus-within:border-border dark:border-muted-foreground/15 dark:focus-within:border-muted-foreground/30 flex w-full cursor-text flex-col gap-2 rounded-(--composer-radius) border bg-(--composer-bg) p-(--composer-padding) transition-[border-color] data-[dragging=true]:border-dashed data-[dragging=true]:bg-[color-mix(in_oklab,var(--color-accent)_50%,var(--color-background))]">
<ComposerQuotePreview />
<ComposerAttachments />
<LexicalComposerInput
@@ -545,11 +483,7 @@ const Composer: FC = () => {
<ComposerTriggerPopover char="@" {...mention} />
- <ComposerTriggerPopover
- char="/"
- {...slash}
- emptyItemsLabel="No matching commands"
- />
+ <ComposerTriggerPopover char="/" {...slash} emptyItemsLabel="No matching commands" />
</ComposerPrimitive.Root>
</ComposerPrimitive.Unstable_TriggerPopoverRoot>
);
@@ -563,8 +497,8 @@ const ComposerAction: FC = () => {
<ModelPicker />
</div>
<div className="flex items-center gap-1.5">
- <AuiIf condition={(s) => s.thread.capabilities.dictation}>
- <AuiIf condition={(s) => s.composer.dictation == null}>
+ <AuiIf condition={s => s.thread.capabilities.dictation}>
+ <AuiIf condition={s => s.composer.dictation == null}>
<ComposerPrimitive.Dictate asChild>
<TooltipIconButton
tooltip="Voice input"
@@ -573,13 +507,12 @@ const ComposerAction: FC = () => {
variant="ghost"
size="icon"
className="aui-composer-dictate text-muted-foreground hover:text-foreground size-7 rounded-full"
- aria-label="Start voice input"
- >
+ aria-label="Start voice input">
<MicIcon className="aui-composer-dictate-icon size-4" />
</TooltipIconButton>
</ComposerPrimitive.Dictate>
</AuiIf>
- <AuiIf condition={(s) => s.composer.dictation != null}>
+ <AuiIf condition={s => s.composer.dictation != null}>
<ComposerPrimitive.StopDictation asChild>
<TooltipIconButton
tooltip="Stop dictation"
@@ -588,14 +521,13 @@ const ComposerAction: FC = () => {
variant="ghost"
size="icon"
className="aui-composer-stop-dictation text-destructive size-7 rounded-full"
- aria-label="Stop voice input"
- >
+ aria-label="Stop voice input">
<SquareIcon className="aui-composer-stop-dictation-icon size-3.5 animate-pulse fill-current" />
</TooltipIconButton>
</ComposerPrimitive.StopDictation>
</AuiIf>
</AuiIf>
- <AuiIf condition={(s) => !s.thread.isRunning}>
+ <AuiIf condition={s => !s.thread.isRunning}>
<ComposerPrimitive.Send asChild>
<TooltipIconButton
tooltip="Send message"
@@ -604,21 +536,19 @@ const ComposerAction: FC = () => {
variant="default"
size="icon"
className="aui-composer-send size-7 rounded-full"
- aria-label="Send message"
- >
+ aria-label="Send message">
<ArrowUpIcon className="aui-composer-send-icon size-4" />
</TooltipIconButton>
</ComposerPrimitive.Send>
</AuiIf>
- <AuiIf condition={(s) => s.thread.isRunning}>
+ <AuiIf condition={s => s.thread.isRunning}>
<ComposerPrimitive.Cancel asChild>
<Button
type="button"
variant="default"
size="icon"
className="aui-composer-cancel size-7 rounded-full"
- aria-label="Stop generating"
- >
+ aria-label="Stop generating">
<SquareIcon className="aui-composer-cancel-icon size-3.5 fill-current" />
</Button>
</ComposerPrimitive.Cancel>
@@ -639,13 +569,12 @@ const MessageError: FC = () => {
};
const AssistantWorkingIndicator: FC = () => {
- const isEmpty = useAuiState((s) => s.message.content.length === 0);
+ const isEmpty = useAuiState(s => s.message.content.length === 0);
if (isEmpty) {
return (
<span
data-slot="aui_assistant-message-indicator"
- className="text-muted-foreground inline-flex items-center gap-2 align-middle"
- >
+ className="text-muted-foreground inline-flex items-center gap-2 align-middle">
<DotMatrix state="connecting" aria-hidden />
<span className="text-sm">Connecting</span>
</span>
@@ -655,9 +584,8 @@ const AssistantWorkingIndicator: FC = () => {
<span
data-slot="aui_assistant-message-indicator"
className="animate-pulse font-sans"
- aria-label="Assistant is working"
- >
- {"●"}
+ aria-label="Assistant is working">
+ {'●'}
</span>
);
};
@@ -666,42 +594,39 @@ const AssistantMessage: FC = () => {
// reserves space for action bar and compensates with `-mb` for consistent msg spacing
// keeps hovered action bar from shifting layout (autohide doesn't support absolute positioning well)
// for pt-[n] use -mb-[n + 6] & min-h-[n + 6] to preserve compensation
- const ACTION_BAR_PT = "pt-1.5";
+ const ACTION_BAR_PT = 'pt-1.5';
const ACTION_BAR_HEIGHT = `-mb-7.5 min-h-7.5 ${ACTION_BAR_PT}`;
return (
<MessagePrimitive.Root
data-slot="aui_assistant-message-root"
data-role="assistant"
- className="fade-in slide-in-from-bottom-1 animate-in relative mx-auto w-full max-w-(--thread-max-width) duration-150"
- >
+ className="fade-in slide-in-from-bottom-1 animate-in relative mx-auto w-full max-w-(--thread-max-width) duration-150">
<div
data-slot="aui_assistant-message-content"
- className="text-foreground px-2 leading-relaxed wrap-break-word"
- >
+ className="text-foreground px-2 leading-relaxed wrap-break-word">
<MessagePrimitive.GroupedParts
groupBy={groupPartByType({
- reasoning: ["group-chainOfThought", "group-reasoning"],
- "tool-call": ["group-chainOfThought", "group-tool"],
- "standalone-tool-call": [],
- })}
- >
+ reasoning: ['group-chainOfThought', 'group-reasoning'],
+ 'tool-call': ['group-chainOfThought', 'group-tool'],
+ 'standalone-tool-call': [],
+ })}>
{({ part, children }) => {
switch (part.type) {
- case "group-chainOfThought":
+ case 'group-chainOfThought':
return <div data-slot="aui_chain-of-thought">{children}</div>;
- case "group-tool":
+ case 'group-tool':
return (
<ToolGroupRoot variant="ghost">
<ToolGroupTrigger
count={part.indices.length}
- active={part.status.type === "running"}
+ active={part.status.type === 'running'}
/>
<ToolGroupContent>{children}</ToolGroupContent>
</ToolGroupRoot>
);
- case "group-reasoning": {
- const running = part.status.type === "running";
+ case 'group-reasoning': {
+ const running = part.status.type === 'running';
return (
<ReasoningRoot defaultOpen={running}>
<ReasoningTrigger active={running} />
@@ -711,15 +636,15 @@ const AssistantMessage: FC = () => {
</ReasoningRoot>
);
}
- case "text":
+ case 'text':
return <MarkdownText />;
- case "reasoning":
+ case 'reasoning':
return <Reasoning {...part} />;
- case "tool-call":
+ case 'tool-call':
return part.toolUI ?? <ToolFallback {...part} />;
- case "indicator":
+ case 'indicator':
return <AssistantWorkingIndicator />;
- case "data":
+ case 'data':
return part.dataRendererUI;
default:
return null;
@@ -731,8 +656,7 @@ const AssistantMessage: FC = () => {
<div
data-slot="aui_assistant-message-footer"
- className={cn("ml-2 flex items-center", ACTION_BAR_HEIGHT)}
- >
+ className={cn('ml-2 flex items-center', ACTION_BAR_HEIGHT)}>
<BranchPicker />
<AssistantActionBar />
</div>
@@ -745,14 +669,13 @@ const AssistantActionBar: FC = () => {
<ActionBarPrimitive.Root
hideWhenRunning
autohide="not-last"
- className="aui-assistant-action-bar-root text-muted-foreground animate-in fade-in col-start-3 row-start-2 -ml-1 flex gap-1 duration-200"
- >
+ className="aui-assistant-action-bar-root text-muted-foreground animate-in fade-in col-start-3 row-start-2 -ml-1 flex gap-1 duration-200">
<ActionBarPrimitive.Copy asChild>
<TooltipIconButton tooltip="Copy">
- <AuiIf condition={(s) => s.message.isCopied}>
+ <AuiIf condition={s => s.message.isCopied}>
<CheckIcon className="animate-in zoom-in-50 fade-in duration-200 ease-out" />
</AuiIf>
- <AuiIf condition={(s) => !s.message.isCopied}>
+ <AuiIf condition={s => !s.message.isCopied}>
<CopyIcon className="animate-in zoom-in-75 fade-in duration-150" />
</AuiIf>
</TooltipIconButton>
@@ -764,10 +687,7 @@ const AssistantActionBar: FC = () => {
</ActionBarPrimitive.Reload>
<ActionBarMorePrimitive.Root>
<ActionBarMorePrimitive.Trigger asChild>
- <TooltipIconButton
- tooltip="More"
- className="data-[state=open]:bg-accent"
- >
+ <TooltipIconButton tooltip="More" className="data-[state=open]:bg-accent">
<MoreHorizontalIcon />
</TooltipIconButton>
</ActionBarMorePrimitive.Trigger>
@@ -775,8 +695,7 @@ const AssistantActionBar: FC = () => {
side="bottom"
align="start"
sideOffset={6}
- className="aui-action-bar-more-content bg-popover text-popover-foreground data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=open]:animate-in data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=closed]:animate-out 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-[8rem] overflow-hidden rounded-xl border p-1.5"
- >
+ className="aui-action-bar-more-content bg-popover text-popover-foreground data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=open]:animate-in data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=closed]:animate-out 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-[8rem] overflow-hidden rounded-xl border p-1.5">
<ActionBarPrimitive.ExportMarkdown asChild>
<ActionBarMorePrimitive.Item className="aui-action-bar-more-item hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground flex cursor-pointer items-center gap-2 rounded-lg px-2.5 py-1.5 text-sm outline-none select-none">
<DownloadIcon className="size-4" />
@@ -795,15 +714,12 @@ const UserMessage: FC = () => {
<MessagePrimitive.Root
data-slot="aui_user-message-root"
data-role="user"
- className="fade-in slide-in-from-bottom-1 animate-in mx-auto grid w-full max-w-(--thread-max-width) auto-rows-auto grid-cols-[minmax(72px,1fr)_auto] content-start gap-y-2 px-2 duration-150 [&:where(>*)]:col-start-2"
- >
+ className="fade-in slide-in-from-bottom-1 animate-in mx-auto grid w-full max-w-(--thread-max-width) auto-rows-auto grid-cols-[minmax(72px,1fr)_auto] content-start gap-y-2 px-2 duration-150 [&:where(>*)]:col-start-2">
<UserMessageAttachments />
<div className="aui-user-message-content-wrapper relative col-start-2 min-w-0">
<div className="aui-user-message-content peer bg-muted text-foreground rounded-xl px-4 py-2 wrap-break-word empty:hidden">
- <MessagePrimitive.Quote>
- {(quote) => <QuoteBlock {...quote} />}
- </MessagePrimitive.Quote>
+ <MessagePrimitive.Quote>{quote => <QuoteBlock {...quote} />}</MessagePrimitive.Quote>
<MessagePrimitive.Parts components={{ Text: DirectiveText }} />
</div>
<div className="aui-user-action-bar-wrapper absolute top-1/2 left-0 -translate-x-full -translate-y-1/2 pr-2 peer-empty:hidden">
@@ -824,8 +740,7 @@ const UserActionBar: FC = () => {
<ActionBarPrimitive.Root
hideWhenRunning
autohide="not-last"
- className="aui-user-action-bar-root flex flex-col items-end"
- >
+ className="aui-user-action-bar-root flex flex-col items-end">
<ActionBarPrimitive.Edit asChild>
<TooltipIconButton tooltip="Edit" className="aui-user-action-edit">
<PencilIcon />
@@ -839,8 +754,7 @@ const EditComposer: FC = () => {
return (
<MessagePrimitive.Root
data-slot="aui_edit-composer-wrapper"
- className="mx-auto flex w-full max-w-(--thread-max-width) flex-col px-2"
- >
+ className="mx-auto flex w-full max-w-(--thread-max-width) flex-col px-2">
<ComposerPrimitive.Unstable_TriggerPopoverRoot>
<ComposerPrimitive.Root className="aui-edit-composer-root border-border/60 dark:border-muted-foreground/15 ml-auto flex w-full max-w-[85%] cursor-text flex-col rounded-(--composer-radius) border bg-(--composer-bg)">
<LexicalComposerInput
@@ -850,11 +764,7 @@ const EditComposer: FC = () => {
/>
<div className="aui-edit-composer-footer mx-2.5 mb-2.5 flex items-center gap-1.5 self-end">
<ComposerPrimitive.Cancel asChild>
- <Button
- variant="ghost"
- size="sm"
- className="h-8 rounded-full px-3.5"
- >
+ <Button variant="ghost" size="sm" className="h-8 rounded-full px-3.5">
Cancel
</Button>
</ComposerPrimitive.Cancel>
@@ -870,19 +780,15 @@ const EditComposer: FC = () => {
);
};
-const BranchPicker: FC<BranchPickerPrimitive.Root.Props> = ({
- className,
- ...rest
-}) => {
+const BranchPicker: FC<BranchPickerPrimitive.Root.Props> = ({ className, ...rest }) => {
return (
<BranchPickerPrimitive.Root
hideWhenSingleBranch
className={cn(
- "aui-branch-picker-root text-muted-foreground mr-2 -ml-2 inline-flex items-center text-xs",
- className,
+ 'aui-branch-picker-root text-muted-foreground mr-2 -ml-2 inline-flex items-center text-xs',
+ className
)}
- {...rest}
- >
+ {...rest}>
<BranchPickerPrimitive.Previous asChild>
<TooltipIconButton tooltip="Previous">
<ChevronLeftIcon />
@@ -914,8 +820,7 @@ export const Base: FC = () => {
headerContent={<Logo collapsed={sidebarCollapsed} />}
sheetTitle={<Logo />}
showSearch={false}
- wrapNewThreadTooltip
- >
+ wrapNewThreadTooltip>
<div className="bg-muted/30 flex h-full flex-col overflow-hidden p-2 md:pl-0">
<div className="bg-background flex flex-1 flex-col overflow-hidden rounded-lg">
<Header
diff --git a/app/src/pages/dev/assistant-ui-demo/CloneThreadShell.tsx b/app/src/pages/dev/assistant-ui-demo/CloneThreadShell.tsx
index 7c7393a5e1..a9a384738b 100644
--- a/app/src/pages/dev/assistant-ui-demo/CloneThreadShell.tsx
+++ b/app/src/pages/dev/assistant-ui-demo/CloneThreadShell.tsx
@@ -1,30 +1,25 @@
-"use client";
+'use client';
+import { cn } from '@/components/assistant-ui/lib/utils';
import {
ThreadList,
ThreadListItems,
ThreadListNew,
ThreadListRoot,
ThreadListSearch,
-} from "@/components/assistant-ui/thread-list";
-import { TooltipIconButton } from "@/components/assistant-ui/tooltip-icon-button";
-import { Button } from "@/components/assistant-ui/ui/button";
-import {
- Sheet,
- SheetContent,
- SheetTitle,
- SheetTrigger,
-} from "@/components/assistant-ui/ui/sheet";
+} from '@/components/assistant-ui/thread-list';
+import { TooltipIconButton } from '@/components/assistant-ui/tooltip-icon-button';
+import { Button } from '@/components/assistant-ui/ui/button';
+import { Sheet, SheetContent, SheetTitle, SheetTrigger } from '@/components/assistant-ui/ui/sheet';
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
-} from "@/components/assistant-ui/ui/tooltip";
-import { cn } from "@/components/assistant-ui/lib/utils";
-import { useAuiState } from "@assistant-ui/react";
-import { MenuIcon, PanelLeftIcon } from "lucide-react";
-import { useState, type FC, type MouseEvent, type ReactNode } from "react";
+} from '@/components/assistant-ui/ui/tooltip';
+import { useAuiState } from '@assistant-ui/react';
+import { MenuIcon, PanelLeftIcon } from 'lucide-react';
+import { type FC, type MouseEvent, type ReactNode, useState } from 'react';
type CloneThreadShellProps = {
children: ReactNode;
@@ -53,8 +48,8 @@ export const CloneThreadShell: FC<CloneThreadShellProps> = ({
}) => {
const [internalCollapsed, setInternalCollapsed] = useState(true);
const [internalMobileOpen, setInternalMobileOpen] = useState(false);
- const [search, setSearch] = useState("");
- const hasThreads = useAuiState((s) => s.threads.threadIds.length > 0);
+ const [search, setSearch] = useState('');
+ const hasThreads = useAuiState(s => s.threads.threadIds.length > 0);
// A controlled value means the caller renders the chrome that drives it, so
// the shell omits its own toggle / trigger and forwards changes instead.
@@ -73,13 +68,11 @@ export const CloneThreadShell: FC<CloneThreadShellProps> = ({
onMobileSidebarOpenChange?.(open);
};
- const closeMobileSidebarAfterNavigation = (
- event: MouseEvent<HTMLDivElement>,
- ) => {
+ const closeMobileSidebarAfterNavigation = (event: MouseEvent<HTMLDivElement>) => {
if (!(event.target instanceof Element)) return;
if (
event.target.closest(
- '[data-slot="aui_thread-list-item-trigger"], [data-slot="aui_thread-list-new"]',
+ '[data-slot="aui_thread-list-item-trigger"], [data-slot="aui_thread-list-new"]'
)
) {
setMobileOpen(false);
@@ -89,14 +82,14 @@ export const CloneThreadShell: FC<CloneThreadShellProps> = ({
const newThread = (
<ThreadListNew
className={cn(
- "overflow-hidden transition-all duration-200",
+ 'overflow-hidden transition-all duration-200',
sidebarCollapsed
- ? "w-8 gap-0 px-2 has-[>svg]:px-2"
- : "w-full gap-2 px-2.5 has-[>svg]:px-2.5",
+ ? 'w-8 gap-0 px-2 has-[>svg]:px-2'
+ : 'w-full gap-2 px-2.5 has-[>svg]:px-2.5'
)}
labelClassName={cn(
- "overflow-hidden transition-all duration-200",
- sidebarCollapsed ? "max-w-0 opacity-0" : "max-w-24 opacity-100",
+ 'overflow-hidden transition-all duration-200',
+ sidebarCollapsed ? 'max-w-0 opacity-0' : 'max-w-24 opacity-100'
)}
/>
);
@@ -105,46 +98,37 @@ export const CloneThreadShell: FC<CloneThreadShellProps> = ({
<div className="relative flex h-full w-full overflow-hidden">
<aside
className={cn(
- "bg-muted/30 hidden h-full shrink-0 flex-col overflow-hidden border-r transition-[width] duration-200 md:flex",
+ 'bg-muted/30 hidden h-full shrink-0 flex-col overflow-hidden border-r transition-[width] duration-200 md:flex',
railClassName,
- sidebarCollapsed ? "w-12" : "w-65",
- )}
- >
+ sidebarCollapsed ? 'w-12' : 'w-65'
+ )}>
<div className="flex h-12 shrink-0 items-center overflow-hidden px-2">
{!collapsedControlled && (
<TooltipIconButton
variant="ghost"
size="icon"
- tooltip={sidebarCollapsed ? "Show sidebar" : "Hide sidebar"}
+ tooltip={sidebarCollapsed ? 'Show sidebar' : 'Hide sidebar'}
side="right"
onClick={() => setSidebarCollapsed(!sidebarCollapsed)}
- className="size-8"
- >
+ className="size-8">
<PanelLeftIcon className="size-4" />
</TooltipIconButton>
)}
{headerContent !== undefined
? headerContent
- : !sidebarCollapsed && (
- <span className="ml-2 truncate text-sm font-medium">Chats</span>
- )}
+ : !sidebarCollapsed && <span className="ml-2 truncate text-sm font-medium">Chats</span>}
</div>
<ThreadListRoot
className={cn(
- "relative flex-1 transition-[padding,width] duration-200",
- sidebarCollapsed
- ? "w-12 overflow-hidden px-2 pt-1"
- : "w-65 overflow-y-auto p-3",
- )}
- >
+ 'relative flex-1 transition-[padding,width] duration-200',
+ sidebarCollapsed ? 'w-12 overflow-hidden px-2 pt-1' : 'w-65 overflow-y-auto p-3'
+ )}>
{wrapNewThreadTooltip ? (
<TooltipProvider>
<Tooltip>
<TooltipTrigger render={newThread} />
- {sidebarCollapsed && (
- <TooltipContent side="right">New Thread</TooltipContent>
- )}
+ {sidebarCollapsed && <TooltipContent side="right">New Thread</TooltipContent>}
</Tooltip>
</TooltipProvider>
) : (
@@ -155,22 +139,19 @@ export const CloneThreadShell: FC<CloneThreadShellProps> = ({
aria-hidden={sidebarCollapsed}
inert={sidebarCollapsed}
className={cn(
- "transition-opacity duration-150",
- sidebarCollapsed && "pointer-events-none opacity-0",
- )}
- >
+ 'transition-opacity duration-150',
+ sidebarCollapsed && 'pointer-events-none opacity-0'
+ )}>
<ThreadListSearch value={search} onValueChange={setSearch} />
</div>
)}
<ThreadListItems
- searchQuery={showSearch && hasThreads ? search : ""}
+ searchQuery={showSearch && hasThreads ? search : ''}
aria-hidden={sidebarCollapsed}
inert={sidebarCollapsed}
className={cn(
- "transition-[opacity,transform] duration-150",
- sidebarCollapsed
- ? "pointer-events-none opacity-0"
- : "translate-x-0 opacity-100",
+ 'transition-[opacity,transform] duration-150',
+ sidebarCollapsed ? 'pointer-events-none opacity-0' : 'translate-x-0 opacity-100'
)}
/>
</ThreadListRoot>
@@ -181,11 +162,7 @@ export const CloneThreadShell: FC<CloneThreadShellProps> = ({
<div className="absolute top-2 left-2 z-20 md:hidden">
<SheetTrigger
render={
- <Button
- variant="ghost"
- size="icon"
- className="bg-background/70 size-8"
- >
+ <Button variant="ghost" size="icon" className="bg-background/70 size-8">
<MenuIcon className="size-4" />
<span className="sr-only">Open chat history</span>
</Button>
@@ -195,12 +172,11 @@ export const CloneThreadShell: FC<CloneThreadShellProps> = ({
)}
<SheetContent side="left" className="flex flex-col p-0">
<SheetTitle className="flex h-12 shrink-0 items-center px-4 text-sm font-medium">
- {sheetTitle ?? "Chats"}
+ {sheetTitle ?? 'Chats'}
</SheetTitle>
<div
className="relative flex-1 overflow-y-auto p-3"
- onClick={closeMobileSidebarAfterNavigation}
- >
+ onClick={closeMobileSidebarAfterNavigation}>
<ThreadList />
</div>
</SheetContent>
diff --git a/app/src/pages/dev/assistant-ui-demo/MockRuntimeProvider.tsx b/app/src/pages/dev/assistant-ui-demo/MockRuntimeProvider.tsx
index 3a5ecf087f..a93a58b699 100644
--- a/app/src/pages/dev/assistant-ui-demo/MockRuntimeProvider.tsx
+++ b/app/src/pages/dev/assistant-ui-demo/MockRuntimeProvider.tsx
@@ -51,10 +51,7 @@ export function MockRuntimeProvider({ children }: { children: ReactNode }) {
// One adapter instance for the page's lifetime — the options doc requires a
// stable reference, since replacing it reloads the list and drops threads.
const [adapter] = useState(() => new InMemoryThreadListAdapter());
- const runtime = useRemoteThreadListRuntime({
- runtimeHook: useDemoThreadRuntime,
- adapter,
- });
+ const runtime = useRemoteThreadListRuntime({ runtimeHook: useDemoThreadRuntime, adapter });
return <AssistantRuntimeProvider runtime={runtime}>{children}</AssistantRuntimeProvider>;
}
diff --git a/app/src/pages/dev/assistant-ui-demo/demoModels.ts b/app/src/pages/dev/assistant-ui-demo/demoModels.ts
index 169458d72a..154cce91ba 100644
--- a/app/src/pages/dev/assistant-ui-demo/demoModels.ts
+++ b/app/src/pages/dev/assistant-ui-demo/demoModels.ts
@@ -12,22 +12,13 @@ export const DEFAULT_MODEL_ID = 'demo-sonnet';
export function demoModelOptions(): readonly ModelOption[] {
return [
- {
- id: 'demo-sonnet',
- name: 'Demo Sonnet',
- description: 'Balanced mock model',
- efforts: true,
- },
+ { id: 'demo-sonnet', name: 'Demo Sonnet', description: 'Balanced mock model', efforts: true },
{
id: 'demo-opus',
name: 'Demo Opus',
description: 'Highest quality mock model',
efforts: true,
},
- {
- id: 'demo-haiku',
- name: 'Demo Haiku',
- description: 'Fastest mock model',
- },
+ { id: 'demo-haiku', name: 'Demo Haiku', description: 'Fastest mock model' },
];
}