feat(webui): expand and organize settings with autosave (#5704)

* feat(webui): expand settings with autosave and live configuration

* feat(memory): add long-term memory and idle compaction switches

* refactor(webui): clarify settings hierarchy and align compact controls

* refactor(webui): keep only memory consolidation in memory settings

* refactor(webui): defer runtime changes until explicit restart

* refactor(webui): remove default workspace setting

* fix(webui): align model lists and remove preset counters

* fix(i18n): use natural Chinese labels for chat platforms

* fix(i18n): shorten chat settings navigation label

* fix(webui): match settings navigation icons to text size

* refactor(webui): remove redundant settings sidebar heading

* refactor(webui): use icon-only back navigation in settings

* fix(webui): remove back arrow hover hint

* refactor(webui): remove redundant overview details

* refactor(webui): hide secondary descriptions in settings rows

* style(webui): replace settings dividers with rounded highlights

* refactor(webui): remove redundant model list subtitles and badges

* fix(i18n): restore chat translation namespace boundaries

* fix(i18n): complete settings translations for all locales

* fix(webui): reveal settings only for enabled capabilities

* fix(webui): consolidate capabilities and isolate settings feedback

* fix(webui): clear restart notices when settings are reverted

* fix(webui): anchor restart controls in settings sidebar

* fix(webui): shorten sidebar restart label

* fix(webui): align settings spacing and control sizes

* refactor(webui): unify settings dialogs and interaction feedback

* fix(webui): keep settings option groups on one line without scrolling

* refactor(webui): align settings spacing and sidebar icon proportions

* style(webui): match main sidebar typography to settings

* style(webui): use monospace for sidebar session handles

* refactor(webui): remove heartbeat configuration from automations

* feat(webui): expose configuration actions beside capability toggles

* style(webui): remove ellipsis from configuration actions

* refactor(webui): remove redundant app configuration controls

* feat(webui): add compact sidebar navigation and shortcut hints

* fix(webui): synchronize npm dependency lockfile

* test(webui): align input radius expectation with pill styling

* feat(webui): show daily token usage and cache breakdown

* feat(webui): add model usage details and cache hit rates

* feat(webui): chart daily token usage by model

* refactor(webui): simplify usage details and model labels

* fix(webui): hide usage dialog date range

* refactor(webui): consolidate model usage into chart legends

* fix(webui): enforce restart choices and correct settings test route

* fix(webui): polish settings localization and controls

* fix(webui): avoid repeated usage legend labels

* fix(webui): skip empty usage columns in keyboard navigation

* test(webui): assert settings behavior positively

* feat(webui): refine sidebar navigation and add drag resizing

* style(webui): soften sidebar scroll edges

* style(webui): harmonize sidebar typography and text colors

* feat(webui): move channels to the main sidebar

* style(webui): remove dotted underlines from settings hints

* fix(webui): unify tooltip hover delay

* fix(webui): support Seatbelt sandbox settings

* fix(webui): remove unused appearance density preference

* fix(webui): align settings input values consistently

* style(webui): group compact settings controls before inputs

* feat(webui): edit multiline settings in compact dialogs

* feat(webui): add continuous settings scrolling with gentle snapping

* Revert "feat(webui): add continuous settings scrolling with gentle snapping"

This reverts commit f0978c261a53c844185eeab4d0c3190fbd196fe6.
This commit is contained in:
chengyongru authored and GitHub committed 2026-09-10 11:10:51 +08:00
1 parent 20f115bf46
commit 8ea683679d
244 files changed
+6929 -3900

No files matched your search

+49 -5
View File
@@ -8,9 +8,12 @@ import {
modalSurfaceClassName,
} from "@/components/ui/floating-surface";
import { cn } from "@/lib/utils";
import { FloatingPortalContext } from "@/components/ui/floating-portal";
const Dialog = DialogPrimitive.Root;
const DialogTrigger = DialogPrimitive.Trigger;
const DialogPortal = DialogPrimitive.Portal;
export const DialogLayoutContext = React.createContext<HTMLElement | null>(null);
const DialogOverlay = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Overlay>,
@@ -35,22 +38,62 @@ interface DialogContentProps
const DialogContent = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Content>,
DialogContentProps
>(({ className, children, showCloseButton = true, ...props }, ref) => {
>(({ className, children, showCloseButton = true, onOpenAutoFocus, ...props }, ref) => {
const { t } = useTranslation();
const [container, setContainer] = React.useState<HTMLDivElement | null>(null);
const contentNode = React.useRef<HTMLDivElement | null>(null);
const layoutAnchor = React.useContext(DialogLayoutContext);
const [layout, setLayout] = React.useState<React.CSSProperties>();
React.useLayoutEffect(() => {
if (!layoutAnchor) {
setLayout(undefined);
return;
}
const update = () => {
const rect = layoutAnchor.getBoundingClientRect();
const style = getComputedStyle(layoutAnchor);
const start = parseFloat(style.paddingLeft) || 0;
const end = parseFloat(style.paddingRight) || 0;
if (rect.width > 0) setLayout({ left: rect.left + start, right: "auto", width: rect.width - start - end, paddingInline: 0 });
};
update();
const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(update);
observer?.observe(layoutAnchor);
window.addEventListener("resize", update);
return () => {
observer?.disconnect();
window.removeEventListener("resize", update);
};
}, [layoutAnchor]);
const contentRef = React.useCallback((node: HTMLDivElement | null) => {
contentNode.current = node;
setContainer(node);
if (typeof ref === "function") ref(node);
else if (ref) ref.current = node;
}, [ref]);
return (
<DialogPortal>
<DialogOverlay />
<div className="fixed inset-0 z-50 flex items-center justify-center p-4">
<div className="fixed inset-0 z-50 flex items-center justify-center p-4" style={layout}>
<DialogPrimitive.Content
ref={ref}
ref={contentRef}
onOpenAutoFocus={(event) => {
if (onOpenAutoFocus) onOpenAutoFocus(event);
else {
event.preventDefault();
contentNode.current?.focus({ preventScroll: true });
}
}}
className={cn(
modalSurfaceClassName,
"grid w-full max-w-lg origin-center gap-4 rounded-modal p-6 duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
"relative grid w-full max-w-lg origin-center gap-4 rounded-modal p-6 duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
className,
)}
{...props}
>
{children}
<FloatingPortalContext.Provider value={container}>
{children}
</FloatingPortalContext.Provider>
{showCloseButton ? (
<DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none">
<X className="h-4 w-4" />
@@ -121,6 +164,7 @@ DialogDescription.displayName = DialogPrimitive.Description.displayName;
export {
Dialog,
DialogTrigger,
DialogContent,
DialogDescription,
DialogFooter,
+7 -3
View File
@@ -9,6 +9,7 @@ import {
floatingSurfaceMotionClassName,
} from "@/components/ui/floating-surface";
import { cn } from "@/lib/utils";
import { useFloatingPortal } from "@/components/ui/floating-portal";
const DropdownMenu = DropdownMenuPrimitive.Root;
const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
@@ -26,8 +27,10 @@ interface DropdownMenuContentProps
const DropdownMenuContent = React.forwardRef<
React.ElementRef<typeof DropdownMenuPrimitive.Content>,
DropdownMenuContentProps
>(({ className, sideOffset = 4, portalContainer, ...props }, ref) => (
<DropdownMenuPrimitive.Portal container={portalContainer ?? undefined}>
>(({ className, sideOffset = 4, portalContainer, ...props }, ref) => {
const dialogContainer = useFloatingPortal();
return (
<DropdownMenuPrimitive.Portal container={portalContainer ?? dialogContainer ?? undefined}>
<DropdownMenuPrimitive.Content
ref={ref}
sideOffset={sideOffset}
@@ -40,7 +43,8 @@ const DropdownMenuContent = React.forwardRef<
{...props}
/>
</DropdownMenuPrimitive.Portal>
));
);
});
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
const DropdownMenuItem = React.forwardRef<
@@ -0,0 +1,4 @@
import { createContext, useContext } from "react";
export const FloatingPortalContext = createContext<HTMLElement | null>(null);
export const useFloatingPortal = () => useContext(FloatingPortalContext);
+1 -1
View File
@@ -5,7 +5,7 @@ export const floatingSurfaceVisualClassName =
`rounded-floating p-1.5 ${floatingSurfaceElevationClassName}`;
export const modalOverlayClassName =
"fixed inset-0 z-50 bg-black/45 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0";
"fixed inset-0 z-50 bg-black/25 backdrop-blur-[8px] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0";
export const modalSurfaceClassName =
"bg-background text-foreground shadow-[0_12px_36px_rgba(15,23,42,0.12)] dark:bg-popover dark:shadow-[0_18px_44px_rgba(0,0,0,0.32)]";
+1 -1
View File
@@ -11,7 +11,7 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
<input
type={type}
className={cn(
"flex h-10 w-full rounded-control border border-input bg-background px-3 py-2 text-sm file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
"flex h-10 w-full rounded-full border border-input bg-background px-3 py-2 text-sm file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
formControlFocusClassName,
className,
)}
+7 -3
View File
@@ -6,6 +6,7 @@ import {
floatingSurfaceMotionClassName,
} from "@/components/ui/floating-surface";
import { cn } from "@/lib/utils";
import { useFloatingPortal } from "@/components/ui/floating-portal";
const Popover = PopoverPrimitive.Root;
const PopoverTrigger = PopoverPrimitive.Trigger;
@@ -18,8 +19,10 @@ interface PopoverContentProps
const PopoverContent = React.forwardRef<
React.ElementRef<typeof PopoverPrimitive.Content>,
PopoverContentProps
>(({ className, sideOffset = 4, portalContainer, ...props }, ref) => (
<PopoverPrimitive.Portal container={portalContainer ?? undefined}>
>(({ className, sideOffset = 4, portalContainer, ...props }, ref) => {
const dialogContainer = useFloatingPortal();
return (
<PopoverPrimitive.Portal container={portalContainer ?? dialogContainer ?? undefined}>
<PopoverPrimitive.Content
ref={ref}
sideOffset={sideOffset}
@@ -32,7 +35,8 @@ const PopoverContent = React.forwardRef<
{...props}
/>
</PopoverPrimitive.Portal>
));
);
});
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
export {
@@ -32,8 +32,7 @@ export function SegmentedControl<T extends string>({
role={tabs ? "tablist" : undefined}
aria-label={ariaLabel}
className={cn(
"inline-flex min-h-8 max-w-full items-center gap-1 overflow-x-auto rounded-full bg-muted/65 p-1 text-[12px] font-medium text-muted-foreground",
"scrollbar-thin scrollbar-track-transparent",
"segmented-control inline-flex min-h-8 max-w-full flex-nowrap items-center gap-1 rounded-full bg-muted/65 p-1 text-[12px] font-medium text-muted-foreground",
className,
)}
>
@@ -48,7 +47,7 @@ export function SegmentedControl<T extends string>({
aria-pressed={tabs ? undefined : selected}
onClick={() => onChange(option.value)}
className={cn(
"shrink-0 whitespace-nowrap rounded-full px-3 py-1 text-muted-foreground transition-colors",
"min-w-0 truncate whitespace-nowrap rounded-full px-2 py-1 text-muted-foreground transition-colors",
selected ? "bg-background text-foreground" : "hover:text-foreground",
itemClassName,
)}
+46
View File
@@ -0,0 +1,46 @@
import * as React from "react";
import * as SelectPrimitive from "@radix-ui/react-select";
import { Check, ChevronDown, ChevronUp } from "lucide-react";
import { floatingSurfaceElevationClassName, floatingItemClassName } from "@/components/ui/floating-surface";
import { useFloatingPortal } from "@/components/ui/floating-portal";
import { cn } from "@/lib/utils";
export const Select = SelectPrimitive.Root;
export const SelectValue = SelectPrimitive.Value;
export const SelectTrigger = React.forwardRef<
React.ElementRef<typeof SelectPrimitive.Trigger>,
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
>(({ className, children, ...props }, ref) => (
<SelectPrimitive.Trigger ref={ref} {...props}
className={cn("flex h-9 items-center justify-between gap-2 rounded-control border border-input bg-background px-3 text-[13px] outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50 [&>span:first-child]:truncate", className)}>
{children}
<SelectPrimitive.Icon asChild><ChevronDown className="h-3.5 w-3.5 shrink-0 text-muted-foreground" aria-hidden /></SelectPrimitive.Icon>
</SelectPrimitive.Trigger>
));
SelectTrigger.displayName = "SelectTrigger";
export function SelectContent({ children }: { children: React.ReactNode }) {
const container = useFloatingPortal();
return (
<SelectPrimitive.Portal container={container ?? undefined}>
<SelectPrimitive.Content position="item-aligned" className={cn("z-50 max-h-[min(24rem,calc(100dvh-2rem))] min-w-[10rem] overflow-hidden rounded-control border border-transparent", floatingSurfaceElevationClassName)}>
<SelectPrimitive.ScrollUpButton className="flex h-6 items-center justify-center"><ChevronUp className="h-3.5 w-3.5" /></SelectPrimitive.ScrollUpButton>
<SelectPrimitive.Viewport className="p-1">
{children}
</SelectPrimitive.Viewport>
<SelectPrimitive.ScrollDownButton className="flex h-6 items-center justify-center"><ChevronDown className="h-3.5 w-3.5" /></SelectPrimitive.ScrollDownButton>
</SelectPrimitive.Content>
</SelectPrimitive.Portal>
);
}
export function SelectItem({ children, className, ...props }: React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>) {
return (
<SelectPrimitive.Item {...props} className={cn(floatingItemClassName, "h-9 py-0 pl-2 pr-8 data-[state=checked]:bg-muted data-[highlighted]:bg-muted data-[disabled]:opacity-50", className)}>
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
<SelectPrimitive.ItemIndicator className="absolute right-2 flex items-center"><Check className="h-3.5 w-3.5" aria-hidden /></SelectPrimitive.ItemIndicator>
</SelectPrimitive.Item>
);
}
+3 -1
View File
@@ -4,7 +4,9 @@ import * as TooltipPrimitive from "@radix-ui/react-tooltip";
import { floatingSurfaceElevationClassName } from "@/components/ui/floating-surface";
import { cn } from "@/lib/utils";
const TooltipProvider = TooltipPrimitive.Provider;
function TooltipProvider(props: Omit<React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Provider>, "delayDuration" | "skipDelayDuration">) {
return <TooltipPrimitive.Provider {...props} delayDuration={500} skipDelayDuration={0} />;
}
const Tooltip = TooltipPrimitive.Root;
const TooltipTrigger = TooltipPrimitive.Trigger;