Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Studio Hub: one filter popover for capabilities, size, context and uploader, composer-style menus (#13749)

Michael Han199987c63f10
diff --git a/studio/frontend/src/app/routes/hub.tsx b/studio/frontend/src/app/routes/hub.tsx
index d353f1ee0a1..ba081ada8a9 100644
--- a/studio/frontend/src/app/routes/hub.tsx
+++ b/studio/frontend/src/app/routes/hub.tsx
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
-import type { CapabilityKey } from "@/features/hub";
+import { HUB_CAPABILITY_FILTERS, type HubCapabilityFilter } from "@/features/hub";
import { hubAudioTaskSearch } from "@/lib/hub-audio-task";
import type { PipelineType } from "@huggingface/hub";
import { createRoute, lazyRouteComponent } from "@tanstack/react-router";
@@ -13,14 +13,6 @@ const ModelsPage = lazyRouteComponent(
"ModelsPage",
);
-// Discover capability filters a link can preselect.
-const HUB_CAPABILITIES: readonly CapabilityKey[] = [
- "reasoning",
- "vision",
- "audio",
- "embedding",
- "diffusion",
-];
export interface ModelsSearch {
tab?: "discover" | "downloaded";
@@ -30,7 +22,7 @@ export interface ModelsSearch {
intent?: number;
section?: "trending" | "latest" | "finetune";
kind?: "models" | "datasets";
- capability?: CapabilityKey;
+ capability?: HubCapabilityFilter;
audioTask?: PipelineType[];
}
@@ -69,9 +61,10 @@ export const Route = createRoute({
if (kind === "models" || kind === "datasets") {
next.kind = kind;
}
- const capability = search.capability;
- if (HUB_CAPABILITIES.includes(capability as CapabilityKey)) {
- next.capability = capability as CapabilityKey;
+ // "diffusion" is the single image/video filter older links carry.
+ const capability = search.capability === "diffusion" ? "image-gen" : search.capability;
+ if (HUB_CAPABILITY_FILTERS.includes(capability as HubCapabilityFilter)) {
+ next.capability = capability as HubCapabilityFilter;
}
const audioTask = hubAudioTaskSearch(search.audioTask, next.capability);
if (audioTask) next.audioTask = audioTask;
diff --git a/studio/frontend/src/features/hub/catalog/hub-option-menu.tsx b/studio/frontend/src/features/hub/catalog/hub-option-menu.tsx
index a22c77aaa6c..2d547a43576 100644
--- a/studio/frontend/src/features/hub/catalog/hub-option-menu.tsx
+++ b/studio/frontend/src/features/hub/catalog/hub-option-menu.tsx
@@ -39,6 +39,7 @@ export function HubOptionMenu<T extends string>({
title,
triggerContent,
footer,
+ composer = true,
}: {
value: T;
options: readonly HubOption<T>[];
@@ -52,6 +53,8 @@ export function HubOptionMenu<T extends string>({
triggerContent?: ReactNode;
/** Rendered under the options behind a separator; clicks keep the menu open. */
footer?: ReactNode;
+ /** The chat composer menu's shape and dark surface (the Hub's menus); off keeps the plain one. */
+ composer?: boolean;
}) {
const [open, setOpen] = useState(false);
// -1 = nothing highlighted (no hover, no keyboard nav yet).
@@ -205,7 +208,8 @@ export function HubOptionMenu<T extends string>({
collisionPadding={12}
onCloseAutoFocus={(event) => event.preventDefault()}
className={cn(
- "hub-menu-instant menu-soft-surface w-max min-w-[var(--radix-popover-trigger-width)] max-w-[min(var(--radix-popover-content-available-width),calc(100vw-1rem))] rounded-[14px] p-1 ring-0",
+ "hub-menu-instant menu-soft-surface w-max min-w-[var(--radix-popover-trigger-width)] max-w-[min(var(--radix-popover-content-available-width),calc(100vw-1rem))] ring-0",
+ composer ? "hub-composer-menu gap-0" : "rounded-[14px] p-1",
contentClassName,
)}
>
@@ -235,16 +239,24 @@ export function HubOptionMenu<T extends string>({
}}
onPointerEnter={() => activateIndex(index)}
className={cn(
- // 14px menu radius minus the 4px padding, so the hover nests
- // cleanly into the dropdown's corners.
- "relative flex w-full min-w-0 cursor-pointer select-none items-center rounded-[10px] py-2 pr-8 pl-3 text-left text-sm leading-snug outline-none transition-colors",
+ "relative flex w-full min-w-0 cursor-pointer select-none items-center py-2 pl-3 text-left text-sm outline-none transition-colors",
+ composer
+ ? "hub-menu-row pr-9"
+ : // 14px menu radius minus the 4px padding, so the hover nests
+ // cleanly into the dropdown's corners.
+ "rounded-[10px] pr-8 leading-snug",
)}
>
<span className="flex min-w-0 flex-1 items-center gap-2.5 overflow-hidden whitespace-normal break-words">
{option.label}
</span>
{selectedOption && (
- <span className="pointer-events-none absolute right-2 flex size-4 items-center justify-center">
+ <span
+ className={cn(
+ "pointer-events-none absolute flex size-4 items-center justify-center",
+ composer ? "right-3" : "right-2",
+ )}
+ >
<HugeiconsIcon
icon={Tick02Icon}
strokeWidth={2}
@@ -256,12 +268,16 @@ export function HubOptionMenu<T extends string>({
);
})}
</div>
- {footer && (
- // -mt-3 cancels the surface's 16px flex gap down to 4px. No side
- // padding: the footer label carries the same padding as the options
- // so its checkbox lines up with the option text.
- <div className="-mt-3 border-t border-border/60 pt-1">{footer}</div>
- )}
+ {footer &&
+ (composer ? (
+ <div>
+ <div aria-hidden={true} className="mx-1 my-1 h-px bg-border/50" />
+ {footer}
+ </div>
+ ) : (
+ // -mt-3 trims the 16px flex gap to 4px; no side padding, so the checkbox lines up with the options.
+ <div className="-mt-3 border-t border-border/60 pt-1">{footer}</div>
+ ))}
</PopoverContent>
</Popover>
);
diff --git a/studio/frontend/src/features/hub/catalog/model-inspector.tsx b/studio/frontend/src/features/hub/catalog/model-inspector.tsx
index de07b86a626..d492dc4954f 100644
--- a/studio/frontend/src/features/hub/catalog/model-inspector.tsx
+++ b/studio/frontend/src/features/hub/catalog/model-inspector.tsx
@@ -40,6 +40,7 @@ import {
RamMemoryIcon,
Share05Icon,
} from "@hugeicons/core-free-icons";
+import { TextToSpeechIcon } from "@/lib/hugeicons-derived";
import type { IconSvgElement } from "@hugeicons/react";
import { HugeiconsIcon } from "@hugeicons/react";
import { memo, useDeferredValue, useMemo } from "react";
@@ -669,7 +670,12 @@ export const ModelInspector = memo(function ModelInspector({
{!isDataset && (
<span className="inline-flex h-6 items-center gap-1.5 rounded-full bg-muted px-2.5 text-ui-11p5 font-medium text-foreground dark:bg-[rgb(255_255_255_/_calc(0.04*var(--contrast-wash-gain,1)))]">
<HugeiconsIcon
- icon={CubeIcon}
+ icon={
+ model.pipelineTag === "text-to-speech" ||
+ model.pipelineTag === "text-to-audio"
+ ? TextToSpeechIcon
+ : CubeIcon
+ }
strokeWidth={1.75}
className="size-3 text-muted-foreground"
/>
diff --git a/studio/frontend/src/features/hub/catalog/model-search-filters.tsx b/studio/frontend/src/features/hub/catalog/model-search-filters.tsx
index 9e9857998f5..40f63659a65 100644
--- a/studio/frontend/src/features/hub/catalog/model-search-filters.tsx
+++ b/studio/frontend/src/features/hub/catalog/model-search-filters.tsx
@@ -1,7 +1,8 @@
// SPDX-License-Identifier: AGPL-3.0-only
// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
-import { Input } from "@/components/ui/input";
+import { Button } from "@/components/ui/button";
+import { Switch } from "@/components/ui/switch";
import {
Popover,
PopoverContent,
@@ -12,58 +13,567 @@ import {
TooltipContent,
TooltipTrigger,
} from "@/components/ui/tooltip";
-import { FilterIcon } from "@hugeicons/core-free-icons";
-import { HugeiconsIcon } from "@hugeicons/react";
-import { useId, useState } from "react";
+import { BulbIcon } from "@/lib/bulb-icon";
+import { cn } from "@/lib/utils";
+import { AiSpeechIcon } from "@/lib/hugeicons-derived";
+import { Tick02Icon } from "@/lib/tick-icon";
+import { Slider as SliderPrimitive } from "radix-ui";
import {
+ ChartLineData01Icon,
+ CubeIcon,
+ File01Icon,
+ FilterMailIcon,
+ FlimSlateIcon,
+ ImageIcon,
+ InformationCircleIcon,
+ LayoutTable02Icon,
+ Location01Icon,
+ Table01Icon,
+ TextFontIcon,
+ UndoIcon,
+ ViewIcon,
+} from "@hugeicons/core-free-icons";
+import { HugeiconsIcon, type IconSvgElement } from "@hugeicons/react";
+import { type ReactNode, useEffect, useState } from "react";
+import type { HubCapabilityFilter } from "../lib/model-capabilities";
+import {
+ HUB_UPLOADERS,
+ type HubUploader,
type ModelSearchFilters,
hasModelSearchFilters,
} from "../lib/model-search-filters";
+import {
+ DATASET_MODALITIES,
+ DATASET_ROW_STOPS,
+ type DatasetModality,
+} from "../lib/dataset-filters";
+import { CAPABILITY_FILTER_OPTIONS } from "../lib/view-models";
+
+const CAPABILITY_ICONS: Record<HubCapabilityFilter, IconSvgElement | null> = {
+ text: TextFontIcon,
+ // The composer's thinking bulb, which isn't a Hugeicons glyph.
+ reasoning: null,
+ vision: ViewIcon,
+ audio: AiSpeechIcon,
+ embedding: LayoutTable02Icon,
+ "image-gen": ImageIcon,
+ "video-gen": FlimSlateIcon,
+};
+
+const SECTION_LABEL =
+ "flex w-full items-center justify-between px-3 pt-2 pb-1.5 text-ui-12 text-muted-foreground";
+const SEPARATOR = "mx-1 my-2 h-px bg-border";
+const PICKED_FILL =
+ "bg-[color-mix(in_oklab,var(--foreground)_calc(9%*var(--contrast-wash-gain,1)),var(--popover))] dark:bg-[color-mix(in_srgb,var(--accent),white_8%)]";
+const UNPICKED_FILL =
+ "bg-[color-mix(in_oklab,var(--foreground)_calc(4%*var(--contrast-wash-gain,1)),var(--popover))] hover:bg-[color-mix(in_oklab,var(--foreground)_calc(6%*var(--contrast-wash-gain,1)),var(--popover))] dark:bg-[color-mix(in_srgb,var(--accent)_60%,transparent)] dark:hover:bg-(--accent)";
+const SECTION_GAP = "mx-1 my-2 h-px";
+
+type LimitKey =
+ | "minParams"
+ | "maxParams"
+ | "minContext"
+ | "maxContext"
+ | "minRows"
+ | "maxRows";
+
+interface RangeSpec {
+ label: string;
+ about: string;
+ min: LimitKey;
+ max: LimitKey;
+ /** The first stop as a minimum and the last as a maximum mean no limit. */
+ stops: readonly number[];
+ /** Index -> label; unlabelled stops show only a tick. */
+ labels: readonly (string | null)[];
+ /** An unlabelled stop's pill text. */
+ format: (value: number) => string;
+}
+
+const B = 1e9;
+const K = 1024;
+const RANGES: readonly RangeSpec[] = [
+ {
+ label: "Parameters",
+ about:
+ "Both limits are included. Models that don't publish a parameter count are left out.",
+ min: "minParams",
+ max: "maxParams",
+ // Labelled stops sit evenly with one step between each pair, as on the Hugging Face Hub.
+ stops: [1, 3, 6, 9, 12, 24, 32, 64, 128, 256, 500].map((n) => n * B),
+ labels: [
+ "<1B",
+ null,
+ "6B",
+ null,
+ "12B",
+ null,
+ "32B",
+ null,
+ "128B",
+ null,
+ ">500B",
+ ],
+ format: (n) => `${n / B}B`,
+ },
+ {
+ label: "Context length",
+ about:
+ "In tokens. The model's published limit, not what your device can fit. Both limits are included; models that don't publish one are left out.",
+ min: "minContext",
+ max: "maxContext",
+ stops: [16, 24, 32, 48, 64, 96, 128, 192, 256, 512, 1024].map((n) => n * K),
+ labels: [
+ "<16K",
+ null,
+ "32K",
+ null,
+ "64K",
+ null,
+ "128K",
+ null,
+ "256K",
+ null,
+ ">1M",
+ ],
+ format: (n) => `${n / K}K`,
+ },
+];
+
+const ROW_UNITS: readonly [number, string][] = [
+ [1e12, "T"],
+ [1e9, "B"],
+ [1e6, "M"],
+ [1e3, "K"],
+];
+const DATASET_ROWS: RangeSpec = {
+ label: "Size (rows)",
+ about:
+ "The Hub's size category for the dataset. Datasets that don't publish one are left out.",
+ min: "minRows",
+ max: "maxRows",
+ stops: DATASET_ROW_STOPS,
+ labels: ["<1K", null, null, "1M", null, null, "1B", null, null, ">1T"],
+ format: (n) => {
+ const [scale, unit] = ROW_UNITS.find(([size]) => n >= size) ?? [1, ""];
+ return `${n / scale}${unit}`;
+ },
+};
+
+const MODALITY_LABELS: Record<DatasetModality, string> = {
+ "3d": "3D",
+ audio: "Audio",
+ document: "Document",
+ geospatial: "Geospatial",
+ image: "Image",
+ tabular: "Tabular",
+ text: "Text",
+ timeseries: "Time-series",
+ video: "Video",
+};
+
+const MODALITY_ICONS: Record<DatasetModality, IconSvgElement> = {
+ "3d": CubeIcon,
+ audio: AiSpeechIcon,
+ document: File01Icon,
+ geospatial: Location01Icon,
+ image: ImageIcon,
+ tabular: Table01Icon,
+ text: TextFontIcon,
+ timeseries: ChartLineData01Icon,
+ video: FlimSlateIcon,
+};
+
+const THUMB = 12;
+const SLIDER_FG =
+ "[--hub-slider-fg:color-mix(in_oklab,var(--foreground)_68%,var(--background))] dark:[--hub-slider-fg:color-mix(in_oklab,var(--foreground)_86%,var(--background))]";
+const RANGE_FILL = "bg-(--hub-slider-fg)";
+
+function stopIndex(
+ stops: readonly number[],
+ value: number | undefined,
+ end: number,
+) {
+ if (value === undefined) {
+ return end;
+ }
+ let best = 0;
+ for (let i = 1; i < stops.length; i++) {
+ if (Math.abs(stops[i] - value) < Math.abs(stops[best] - value)) {
+ best = i;
+ }
+ }
+ return best;
+}
+/** A two-thumb range over fixed stops. The value chips ride the thumbs and stand in for the
+ * tick labels under them; the limits apply on release. */
+function RangeStops({
+ spec,
+ value,
+ onChange,
+}: {
+ spec: RangeSpec;
+ value: ModelSearchFilters;
+ onChange: (value: ModelSearchFilters) => void;
+}) {
+ const last = spec.stops.length - 1;
+ const committed: [number, number] = [
+ stopIndex(spec.stops, value[spec.min], 0),
+ stopIndex(spec.stops, value[spec.max], last),
+ ];
+ // Only while dragging. Radix can report a keyboard step after its commit, so a new committed
+ // value (or a reset elsewhere) clears it too.
+ const [dragging, setDragging] = useState<[number, number] | null>(null);
+ const minValue = value[spec.min];
+ const maxValue = value[spec.max];
+ // biome-ignore lint/correctness/useExhaustiveDependencies: clears on a committed change
+ useEffect(() => setDragging(null), [minValue, maxValue]);
+ const [lo, hi] = dragging ?? committed;
+ const set = lo !== 0 || hi !== last;
+ // Thumbs stay inside the track, so stop i sits half a thumb in from each end.
+ const covered = (i: number) => i === lo || i === hi;
+ // The end labels and chips hug the track's ends instead of hanging past them.
+ const edge = (i: number) =>
+ i === 0 ? { left: 0 } : i === last ? { right: 0 } : undefined;
+ const at = (i: number) =>
+ `calc(${THUMB / 2}px + (100% - ${THUMB}px) * ${i / last})`;
+ const chip = (i: number) => spec.labels[i] ?? spec.format(spec.stops[i]);
+ return (
+ <fieldset>
+ <legend className={SECTION_LABEL}>
+ <HoverInfo label={spec.label}>{spec.about}</HoverInfo>
+ {set && (
+ <button
+ type="button"
+ onClick={() =>
+ onChange({
+ ...value,
+ [spec.min]: undefined,
+ [spec.max]: undefined,
+ })
+ }
+ className="flex cursor-pointer items-center gap-1 transition-colors hover:text-foreground"
+ >
+ <HugeiconsIcon
+ icon={UndoIcon}
+ strokeWidth={1.75}
+ className="size-3"
+ />
+ Reset
+ </button>
+ )}
+ </legend>
+ {/* Inset by an end pill's overhang, so the pills line up with the labels above. */}
+ <div className={cn("relative mx-4.5 pt-7 pb-1", SLIDER_FG)}>
+ <div aria-hidden={true} className="absolute inset-x-0 top-0 h-5">
+ {spec.labels.map((label, i) =>
+ label === null && !covered(i) ? null : (
+ <span
+ // biome-ignore lint/suspicious/noArrayIndexKey: fixed stops
+ key={i}
+ style={edge(i) ?? { left: at(i) }}
+ className={cn(
+ // A thumb's stop wears a pill; the padding sits outside the text so it stays put.
+ "absolute top-0.5 whitespace-nowrap text-ui-11 tabular-nums",
+ !edge(i) && "-translate-x-1/2",
+ covered(i)
+ ? cn(
+ "-mx-1 -my-0.5 rounded-md px-1 py-0.5 font-semibold text-background",
+ RANGE_FILL,
+ )
+ : "text-muted-foreground",
+ )}
+ >
+ {chip(i)}
+ </span>
+ ),
+ )}
+ </div>
+ <SliderPrimitive.Root
+ min={0}
+ max={last}
+ step={1}
+ minStepsBetweenThumbs={0}
+ value={[lo, hi]}
+ onValueChange={(next) => setDragging([next[0], next[1]])}
+ onValueCommit={(next) => {
+ setDragging(null);
+ onChange({
+ ...value,
+ [spec.min]: next[0] === 0 ? undefined : spec.stops[next[0]],
+ [spec.max]: next[1] === last ? undefined : spec.stops[next[1]],
+ });
+ }}
+ className="group/range relative flex h-4 w-full touch-none select-none items-center"
+ >
+ <SliderPrimitive.Track className="relative h-[3px] w-full grow rounded-full bg-[color-mix(in_oklab,var(--foreground)_calc(4%*var(--contrast-wash-gain,1)),transparent)]">
+ {spec.stops.map((_, i) =>
+ // Under the range, which covers them where it runs, so its fill stays unbroken.
+ i === 0 || i === last ? null : (
+ <span
+ // biome-ignore lint/suspicious/noArrayIndexKey: fixed stops
+ key={i}
+ aria-hidden={true}
+ style={{ left: at(i) }}
+ className="absolute top-1/2 h-3 w-px -translate-x-1/2 -translate-y-1/2 bg-[color-mix(in_oklab,var(--foreground)_calc(28%*var(--contrast-wash-gain,1)),transparent)]"
+ />
+ ),
+ )}
+ <SliderPrimitive.Range
+ className={cn("absolute h-full rounded-full", RANGE_FILL)}
+ />
+ </SliderPrimitive.Track>
+ {([lo, hi] as const).map((index, thumb) => (
+ <SliderPrimitive.Thumb
+ key={thumb === 0 ? "min" : "max"}
+ aria-label={`${thumb === 0 ? "Minimum" : "Maximum"} ${spec.label.toLowerCase()}`}
+ aria-valuetext={chip(index)}
+ style={{ width: THUMB, height: THUMB }}
+ className={cn(
+ "relative block cursor-grab rounded-full outline-none transition-shadow duration-150 hover:shadow-[0_0_0_8px_color-mix(in_srgb,var(--hub-slider-fg)_18%,transparent)] focus-visible:shadow-[0_0_0_8px_color-mix(in_srgb,var(--hub-slider-fg)_18%,transparent)] active:cursor-grabbing active:shadow-[0_0_0_10px_color-mix(in_srgb,var(--hub-slider-fg)_22%,transparent)]",
+ RANGE_FILL,
+ )}
+ />
+ ))}
+ </SliderPrimitive.Root>
+ </div>
+ </fieldset>
+ );
+}
+
+/** A tick option as a pill in the Hub's control look: the picked ones raised like a selected
+ * segment, with a check on the right. */
+function OptionTile({
+ icon,
+ label,
+ checked,
+ locked,
+ onToggle,
+}: {
+ icon?: ReactNode;
+ label: string;
+ checked: boolean;
+ /** The last tick of a group, which stays. */
+ locked: boolean;
+ onToggle: () => void;
+}) {
+ return (
+ <button
+ type="button"
+ role="checkbox"
+ aria-checked={checked}
+ aria-disabled={locked || undefined}
+ onClick={() => {
+ if (!locked) {
+ onToggle();
+ }
+ }}
+ className={cn(
+ "relative flex w-full cursor-pointer select-none items-center gap-2.5 rounded-full py-2 pr-8 pl-3.5 text-left text-sm transition-colors aria-disabled:cursor-default",
+ checked
+ ? cn(PICKED_FILL, "text-foreground")
+ : cn(UNPICKED_FILL, "text-muted-foreground hover:text-foreground"),
+ )}
+ >
+ {icon}
+ <span className="truncate">{label}</span>
+ {checked && (
+ <HugeiconsIcon
+ icon={Tick02Icon}
+ strokeWidth={2}
+ className="pointer-events-none absolute right-2.5 size-4"
+ />
+ )}
+ </button>
+ );
+}
+
+/** A labelled switch; its note shows on hovering the label. */
+function SwitchField({
+ label,
+ about,
+ checked,
+ onCheckedChange,
+}: {
+ label: string;
+ about: string;
+ checked: boolean;
+ onCheckedChange: (checked: boolean) => void;
+}) {
+ return (
+ <div className="flex items-start justify-between gap-3 px-3">
+ <span className="pt-0.5 text-ui-12 text-muted-foreground">
+ <HoverInfo label={label}>{about}</HoverInfo>
+ </span>
+ <Switch
+ aria-label={label}
+ checked={checked}
+ onCheckedChange={onCheckedChange}
+ />
+ </div>
+ );
+}
+
+/** A labelled pill toggle, the Hugging Face / ModelScope switch's look. */
+function SegmentedRow<T extends string>({
+ label,
+ about,
+ value,
+ options,
+ onChange,
+}: {
+ label: string;
+ about: string;
+ value: T;
+ options: readonly (readonly [T, string])[];
+ onChange: (value: T) => void;
+}) {
+ return (
+ <div className="flex items-start justify-between gap-3 px-3">
+ <span className="pt-0.5 text-ui-12 text-muted-foreground">
+ <HoverInfo label={label}>{about}</HoverInfo>
+ </span>
+ <div
+ role="radiogroup"
+ aria-label={label}
+ // Light keeps the segmented toggle's raised white pick; dark takes the pills' fills, the track
+ // at field-soft's rest.
+ className="hub-tab-toggle inline-flex h-8 items-center rounded-full dark:[--hub-tab-track:color-mix(in_srgb,var(--accent)_60%,transparent)]"
+ >
+ {options.map(([key, text]) => {
+ const active = value === key;
+ return (
+ <button
+ key={key}
+ type="button"
+ role="radio"
+ aria-checked={active}
+ onClick={() => {
+ if (!active) {
+ onChange(key);
+ }
+ }}
+ className={cn(
+ "relative flex h-8 cursor-pointer items-center rounded-full px-3 text-xs font-medium transition-colors",
+ active
+ ? "hub-tab-toggle-pill text-foreground dark:bg-[color-mix(in_srgb,var(--accent),white_8%)]!"
+ : "text-muted-foreground hover:text-foreground",
+ )}
+ >
+ <span className="relative z-10">{text}</span>
+ </button>
+ );
+ })}
+ </div>
+ </div>
+ );
+}
+
+/** A section label with an i. Its note shows while the label is hovered, not on focus (opening the
+ * popover doesn't pop it), and to the left of the popover so it never covers the other section. */
+function HoverInfo({ label, children }: { label: string; children: string }) {
+ const [open, setOpen] = useState(false);
+ return (
+ <Tooltip open={open}>
+ <TooltipTrigger asChild={true}>
+ <span
+ onPointerEnter={() => setOpen(true)}
+ onPointerLeave={() => setOpen(false)}
+ className="group/title flex cursor-help items-center gap-1 transition-colors hover:text-foreground"
+ >
+ {label}
+ <button
+ type="button"
+ aria-label={`About ${label.toLowerCase()}`}
+ className="inline-flex cursor-help items-center opacity-0 transition-opacity focus-visible:opacity-100 group-hover/title:opacity-100"
+ >
+ <HugeiconsIcon
+ icon={InformationCircleIcon}
+ strokeWidth={1.75}
+ className="size-3"
+ />
+ </button>
+ </span>
+ </TooltipTrigger>
+ <TooltipContent
+ side="left"
+ sideOffset={24}
+ className="max-w-[calc(240px*var(--ui-space-scale,1))]"
+ >
+ {children}
+ </TooltipContent>
+ </Tooltip>
+ );
+}
+
+/** The Hub's filter popover: capabilities, then (where the Hub search takes them) size and
+ * context limits and the uploader. Ticks apply at once; the limits on release. */
export function ModelSearchFiltersControl({
value,
onChange,
+ capabilities,
+ onCapabilitiesChange,
+ isolateFirstCapability,
+ uploaders,
+ uploadersChanged,
+ onUploadersChange,
+ onReset,
+ showModelFilters,
+ datasets,
+ onDatasetsChange,
+ modelSections,
+ datasetSections,
+ modalities,
+ onModalitiesChange,
className,
}: {
value: ModelSearchFilters;
onChange: (value: ModelSearchFilters) => void;
+ /** Empty means every box ticked (no filter); otherwise a model with any of the picks is listed. */
+ capabilities: HubCapabilityFilter[];
+ onCapabilitiesChange: (value: HubCapabilityFilter[]) => void;
+ /** True until the first change from the defaults: that capability pick keeps just that one. */
+ isolateFirstCapability: boolean;
+ uploaders: readonly HubUploader[];
+ /** False while the default applies, which leaves the icon without its dot. */
+ uploadersChanged: boolean;
+ onUploadersChange: (value: HubUploader[]) => void;
+ /** Back to no filters: every capability, the default uploaders, no limits. */
+ onReset: () => void;
+ showModelFilters: boolean;
+ datasets: boolean;
+ /** Capabilities, ranges and uploader apply (Discover models). */
+ modelSections: boolean;
+ /** Modalities and size apply (Discover datasets). */
+ datasetSections: boolean;
+ /** Empty means every modality ticked (no filter). */
+ modalities: DatasetModality[];
+ onModalitiesChange: (value: DatasetModality[]) => void;
+ onDatasetsChange: (value: boolean) => void;
className?: string;
}) {
const [open, setOpen] = useState(false);
- const [draft, setDraft] = useState(value);
- const id = useId();
- const invalid =
- (draft.minParams !== undefined &&
- draft.maxParams !== undefined &&
- draft.minParams > draft.maxParams) ||
- (draft.minContext !== undefined &&
- draft.maxContext !== undefined &&
- draft.minContext > draft.maxContext);
+ const unslothOnly = uploaders.length === 1 && uploaders[0] === "unsloth";
+ const filtered =
+ modalities.length > 0 ||
+ (modelSections && capabilities.length > 0) ||
+ uploadersChanged ||
+ ((showModelFilters || datasetSections) && hasModelSearchFilters(value));
return (
- <Popover
- open={open}
- onOpenChange={(next) => {
- if (next) {
- setDraft(value);
- }
- setOpen(next);
- }}
- >
+ <Popover open={open} onOpenChange={setOpen}>
{/* Icon-sized so the Discover toolbar keeps its existing single-row layout. */}
<Tooltip>
<TooltipTrigger asChild={true}>
<PopoverTrigger asChild={true}>
- <button
- type="button"
- className={className}
- aria-label="Model size and publisher filters"
- >
+ <button type="button" className={className} aria-label="Filters">
<HugeiconsIcon
- icon={FilterIcon}
+ icon={FilterMailIcon}
strokeWidth={1.75}
- className="size-4"
+ // Its lines narrow downward, so the box's centre reads high: a pixel down evens it.
+ className="size-5 translate-y-px"
/>
- {hasModelSearchFilters(value) && (
+ {filtered && (
<span
aria-hidden="true"
className="absolute right-1.5 top-1.5 size-1.5 rounded-full bg-primary"
@@ -73,105 +583,217 @@ export function ModelSearchFiltersControl({
</PopoverTrigger>
</TooltipTrigger>
<TooltipContent side="bottom" sideOffset={6}>
- More filters
+ Filters
</TooltipContent>
</Tooltip>
<PopoverContent
align="end"
sideOffset={8}
- className="w-80 max-w-[calc(100vw-2rem)]"
+ collisionPadding={12}
+ onCloseAutoFocus={(event) => event.preventDefault()}
+ // The sections scroll inside the padding, so a short window keeps the corners round and
+ // Reset all in view; flex children would otherwise shrink the separators away.
+ className="hub-menu-instant hub-composer-menu menu-soft-surface gap-0 overflow-hidden w-[calc(392px*var(--ui-space-scale,1))] max-w-[calc(100vw-1rem)] ring-0"
>
- <form
- className="flex flex-col gap-4"
- onSubmit={(event) => {
- event.preventDefault();
- if (invalid) {
- return;
- }
- onChange(draft);
- setOpen(false);
- }}
- >
- {(
- [
- ["Parameters (billions)", "minParams", "maxParams", 1e9],
- ["Context length (tokens)", "minContext", "maxContext", 1],
- ] as const
- ).map(([label, min, max, scale]) => (
- <fieldset key={min} className="space-y-2">
- <legend className="text-sm font-medium">{label}</legend>
- <div className="grid grid-cols-2 gap-2">
- {([min, max] as const).map((key, index) => (
- <label
- key={key}
- htmlFor={`${id}-${key}`}
- className="space-y-1 text-xs text-muted-foreground"
- >
- <span>{index === 0 ? "Minimum" : "Maximum"}</span>
- <Input
- id={`${id}-${key}`}
- aria-label={`${index === 0 ? "Minimum" : "Maximum"} ${label.toLowerCase()}`}
- type="number"
- min={0}
- step={scale === 1 ? 1 : "any"}
- placeholder="Any"
- value={draft[key] === undefined ? "" : draft[key] / scale}
- onChange={(event) =>
- setDraft({
- ...draft,
- [key]:
- event.target.value === ""
- ? undefined
- : Math.round(event.target.valueAsNumber * scale),
- })
- }
- />
- </label>
- ))}
+ <div className="min-h-0 flex-1 overflow-y-auto overscroll-contain [scrollbar-width:thin]">
+ {modelSections && (
+ <>
+ <fieldset>
+ <legend className={SECTION_LABEL}>
+ Capabilities
+ {capabilities.length > 0 && (
+ <button
+ type="button"
+ onClick={() => onCapabilitiesChange([])}
+ className="cursor-pointer transition-colors hover:text-foreground"
+ >
+ Select all
+ </button>
+ )}
+ </legend>
+ <div className="grid grid-cols-2 gap-1.5 px-3 pb-0.5">
+ {CAPABILITY_FILTER_OPTIONS.map((option) => {
+ const ticked = (key: HubCapabilityFilter) =>
+ capabilities.length === 0 || capabilities.includes(key);
+ const checked = ticked(option.value);
+ const glyph = CAPABILITY_ICONS[option.value];
+ // Kept in the list's order, so it doesn't depend on click order.
+ const next = CAPABILITY_FILTER_OPTIONS.map(
+ (o) => o.value,
+ ).filter((key) =>
+ key === option.value ? !checked : ticked(key),
+ );
+ return (
+ <OptionTile
+ key={option.value}
+ icon={
+ glyph ? (
+ <HugeiconsIcon
+ icon={glyph}
+ strokeWidth={2}
+ className="size-4 shrink-0"
+ />
+ ) : (
+ <BulbIcon className="size-4 shrink-0" />
+ )
+ }
+ label={option.label}
+ checked={checked}
+ locked={next.length === 0}
+ onToggle={() =>
+ onCapabilitiesChange(
+ capabilities.length === 0 && isolateFirstCapability
+ ? [option.value]
+ : next.length === CAPABILITY_FILTER_OPTIONS.length
+ ? []
+ : next,
+ )
+ }
+ />
+ );
+ })}
+ </div>
+ </fieldset>
+ {showModelFilters && (
+ <>
+ <div
+ aria-hidden={true}
+ className={cn(
+ SECTION_GAP,
+ "mt-[calc(5px*var(--ui-space-scale,1))]",
+ )}
+ />
+ <div className="flex flex-col gap-2.5 pb-0.5">
+ {RANGES.map((spec) => (
+ <RangeStops
+ key={spec.label}
+ spec={spec}
+ value={value}
+ onChange={onChange}
+ />
+ ))}
+ </div>
+ </>
+ )}
+ <div
+ aria-hidden={true}
+ className={cn(
+ SECTION_GAP,
+ showModelFilters
+ ? "mt-0"
+ : "mt-[calc(5px*var(--ui-space-scale,1))]",
+ )}
+ />
+ </>
+ )}
+ {datasetSections && (
+ <>
+ <fieldset>
+ <legend className={SECTION_LABEL}>
+ Modalities
+ {modalities.length > 0 && (
+ <button
+ type="button"
+ onClick={() => onModalitiesChange([])}
+ className="cursor-pointer transition-colors hover:text-foreground"
+ >
+ Select all
+ </button>
+ )}
+ </legend>
+ <div className="grid grid-cols-2 gap-1.5 px-3 pb-0.5">
+ {DATASET_MODALITIES.map((modality) => {
+ const ticked = (key: DatasetModality) =>
+ modalities.length === 0 || modalities.includes(key);
+ const checked = ticked(modality);
+ const next = DATASET_MODALITIES.filter((key) =>
+ key === modality ? !checked : ticked(key),
+ );
+ return (
+ <OptionTile
+ key={modality}
+ icon={
+ <HugeiconsIcon
+ icon={MODALITY_ICONS[modality]}
+ strokeWidth={2}
+ className="size-4 shrink-0"
+ />
+ }
+ label={MODALITY_LABELS[modality]}
+ checked={checked}
+ locked={next.length === 0}
+ onToggle={() =>
+ onModalitiesChange(
+ // Like Capabilities: the first pick from the defaults keeps just that one.
+ modalities.length === 0 && isolateFirstCapability
+ ? [modality]
+ : next.length === DATASET_MODALITIES.length
+ ? []
+ : next,
+ )
+ }
+ />
+ );
+ })}
+ </div>
+ </fieldset>
+ <div
+ aria-hidden={true}
+ className={cn(
+ SECTION_GAP,
+ "mt-[calc(5px*var(--ui-space-scale,1))]",
+ )}
+ />
+ <div className="pb-0.5">
+ <RangeStops
+ spec={DATASET_ROWS}
+ value={value}
+ onChange={onChange}
+ />
</div>
- </fieldset>
- ))}
- <label className="flex items-center gap-2 text-sm">
- <input
- type="checkbox"
- checked={draft.organizationsOnly ?? false}
- onChange={(event) =>
- setDraft({ ...draft, organizationsOnly: event.target.checked })
- }
- />
- Organizations only (hide personal accounts)
- </label>
- <p className="text-xs text-muted-foreground">
- Ranges include both limits. Models without the requested metadata
- are excluded. Context is the published limit, not your device's
- capacity.
- </p>
- {invalid && (
- <p role="alert" className="text-xs text-destructive">
- Minimum must not exceed maximum.
- </p>
+ <div aria-hidden={true} className={cn(SECTION_GAP, "mt-0")} />
+ </>
)}
- <div className="flex justify-end gap-2">
- <button
- type="button"
- className="rounded-full px-3 py-2 text-sm"
- onClick={() => {
- setDraft({});
- onChange({});
- setOpen(false);
- }}
- >
- Clear
- </button>
- <button
- type="submit"
- disabled={invalid}
- className="rounded-full bg-primary px-3 py-2 text-sm text-primary-foreground disabled:opacity-50"
- >
- Apply filters
- </button>
+ <div className="flex flex-col gap-3 pt-2 pb-[calc(7px*var(--ui-space-scale,1))]">
+ {/* The Hub search's own scope, so it stays on ModelScope too; datasets take none. */}
+ {modelSections && (
+ <SegmentedRow
+ label="Uploader"
+ about="Unsloth lists Unsloth's own uploads. All uploaders searches every account on the Hub; a search starts there."
+ value={unslothOnly ? "unsloth" : "all"}
+ options={[
+ ["unsloth", "Unsloth"],
+ ["all", "All uploaders"],
+ ]}
+ onChange={(next) =>
+ onUploadersChange(
+ next === "unsloth" ? ["unsloth"] : [...HUB_UPLOADERS],
+ )
+ }
+ />
+ )}
+ <div>
+ <SwitchField
+ label="Datasets only"
+ about="Lists datasets instead of models."
+ checked={datasets}
+ onCheckedChange={onDatasetsChange}
+ />
+ </div>
</div>
- </form>
+ </div>
+ <div aria-hidden={true} className={cn(SEPARATOR, "mb-1.5 shrink-0")} />
+ <div className="flex shrink-0 items-center justify-end px-3 pb-0.5">
+ <Button
+ type="button"
+ variant="ghost"
+ size="xs"
+ disabled={!filtered}
+ onClick={onReset}
+ >
+ Reset all
+ </Button>
+ </div>
</PopoverContent>
</Popover>
);
diff --git a/studio/frontend/src/features/hub/catalog/models-toolbar.tsx b/studio/frontend/src/features/hub/catalog/models-toolbar.tsx
index 1927545730d..7bc1daa7114 100644
--- a/studio/frontend/src/features/hub/catalog/models-toolbar.tsx
+++ b/studio/frontend/src/features/hub/catalog/models-toolbar.tsx
@@ -13,9 +13,8 @@ import type { HfSortKey } from "@/features/hub/hooks/use-hub-model-search";
import { useHubSource } from "@/lib/hf-endpoint";
import { cn } from "@/lib/utils";
import {
- AiChipIcon,
+ ArrowUpDownIcon,
CancelCircleIcon,
- Database02Icon,
Delete02Icon,
FolderSearchIcon,
Search01Icon,
@@ -24,24 +23,25 @@ import {
} from "@hugeicons/core-free-icons";
import { HugeiconsIcon } from "@hugeicons/react";
import { memo, useLayoutEffect, useMemo, useRef, useState } from "react";
+import type { HubCapabilityFilter } from "../lib/model-capabilities";
+import type {
+ HubUploader,
+ ModelSearchFilters,
+} from "../lib/model-search-filters";
import {
clearRecentSearches,
recordRecentSearch,
removeRecentSearch,
useRecentSearches,
} from "../lib/recent-searches";
-import {
- CAPABILITY_FILTER_OPTIONS,
- FORMAT_FILTER_OPTIONS,
-} from "../lib/view-models";
+import type { DatasetModality } from "../lib/dataset-filters";
+import { FORMAT_FILTER_OPTIONS } from "../lib/view-models";
import type {
- CapabilityFilter,
ModelFormatFilter,
ModelsTab,
ResourceTypeFilter,
} from "../types";
import { type HubOption, HubOptionMenu } from "./hub-option-menu";
-import type { ModelSearchFilters } from "../lib/model-search-filters";
import { ModelSearchFiltersControl } from "./model-search-filters";
import { RecentSearches } from "./recent-searches";
@@ -72,8 +72,11 @@ export const ModelsToolbar = memo(function ModelsToolbar({
onResourceTypeChange,
formatFilter,
onFormatFilterChange,
- capabilityFilter,
- onCapabilityFilterChange,
+ capabilityFilters,
+ onCapabilityFiltersChange,
+ isolateFirstCapability,
+ datasetModalities,
+ onDatasetModalitiesChange,
fitOnDeviceOnly,
onFitOnDeviceOnlyChange,
onManageLocalFolders,
@@ -82,9 +85,18 @@ export const ModelsToolbar = memo(function ModelsToolbar({
npuAvailable = false,
searchFilters,
onSearchFiltersChange,
+ uploaders,
+ uploadersChanged,
+ onUploadersChange,
+ onResetFilters,
}: {
searchFilters: ModelSearchFilters;
onSearchFiltersChange: (value: ModelSearchFilters) => void;
+ uploaders: readonly HubUploader[];
+ /** False while the default applies (Unsloth's uploads, or every uploader for a search). */
+ uploadersChanged: boolean;
+ onUploadersChange: (value: HubUploader[]) => void;
+ onResetFilters: () => void;
tab: ModelsTab;
onTabChange: (tab: ModelsTab) => void;
query: string;
@@ -96,8 +108,14 @@ export const ModelsToolbar = memo(function ModelsToolbar({
onResourceTypeChange: (value: ResourceTypeFilter) => void;
formatFilter: ModelFormatFilter;
onFormatFilterChange: (value: ModelFormatFilter) => void;
- capabilityFilter: CapabilityFilter;
- onCapabilityFilterChange: (value: CapabilityFilter) => void;
+ /** None picked means every capability. */
+ capabilityFilters: HubCapabilityFilter[];
+ onCapabilityFiltersChange: (value: HubCapabilityFilter[]) => void;
+ /** Until the first change from the defaults, a capability pick keeps just that one. */
+ isolateFirstCapability: boolean;
+ /** Empty means every modality. */
+ datasetModalities: DatasetModality[];
+ onDatasetModalitiesChange: (value: DatasetModality[]) => void;
/** Shared with the chat model selector: hide models over the device budget. */
fitOnDeviceOnly: boolean;
onFitOnDeviceOnlyChange: (value: boolean) => void;
@@ -214,15 +232,10 @@ export const ModelsToolbar = memo(function ModelsToolbar({
}
return options;
}, [tab, npuAvailable]);
- const capabilityOptions = useMemo<HubOption<CapabilityFilter>[]>(
- () =>
- CAPABILITY_FILTER_OPTIONS.map((option) => ({
- value: option.value,
- label: option.label,
- })),
- [],
- );
const hubSource = useHubSource();
+ const showCapabilities = isDiscover && !isDataset && !npuList;
+ // The size and context limits read Hugging Face metadata, so only there.
+ const showModelFilters = showCapabilities && hubSource !== "modelscope";
const sortOptions = useMemo<HubOption<HfSortKey>[]>(
() =>
SORT_OPTIONS.filter(
@@ -233,8 +246,9 @@ export const ModelsToolbar = memo(function ModelsToolbar({
})),
[hubSource],
);
+ // pl-4 / pr-3.5: the model picker's dropdown insets, so the two read alike.
const triggerBase = cn(
- "field-trigger hub-menu-trigger field-soft transition-colors",
+ "field-trigger hub-menu-trigger field-soft transition-colors pl-4 pr-3.5",
"focus-visible:ring-0 focus-visible:ring-offset-0 focus-visible:border-border",
);
return (
@@ -373,6 +387,30 @@ export const ModelsToolbar = memo(function ModelsToolbar({
</div>
<div className="flex min-w-0 flex-wrap items-center gap-2 lg:flex-[0_0_auto] lg:flex-nowrap lg:justify-end">
+ <ModelSearchFiltersControl
+ value={searchFilters}
+ onChange={onSearchFiltersChange}
+ capabilities={capabilityFilters}
+ onCapabilitiesChange={onCapabilityFiltersChange}
+ isolateFirstCapability={isolateFirstCapability}
+ uploaders={uploaders}
+ uploadersChanged={uploadersChanged}
+ onUploadersChange={onUploadersChange}
+ onReset={onResetFilters}
+ showModelFilters={showModelFilters}
+ datasets={isDataset}
+ modelSections={showCapabilities}
+ datasetSections={isDiscover && isDataset}
+ modalities={datasetModalities}
+ onModalitiesChange={onDatasetModalitiesChange}
+ onDatasetsChange={(on) =>
+ onResourceTypeChange(on ? "datasets" : "models")
+ }
+ className={cn(
+ triggerBase,
+ "relative inline-flex size-9 shrink-0 items-center justify-center rounded-full p-0",
+ )}
+ />
{tab === "downloaded" && !isDataset && (
<Tooltip>
<TooltipTrigger asChild={true}>
@@ -436,27 +474,9 @@ export const ModelsToolbar = memo(function ModelsToolbar({
}
}}
ariaLabel="Format filter"
- className={cn(triggerBase, "w-[calc(144px*var(--ui-space-scale,1))]")}
- />
- )}
-
- {tab === "discover" && !isDataset && !npuList && (
- <HubOptionMenu
- value={capabilityFilter}
- options={capabilityOptions}
- onValueChange={onCapabilityFilterChange}
- ariaLabel="Capability filter"
- className={cn(triggerBase, "w-[calc(128px*var(--ui-space-scale,1))]")}
- />
- )}
-
- {isDiscover && !isDataset && !npuList && hubSource !== "modelscope" && (
- <ModelSearchFiltersControl
- value={searchFilters}
- onChange={onSearchFiltersChange}
className={cn(
triggerBase,
- "relative inline-flex size-9 shrink-0 items-center justify-center rounded-full p-0",
+ "w-[calc(160px*var(--ui-space-scale,1))]",
)}
/>
)}
@@ -467,7 +487,23 @@ export const ModelsToolbar = memo(function ModelsToolbar({
options={sortOptions}
onValueChange={onSortChange}
ariaLabel="Sort models"
- className={cn(triggerBase, "w-[calc(128px*var(--ui-space-scale,1))]")}
+ className={cn(
+ triggerBase,
+ "w-[calc(160px*var(--ui-space-scale,1))]",
+ )}
+ triggerContent={
+ <span className="flex items-center gap-1">
+ <HugeiconsIcon
+ icon={ArrowUpDownIcon}
+ strokeWidth={1.75}
+ className="size-3.5 shrink-0"
+ />
+ <span className="truncate">
+ {sortOptions.find((option) => option.value === sortBy)
+ ?.label ?? sortBy}
+ </span>
+ </span>
+ }
footer={
isDataset ? undefined : (
<Tooltip>
@@ -477,7 +513,7 @@ export const ModelsToolbar = memo(function ModelsToolbar({
role="checkbox"
aria-checked={fitOnDeviceOnly}
onClick={() => onFitOnDeviceOnlyChange(!fitOnDeviceOnly)}
- className="flex w-full cursor-pointer select-none items-center gap-2 rounded-[10px] px-3 py-2 text-left text-ui-12p5 text-muted-foreground transition-colors hover:text-foreground"
+ className="hub-menu-row relative flex w-full cursor-pointer select-none items-center gap-2.5 py-2 pr-3 pl-3 text-left text-sm"
>
<Checkbox
checked={fitOnDeviceOnly}
@@ -498,74 +534,6 @@ export const ModelsToolbar = memo(function ModelsToolbar({
/>
)}
- <div
- className="hub-menu-trigger hub-tab-toggle relative inline-flex h-8 shrink-0 items-center rounded-full"
- role="radiogroup"
- aria-label="Resource type"
- >
- <span
- aria-hidden="true"
- className={cn(
- "hub-tab-toggle-pill",
- // Height-filling circle (matches the 3-view-tab toggle) that slides
- // one button-width (w-8 = 32px) between the two options.
- "pointer-events-none absolute inset-y-0 left-0 w-8 rounded-full transition-transform duration-200 ease-out",
- resourceType === "datasets" ? "translate-x-8" : "translate-x-0",
- )}
- />
- <Tooltip>
- <TooltipTrigger asChild={true}>
- <button
- type="button"
- role="radio"
- aria-checked={resourceType === "models"}
- aria-label="Models"
- onClick={() => onResourceTypeChange("models")}
- className={cn(
- "relative z-10 inline-flex size-8 items-center justify-center rounded-full transition-colors",
- resourceType === "models"
- ? "text-foreground"
- : "text-muted-foreground hover:text-foreground",
- )}
- >
- <HugeiconsIcon
- icon={AiChipIcon}
- strokeWidth={1.75}
- className="size-4"
- />
- </button>
- </TooltipTrigger>
- <TooltipContent side="bottom" sideOffset={6}>
- Models
- </TooltipContent>
- </Tooltip>
- <Tooltip>
- <TooltipTrigger asChild={true}>
- <button
- type="button"
- role="radio"
- aria-checked={resourceType === "datasets"}
- aria-label="Datasets"
- onClick={() => onResourceTypeChange("datasets")}
- className={cn(
- "relative z-10 inline-flex size-8 items-center justify-center rounded-full transition-colors",
- resourceType === "datasets"
- ? "text-foreground"
- : "text-muted-foreground hover:text-foreground",
- )}
- >
- <HugeiconsIcon
- icon={Database02Icon}
- strokeWidth={1.75}
- className="size-4"
- />
- </button>
- </TooltipTrigger>
- <TooltipContent side="bottom" sideOffset={6}>
- Datasets
- </TooltipContent>
- </Tooltip>
- </div>
</div>
</div>
);
diff --git a/studio/frontend/src/features/hub/catalog/owner-scope-toggle.tsx b/studio/frontend/src/features/hub/catalog/owner-scope-toggle.tsx
deleted file mode 100644
index c21c5cee2e7..00000000000
--- a/studio/frontend/src/features/hub/catalog/owner-scope-toggle.tsx
+++ /dev/null
@@ -1,35 +0,0 @@
-// SPDX-License-Identifier: AGPL-3.0-only
-// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
-
-import { HubOptionMenu } from "./hub-option-menu";
-
-export type OwnerScope = "unsloth" | "all";
-
-const OPTIONS: { value: OwnerScope; label: string }[] = [
- { value: "unsloth", label: "Unsloth" },
- { value: "all", label: "All" },
-];
-
-/**
- * "Unsloth / All" publisher scope as a compact dropdown pill beside the
- * view-mode tabs. Only shown while browsing a model list, never on the hub feed.
- */
-export function OwnerScopeToggle({
- value,
- onChange,
-}: {
- value: OwnerScope;
- onChange: (value: OwnerScope) => void;
-}) {
- return (
- <HubOptionMenu<OwnerScope>
- value={value}
- options={OPTIONS}
- onValueChange={onChange}
- ariaLabel="Publisher scope"
- align="end"
- // Extra gap before the chevron; min-width keeps the pill readable.
- className="h-8 min-w-[calc(96px*var(--ui-space-scale,1))] gap-1.5 text-ui-11p5"
- />
- );
-}
diff --git a/studio/frontend/src/features/hub/catalog/shared.tsx b/studio/frontend/src/features/hub/catalog/shared.tsx
index 94040ad3e0f..bf75cf8b593 100644
--- a/studio/frontend/src/features/hub/catalog/shared.tsx
+++ b/studio/frontend/src/features/hub/catalog/shared.tsx
@@ -6,17 +6,17 @@ import {
TooltipContent,
TooltipTrigger,
} from "@/components/ui/tooltip";
+import { BulbIcon } from "@/lib/bulb-icon";
+import { AiSpeechIcon } from "@/lib/hugeicons-derived";
import { cn } from "@/lib/utils";
import {
- BrainIcon,
Chat01Icon,
CodeIcon,
GlobeIcon,
- HeadphonesIcon,
ImageIcon,
+ LayoutTable02Icon,
LockIcon,
LockKeyIcon,
- SparklesIcon,
ViewIcon,
Wrench01Icon,
} from "@hugeicons/core-free-icons";
@@ -24,13 +24,16 @@ import type { IconSvgElement } from "@hugeicons/react";
import { HugeiconsIcon } from "@hugeicons/react";
import type { Capability, CapabilityKey } from "../lib/model-capabilities";
-const CAPABILITY_ICON: Record<CapabilityKey, IconSvgElement> = {
+// Reasoning draws the composer's thinking bulb instead (CapabilityGlyph).
+const CAPABILITY_ICON: Record<
+ Exclude<CapabilityKey, "reasoning">,
+ IconSvgElement
+> = {
vision: ViewIcon,
- audio: HeadphonesIcon,
+ audio: AiSpeechIcon,
tools: Wrench01Icon,
- reasoning: BrainIcon,
code: CodeIcon,
- embedding: SparklesIcon,
+ embedding: LayoutTable02Icon,
diffusion: ImageIcon,
multilingual: GlobeIcon,
conversational: Chat01Icon,
@@ -149,11 +152,15 @@ export function CapabilityPill({
CAPABILITY_TONE[capability.key],
)}
>
- <HugeiconsIcon
- icon={CAPABILITY_ICON[capability.key]}
- strokeWidth={1.75}
- className="size-3"
- />
+ {capability.key === "reasoning" ? (
+ <BulbIcon className="size-3 shrink-0" />
+ ) : (
+ <HugeiconsIcon
+ icon={CAPABILITY_ICON[capability.key]}
+ strokeWidth={1.75}
+ className="size-3"
+ />
+ )}
{!iconOnly && capability.label}
</span>
);
diff --git a/studio/frontend/src/features/hub/hooks/use-hub-dataset-search.ts b/studio/frontend/src/features/hub/hooks/use-hub-dataset-search.ts
index 8c8e1477ae9..919401be022 100644
--- a/studio/frontend/src/features/hub/hooks/use-hub-dataset-search.ts
+++ b/studio/frontend/src/features/hub/hooks/use-hub-dataset-search.ts
@@ -5,6 +5,7 @@ import { getHfEndpoint, useHfEndpoint } from "@/lib/hf-endpoint";
import { fetchWithTimeout } from "../lib/network";
import type { HubModelType } from "../types";
import { listDatasets } from "@huggingface/hub";
+import { datasetModalities, datasetSizeBucket } from "../lib/dataset-filters";
import { useCallback, useMemo } from "react";
import { useHubPaginatedSearch } from "./use-hub-paginated-search";
@@ -62,6 +63,10 @@ export interface HfDatasetResult {
sizeCategory?: string;
taskCategories: string[];
plainTags: string[];
+ /** The Hub's modality tags (text, image, ...), for the dataset filters. */
+ modalities: string[];
+ /** Index of the Hub's size_categories bucket, smallest first. */
+ sizeBucket?: number;
}
function mapDataset(raw: unknown): HfDatasetResult {
@@ -109,6 +114,8 @@ function mapDataset(raw: unknown): HfDatasetResult {
sizeCategory: card?.size_categories?.[0],
taskCategories,
plainTags,
+ modalities: datasetModalities(tags),
+ sizeBucket: datasetSizeBucket(tags),
};
}
@@ -394,6 +401,7 @@ function toCuratedDatasetResult(id: string): HfDatasetResult {
likes: 0,
taskCategories: [],
plainTags: [],
+ modalities: [],
};
}
diff --git a/studio/frontend/src/features/hub/hub-page.tsx b/studio/frontend/src/features/hub/hub-page.tsx
index f634e84257a..8070a1c403b 100644
--- a/studio/frontend/src/features/hub/hub-page.tsx
+++ b/studio/frontend/src/features/hub/hub-page.tsx
@@ -67,13 +67,14 @@ import {
InventoryTypeFilterControl,
} from "./catalog/models-table";
import {
+ HUB_UPLOADERS,
+ type HubUploader,
hasModelSearchFilters,
type ModelSearchFilters,
} from "./lib/model-search-filters";
import { ModelsToolbar } from "./catalog/models-toolbar";
import { NpuCatalogList } from "./catalog/npu-catalog-list";
import { OnDeviceFoldersDialog } from "./catalog/on-device-folders-dialog";
-import { OwnerScopeToggle } from "./catalog/owner-scope-toggle";
import { useDiscoverSearch } from "./hooks/use-discover-search";
import { useFeedWriteBack } from "./hooks/use-feed-write-back";
import { useHiddenEmbeddingModelIds } from "./hooks/use-hidden-embedding-models";
@@ -122,13 +123,18 @@ import {
registerRefresh,
supersedingRefresh,
} from "./lib/superseded-refresh";
+import {
+ type DatasetModality,
+ matchesDatasetFilters,
+} from "./lib/dataset-filters";
+import type { HubCapabilityFilter } from "./lib/model-capabilities";
import { studioPageForTask } from "./lib/unsloth-support";
import {
buildDiscoverRows,
detectResultFormat,
discoveryInventorySignature,
isUnslothFinetunable,
- matchesCapability,
+ matchesHubCapability,
matchesFormat,
matchesRecommended,
} from "./lib/view-models";
@@ -140,7 +146,6 @@ import {
} from "./stores/hub-feed-store";
import type {
CachedInventoryRow,
- CapabilityFilter,
DiscoverRow,
LocalInventoryRow,
ModelFormatFilter,
@@ -150,11 +155,11 @@ import type {
} from "./types";
const NO_SEARCH_FILTERS: ModelSearchFilters = {};
+const UNSLOTH_UPLOADER: readonly HubUploader[] = ["unsloth"];
const MODELS_TAB_STORAGE_KEY = "unsloth.hub.modelsTab";
const ALL_MODELS_VIEW_STORAGE_KEY = "unsloth.hub.allModelsView";
const INVENTORY_SORT_STORAGE_KEY = "unsloth.hub.inventorySort";
-const OWNER_SCOPE_STORAGE_KEY = "unsloth.hub.ownerScope";
const RUN_CONFIG_REFRESH_TIMEOUT_MS = 5_000;
// Under Recommended, iconless models (no provider logo, e.g. Ornith, Inkling) show once they clear this many likes.
@@ -211,33 +216,6 @@ class RunConfigOpenCoordinator {
}
}
-/** Discover browsing scope: the whole Hub (default) or only the unsloth org. */
-export type OwnerScope = "unsloth" | "all";
-
-function readOwnerScopePreference(): OwnerScope {
- if (typeof window === "undefined") {
- return "all";
- }
- try {
- const value = window.localStorage.getItem(OWNER_SCOPE_STORAGE_KEY);
- // Default to the whole Hub; only honor an explicit "unsloth" preference.
- return value === "unsloth" ? "unsloth" : "all";
- } catch {
- return "all";
- }
-}
-
-function writeOwnerScopePreference(scope: OwnerScope): void {
- if (typeof window === "undefined") {
- return;
- }
- try {
- window.localStorage.setItem(OWNER_SCOPE_STORAGE_KEY, scope);
- } catch {
- return;
- }
-}
-
const DEFAULT_DISCOVER_CHANNEL: ChannelId = "unsloth-trending";
const FEED_LIST_CHANNEL_ID: ChannelId = "unsloth-latest";
@@ -582,22 +560,55 @@ export function ModelsPage() {
() => findChannel(DEFAULT_DISCOVER_CHANNEL)?.sort ?? "trendingScore",
);
const [direction, setDirection] = useState<HfSortDirection>("desc");
- const [ownerScope, setOwnerScopeState] = useState<OwnerScope>(
- readOwnerScopePreference,
+ // Null until the user picks: then Unsloth's uploads, or every uploader once a search is typed.
+ const [uploaderPick, setUploaderPick] = useState<HubUploader[] | null>(null);
+ // Until the popover's first change from the defaults, a capability pick keeps just that one.
+ const [firstPickArmed, setFirstPickArmed] = useState(true);
+ const [datasetModalities, setDatasetModalities] = useState<
+ DatasetModality[]
+ >([]);
+ const handlePopoverModalitiesChange = useCallback(
+ (next: DatasetModality[]) => {
+ setFirstPickArmed(false);
+ setDatasetModalities(next);
+ },
+ [],
);
- const setOwnerScope = useCallback((scope: OwnerScope) => {
- setOwnerScopeState(scope);
- writeOwnerScopePreference(scope);
+ const handlePopoverCapabilitiesChange = useCallback(
+ (next: HubCapabilityFilter[]) => {
+ setFirstPickArmed(false);
+ setCapabilityFilters(next);
+ },
+ [],
+ );
+ const handlePopoverSearchFiltersChange = useCallback(
+ (next: ModelSearchFilters) => {
+ setFirstPickArmed(false);
+ setSearchFilters(next);
+ },
+ [],
+ );
+ const handlePopoverUploadersChange = useCallback((next: HubUploader[]) => {
+ setFirstPickArmed(false);
+ setUploaderPick(next);
}, []);
const urlResourceType: ResourceTypeFilter =
hubSearch.kind === "datasets" ? "datasets" : "models";
const [resourceType, setResourceType] =
useState<ResourceTypeFilter>(urlResourceType);
// Resync on URL kind change (back/forward); it is only seeded on mount.
+ const syncedUrlKind = useRef(urlResourceType);
useEffect(() => {
+ if (syncedUrlKind.current === urlResourceType) {
+ return;
+ }
+ syncedUrlKind.current = urlResourceType;
setResourceType((current) =>
current === urlResourceType ? current : urlResourceType,
);
+ // Back/forward skips handleResourceTypeChange, so the other kind's hidden bounds go here too.
+ setSearchFilters({});
+ setDatasetModalities([]);
}, [urlResourceType]);
const [discoverFormat, setDiscoverFormat] = useState<ModelFormatFilter>(
() => findChannel(DEFAULT_DISCOVER_CHANNEL)?.format ?? "recommended",
@@ -648,12 +659,10 @@ export function ModelsPage() {
const [storedSearchFilters, setSearchFilters] = useState<ModelSearchFilters>(
{},
);
- // The publisher and config.json lookups are Hugging Face endpoints.
- const searchFilters =
- hubSource === "modelscope" ? NO_SEARCH_FILTERS : storedSearchFilters;
- const hasSearchFilters = hasModelSearchFilters(searchFilters);
- const [capabilityFilter, setCapabilityFilter] =
- useState<CapabilityFilter>("all");
+ // Several capabilities show models with any of them; none shows every model.
+ const [capabilityFilters, setCapabilityFilters] = useState<
+ HubCapabilityFilter[]
+ >([]);
// Pipeline tasks from an audio page's Search Hub link; they apply while the Audio filter is on.
const [linkedAudioTask, setLinkedAudioTask] = useState<
PipelineType[] | null
@@ -700,6 +709,9 @@ export function ModelsPage() {
setSortBrowseActive(false);
// The filters control is Discover-only, so a hidden filter must not reapply on return.
setSearchFilters({});
+ setDatasetModalities([]);
+ setUploaderPick(null);
+ setFirstPickArmed(true);
setModelsTab(next);
},
[setModelsTab],
@@ -710,8 +722,11 @@ export function ModelsPage() {
if (next === resourceType) return;
setResourceType(next);
setDownloadedFormat("all");
- setCapabilityFilter("all");
+ setCapabilityFilters([]);
+ setDatasetModalities([]);
setSearchFilters({});
+ setUploaderPick(null);
+ setFirstPickArmed(true);
setSortBrowseActive(false);
if (next === "models") {
const preset = findChannel(DEFAULT_DISCOVER_CHANNEL);
@@ -742,8 +757,11 @@ export function ModelsPage() {
setSortBy(preset.sort);
setDirection("desc");
}
- setCapabilityFilter("all");
+ setCapabilityFilters([]);
+ setDatasetModalities([]);
setSearchFilters({});
+ setUploaderPick(null);
+ setFirstPickArmed(true);
setSortBrowseActive(false);
// Clear search: an active query outranks the section in `mode`, hiding the curated list.
setQuery("");
@@ -759,8 +777,11 @@ export function ModelsPage() {
setDiscoverFormat(preset?.format ?? "recommended");
setSortBy(preset?.sort ?? "trendingScore");
setDirection("desc");
- setCapabilityFilter("all");
+ setCapabilityFilters([]);
+ setDatasetModalities([]);
setSearchFilters({});
+ setUploaderPick(null);
+ setFirstPickArmed(true);
setSortBrowseActive(false);
void navigate({
to: "/hub",
@@ -772,8 +793,11 @@ export function ModelsPage() {
setModelsTab("discover");
setResourceType("models");
setQuery("");
- setCapabilityFilter("all");
+ setCapabilityFilters([]);
+ setDatasetModalities([]);
setSearchFilters({});
+ setUploaderPick(null);
+ setFirstPickArmed(true);
setDownloadedFormat("all");
setDiscoverFormat(preset?.format ?? "recommended");
setSortBy(preset?.sort ?? "trendingScore");
@@ -801,7 +825,7 @@ export function ModelsPage() {
setResourceType("models");
setQuery("");
setDiscoverFormat("all");
- setCapabilityFilter(urlCapability);
+ setCapabilityFilters([urlCapability]);
setLinkedAudioTask(
urlCapability === "audio" && urlTaskKey
? (urlTaskKey.split("|") as PipelineType[])
@@ -809,7 +833,8 @@ export function ModelsPage() {
);
setSortBrowseActive(true);
// The media pages run curated Unsloth uploads, so start there.
- setOwnerScope("unsloth");
+ setUploaderPick([...UNSLOTH_UPLOADER]);
+ setFirstPickArmed(false);
void navigate({
to: "/hub",
// Discover models, whatever tab or kind the link carried.
@@ -824,9 +849,9 @@ export function ModelsPage() {
}),
replace: true,
});
- }, [urlCapability, urlTaskKey, navigate, setOwnerScope]);
+ }, [urlCapability, urlTaskKey, navigate]);
// Picking another filter drops the link's tasks, so returning to Audio shows every audio model.
- if (capabilityFilter !== "audio" && linkedAudioTask !== null) {
+ if (!capabilityFilters.includes("audio") && linkedAudioTask !== null) {
setLinkedAudioTask(null);
}
@@ -848,6 +873,21 @@ export function ModelsPage() {
const debouncedQuery = useDebouncedValue(query);
const deferredDebouncedQuery = useDeferredValue(debouncedQuery);
+ const uploaders =
+ uploaderPick ?? (debouncedQuery.trim() ? HUB_UPLOADERS : UNSLOTH_UPLOADER);
+ const ownerScope =
+ uploaders.length === 1 && uploaders[0] === "unsloth" ? "unsloth" : "all";
+ // The publisher and config.json lookups are Hugging Face endpoints.
+ const searchFilters = useMemo(
+ () =>
+ hubSource === "modelscope"
+ ? NO_SEARCH_FILTERS
+ : ownerScope === "all" && uploaders.length < HUB_UPLOADERS.length
+ ? { ...storedSearchFilters, uploaders: [...uploaders] }
+ : storedSearchFilters,
+ [hubSource, ownerScope, uploaders, storedSearchFilters],
+ );
+ const hasSearchFilters = hasModelSearchFilters(searchFilters);
const hfToken = useHfTokenStore((s) => s.token);
const debouncedHfToken = useDebouncedValue(hfToken, 500);
const apiHfToken = hfApiToken(debouncedHfToken);
@@ -857,7 +897,7 @@ export function ModelsPage() {
[hubHfEndpoint, apiHfToken],
);
const deferredFormatFilter = useDeferredValue(formatFilter);
- const deferredCapabilityFilter = useDeferredValue(capabilityFilter);
+ const deferredCapabilityFilters = useDeferredValue(capabilityFilters);
const hasQuery = deferredDebouncedQuery.trim() !== "";
const mode: DiscoverMode = isModelDiscover
@@ -865,7 +905,7 @@ export function ModelsPage() {
? "search"
: urlSection != null
? "channel-list"
- : sortBrowseActive || hasSearchFilters
+ : sortBrowseActive || hasSearchFilters || uploaderPick !== null
? "search"
: "feed"
: "search";
@@ -940,7 +980,10 @@ export function ModelsPage() {
ownerScope,
filters: searchFilters,
task:
- capabilityFilter === "audio" ? (linkedAudioTask ?? undefined) : undefined,
+ // Asked of the Hub only when Audio is the one filter: with others it would drop their models.
+ capabilityFilters.length === 1 && capabilityFilters[0] === "audio"
+ ? (linkedAudioTask ?? undefined)
+ : undefined,
});
const cachedListEntry = useHubFeedStore((state) =>
@@ -1007,44 +1050,59 @@ export function ModelsPage() {
[visibleResults, modelDiscoveryInventorySignature],
);
+ const deferredDatasetModalities = useDeferredValue(datasetModalities);
+ const { minRows, maxRows } = storedSearchFilters;
const datasetDiscoverRows = useMemo<DiscoverRow[]>(() => {
if (!isDatasetMode) return [];
- return datasetResults.map((ds) => {
- const owner = ds.id.includes("/") ? ds.id.split("/")[0] : "Hub";
- const repo = ds.id.includes("/")
- ? ds.id.split("/").slice(1).join("/")
- : ds.id;
- const summaryParts: string[] = [];
- if (ds.taskCategories.length > 0)
- summaryParts.push(ds.taskCategories.slice(0, 2).join(", "));
- if (ds.totalExamples)
- summaryParts.push(`${ds.totalExamples.toLocaleString()} rows`);
- else if (ds.sizeCategory) summaryParts.push(ds.sizeCategory);
- const lower = ds.id.toLowerCase();
- return {
- id: ds.id,
- owner,
- repo,
- result: {
+ return datasetResults
+ .filter((ds) =>
+ matchesDatasetFilters(ds, deferredDatasetModalities, minRows, maxRows),
+ )
+ .map((ds) => {
+ const owner = ds.id.includes("/") ? ds.id.split("/")[0] : "Hub";
+ const repo = ds.id.includes("/")
+ ? ds.id.split("/").slice(1).join("/")
+ : ds.id;
+ const summaryParts: string[] = [];
+ if (ds.taskCategories.length > 0)
+ summaryParts.push(ds.taskCategories.slice(0, 2).join(", "));
+ if (ds.totalExamples)
+ summaryParts.push(`${ds.totalExamples.toLocaleString()} rows`);
+ else if (ds.sizeCategory) summaryParts.push(ds.sizeCategory);
+ const lower = ds.id.toLowerCase();
+ return {
id: ds.id,
- downloads: ds.downloads,
- likes: ds.likes,
- private: ds.private,
- gated: ds.gated,
- updatedAt: ds.updatedAt,
- createdAt: ds.createdAt,
- downloadsAllTime: ds.downloadsAllTime,
- isGguf: false,
- tags: ds.plainTags,
- },
- isAvailableOnDevice: availableSet.has(lower),
- isPartialOnDevice: partialSet.has(lower),
- isDownloadingOnDevice: partialSet.has(lower) && downloadingSet.has(lower),
- summary: summaryParts.join(" · ") || ds.prettyName || "Dataset",
- capabilities: [],
- };
- });
- }, [isDatasetMode, datasetResults, availableSet, partialSet, downloadingSet]);
+ owner,
+ repo,
+ result: {
+ id: ds.id,
+ downloads: ds.downloads,
+ likes: ds.likes,
+ private: ds.private,
+ gated: ds.gated,
+ updatedAt: ds.updatedAt,
+ createdAt: ds.createdAt,
+ downloadsAllTime: ds.downloadsAllTime,
+ isGguf: false,
+ tags: ds.plainTags,
+ },
+ isAvailableOnDevice: availableSet.has(lower),
+ isPartialOnDevice: partialSet.has(lower),
+ isDownloadingOnDevice: partialSet.has(lower) && downloadingSet.has(lower),
+ summary: summaryParts.join(" · ") || ds.prettyName || "Dataset",
+ capabilities: [],
+ };
+ });
+ }, [
+ isDatasetMode,
+ datasetResults,
+ deferredDatasetModalities,
+ minRows,
+ maxRows,
+ availableSet,
+ partialSet,
+ downloadingSet,
+ ]);
const discoverRows = isDatasetMode ? datasetDiscoverRows : modelDiscoverRows;
@@ -1071,9 +1129,13 @@ export function ModelsPage() {
detectResultFormat(row.result),
effectiveDiscoverFormat,
)) &&
- matchesCapability(row.capabilities, deferredCapabilityFilter) &&
- (deferredCapabilityFilter !== "audio" ||
- matchesHubAudioTask(row.result.pipelineTag, linkedAudioTask)) &&
+ (deferredCapabilityFilters.length === 0 ||
+ deferredCapabilityFilters.some(
+ (key) =>
+ matchesHubCapability(row, key) &&
+ (key !== "audio" ||
+ matchesHubAudioTask(row.result.pipelineTag, linkedAudioTask)),
+ )) &&
(!activeChannel?.finetunableOnly || isUnslothFinetunable(row.result)) &&
// Models already on disk stay visible regardless of device fit, matching the chat selector.
(!fitOnDeviceOnly ||
@@ -1089,7 +1151,7 @@ export function ModelsPage() {
effectiveDiscoverFormat,
checkpointQuantFormats,
diffusionQuantFormats,
- deferredCapabilityFilter,
+ deferredCapabilityFilters,
linkedAudioTask,
activeChannel,
fitOnDeviceOnly,
@@ -1258,8 +1320,12 @@ export function ModelsPage() {
deferredDebouncedQuery,
resourceType,
deferredFormatFilter,
- deferredCapabilityFilter,
+ deferredCapabilityFilters,
+ deferredDatasetModalities,
searchFilters,
+ // ModelScope drops searchFilters, but the dataset rows are filtered here either way.
+ minRows,
+ maxRows,
inventoryTypeFilter,
effectiveSort,
effectiveDirection,
@@ -1270,8 +1336,11 @@ export function ModelsPage() {
deferredDebouncedQuery,
resourceType,
deferredFormatFilter,
- deferredCapabilityFilter,
+ deferredCapabilityFilters,
+ deferredDatasetModalities,
searchFilters,
+ minRows,
+ maxRows,
inventoryTypeFilter,
effectiveSort,
effectiveDirection,
@@ -1293,9 +1362,19 @@ export function ModelsPage() {
setDownloadedFormat("all");
setInventoryTypeFilter("all");
}
- setCapabilityFilter("all");
+ setCapabilityFilters([]);
+ setDatasetModalities([]);
setSearchFilters({});
+ setUploaderPick(null);
+ setFirstPickArmed(true);
}, [isDiscoverTab, urlSection, navigate]);
+ const handleResetPopoverFilters = useCallback(() => {
+ setCapabilityFilters([]);
+ setDatasetModalities([]);
+ setSearchFilters({});
+ setUploaderPick(null);
+ setFirstPickArmed(true);
+ }, []);
const handleDiscoverFetchIntent = useCallback(() => {
setDiscoverFetchIntent((value) => value + 1);
}, []);
@@ -1381,8 +1460,11 @@ export function ModelsPage() {
setDiscoverFormat(preset?.format ?? "recommended");
setSortBy(preset?.sort ?? "trendingScore");
setDirection("desc");
- setCapabilityFilter("all");
+ setCapabilityFilters([]);
+ setDatasetModalities([]);
setSearchFilters({});
+ setUploaderPick(null);
+ setFirstPickArmed(true);
setSortBrowseActive(false);
setQuery("");
void navigate({
@@ -1400,14 +1482,20 @@ export function ModelsPage() {
(next: string) => {
if (next.trim() === "") {
const preset = findChannel(DEFAULT_DISCOVER_CHANNEL);
- setCapabilityFilter("all");
+ setCapabilityFilters([]);
+ setDatasetModalities([]);
setSearchFilters({});
+ setUploaderPick(null);
+ setFirstPickArmed(true);
setSortBrowseActive(false);
if (preset) {
setDiscoverFormat(preset.format);
setSortBy(preset.sort);
setDirection("desc");
}
+ } else if (query.trim() === "") {
+ // A new search starts on every uploader (Unsloth's still listed first), whatever was picked.
+ setUploaderPick(null);
}
if (urlModel || urlSection) {
void navigate({
@@ -1422,7 +1510,7 @@ export function ModelsPage() {
}
setQuery(next);
},
- [urlSection, urlModel, navigate],
+ [query, urlSection, urlModel, navigate],
);
useEffect(() => {
@@ -1509,8 +1597,11 @@ export function ModelsPage() {
setDiscoverFormat(preset.format);
setSortBy(preset.sort);
setDirection("desc");
- setCapabilityFilter("all");
+ setCapabilityFilters([]);
+ setDatasetModalities([]);
setSearchFilters({});
+ setUploaderPick(null);
+ setFirstPickArmed(true);
}, [isModelDiscover, sectionChannelId, urlCapability]);
const handleManageLocalFolders = useCallback(
() => setFoldersDialogOpen(true),
@@ -1569,11 +1660,13 @@ export function ModelsPage() {
setModelsTab("discover");
setResourceType("models");
setDiscoverFormat("all");
- setCapabilityFilter("all");
+ setCapabilityFilters([]);
+ setDatasetModalities([]);
setSearchFilters({});
setSortBrowseActive(false);
// Base models come from other publishers, so search the whole Hub.
- setOwnerScope("all");
+ setUploaderPick(null);
+ setFirstPickArmed(true);
setQuery(trimmed);
void navigate({
to: "/hub",
@@ -1586,7 +1679,7 @@ export function ModelsPage() {
}),
});
},
- [navigate, setModelsTab, setOwnerScope],
+ [navigate, setModelsTab],
);
// A new chat opens with the model's run settings, where Load starts it.
const openRunSettingsInChat = useCallback(
@@ -1777,8 +1870,17 @@ export function ModelsPage() {
hasActiveFilters:
!isFeedMode &&
((isModelDiscover && hasSearchFilters) ||
+ // A search lists every uploader, so picking Unsloth narrows it.
+ (isModelDiscover &&
+ uploaderPick !== null &&
+ ownerScope === "unsloth" &&
+ debouncedQuery.trim() !== "") ||
deferredFormatFilter !== "all" ||
- deferredCapabilityFilter !== "all" ||
+ deferredCapabilityFilters.length > 0 ||
+ (isDatasetMode &&
+ (deferredDatasetModalities.length > 0 ||
+ minRows !== undefined ||
+ maxRows !== undefined)) ||
(tab === "downloaded" && typeFilterActive)),
typeFilterActive,
// A single format filter makes every row's format dot the same; Recommended mixes GGUF and checkpoints.
@@ -1810,8 +1912,14 @@ export function ModelsPage() {
discoverFetchIntent,
discoverManualFetchAvailable,
deferredFormatFilter,
- deferredCapabilityFilter,
+ deferredCapabilityFilters,
+ deferredDatasetModalities,
+ minRows,
+ maxRows,
hasSearchFilters,
+ uploaderPick,
+ ownerScope,
+ debouncedQuery,
inventoryTypeFilter,
],
);
@@ -1888,9 +1996,6 @@ export function ModelsPage() {
</div>
);
}
- const ownerToggle = isDatasetMode ? undefined : (
- <OwnerScopeToggle value={ownerScope} onChange={setOwnerScope} />
- );
// Compact pill so it stays beside the view-mode tabs even in the narrow split pane.
return (
<div className="flex flex-col gap-3 pt-6">
@@ -1903,7 +2008,6 @@ export function ModelsPage() {
view={allModelsView}
onViewChange={setAllModelsView}
onBack={handleBackToFeed}
- actions={ownerToggle}
/>
) : (
<HubListHeader
@@ -1911,7 +2015,6 @@ export function ModelsPage() {
view={allModelsView}
onViewChange={setAllModelsView}
onBack={isSortBrowseMode ? handleBackToFeed : undefined}
- actions={ownerToggle}
/>
)}
</div>
@@ -1927,8 +2030,6 @@ export function ModelsPage() {
listCount,
allModelsView,
setAllModelsView,
- ownerScope,
- setOwnerScope,
isDatasetMode,
feedTrendingRows,
hubFeed.trending.isLoading,
@@ -2010,10 +2111,17 @@ export function ModelsPage() {
onResourceTypeChange={handleResourceTypeChange}
formatFilter={formatFilter}
onFormatFilterChange={setFormatFilter}
- searchFilters={searchFilters}
- onSearchFiltersChange={setSearchFilters}
- capabilityFilter={capabilityFilter}
- onCapabilityFilterChange={setCapabilityFilter}
+ searchFilters={storedSearchFilters}
+ onSearchFiltersChange={handlePopoverSearchFiltersChange}
+ uploaders={uploaders}
+ uploadersChanged={uploaderPick !== null}
+ onUploadersChange={handlePopoverUploadersChange}
+ onResetFilters={handleResetPopoverFilters}
+ capabilityFilters={capabilityFilters}
+ onCapabilityFiltersChange={handlePopoverCapabilitiesChange}
+ isolateFirstCapability={firstPickArmed}
+ datasetModalities={datasetModalities}
+ onDatasetModalitiesChange={handlePopoverModalitiesChange}
fitOnDeviceOnly={fitOnDeviceOnly}
onFitOnDeviceOnlyChange={setFitOnDeviceOnly}
onManageLocalFolders={handleManageLocalFolders}
diff --git a/studio/frontend/src/features/hub/hub.css b/studio/frontend/src/features/hub/hub.css
index c34497afe94..c1a08905d06 100644
--- a/studio/frontend/src/features/hub/hub.css
+++ b/studio/frontend/src/features/hub/hub.css
@@ -719,6 +719,26 @@
background-color: color-mix(in srgb, var(--accent) 60%, var(--popover)) !important;
}
+ /* The composer + menu's shape: 12px rows on a 9px gutter keep the 21px corners concentric. */
+ .hub-composer-menu[data-slot] {
+ border-radius: 21px !important;
+ padding: calc(0.5rem * var(--ui-space-scale, 1)) calc(9px * var(--ui-space-scale, 1)) !important;
+ }
+ html.dark .hub-composer-menu {
+ background-color: var(--card) !important;
+ }
+ .hub-composer-menu .hub-menu-row {
+ margin-block: 2px;
+ border-radius: 12px;
+ }
+ .hub-composer-menu .hub-menu-row:is(:hover, [data-highlighted]) {
+ background-color: rgb(0 0 0 / calc(0.06 * var(--contrast-wash-gain, 1)));
+ color: inherit;
+ }
+ html.dark .hub-composer-menu .hub-menu-row:is(:hover, [data-highlighted]) {
+ background-color: rgb(255 255 255 / calc(0.1 * var(--contrast-wash-gain, 1)));
+ }
+
.hub-menu-instant *,
.hub-menu-instant *::before,
.hub-menu-instant *::after,
@@ -815,6 +835,35 @@
background-color: var(--accent);
}
+ /* The picker's panel is --sidebar, a step from --accent: its controls lift toward white to stand off it. */
+ html.dark .unsloth-model-selector-menu {
+ --picker-control-lit: color-mix(in srgb, var(--accent), white 7.5%);
+ }
+ html.dark .unsloth-model-selector-menu .hub-tab-toggle-pill,
+ html.dark .unsloth-model-selector-menu .hub-tab-toggle-pill:hover,
+ html.dark .unsloth-model-selector-menu .hub-tab-toggle-pill.hub-pill-action:active {
+ background-color: var(--picker-control-lit);
+ color: #fff;
+ }
+ html.dark .unsloth-model-selector-menu .hub-tab-toggle-pill.hub-pill-action:hover {
+ background-color: color-mix(in srgb, var(--accent), white 12.5%);
+ }
+ html.dark .unsloth-model-selector-menu .field-soft {
+ background-color: color-mix(in srgb, var(--accent), white 3.5%) !important;
+ color: #fff;
+ }
+ html.dark .unsloth-model-selector-menu .field-soft:is(:hover, :active, :focus-visible) {
+ background-color: var(--picker-control-lit) !important;
+ }
+ /* Open, the trigger keeps the menu's tone so the two read as one piece. */
+ html.dark .unsloth-model-selector-menu .field-soft:is([data-state="open"], [aria-expanded="true"]):not(:hover) {
+ background-color: color-mix(in srgb, var(--accent), white 3.5%) !important;
+ }
+ /* These menus portal to body, so their own class keeps them at the picker's lift. */
+ html.dark .hub-menu-instant.picker-option-menu {
+ background-color: color-mix(in srgb, var(--accent), white 3.5%) !important;
+ }
+
html:not(.dark) .hub-page .catalog-row {
background-color: transparent;
border-color: transparent;
diff --git a/studio/frontend/src/features/hub/index.ts b/studio/frontend/src/features/hub/index.ts
index ee20438f27e..68f0f9aa4d7 100644
--- a/studio/frontend/src/features/hub/index.ts
+++ b/studio/frontend/src/features/hub/index.ts
@@ -30,6 +30,10 @@ export {
} from "./hooks/use-hub-model-search";
export { useHubInfiniteScroll } from "./hooks/use-hub-infinite-scroll";
export type { CapabilityKey } from "./lib/model-capabilities";
+export {
+ HUB_CAPABILITY_FILTERS,
+ type HubCapabilityFilter,
+} from "./lib/model-capabilities";
export { useLatestRef } from "./hooks/use-latest-ref";
export { useHubAvailability, useOnlineStatus } from "./hooks/use-online-status";
export { isHuggingFaceOffline } from "./lib/network";
diff --git a/studio/frontend/src/features/hub/lib/dataset-filters.ts b/studio/frontend/src/features/hub/lib/dataset-filters.ts
new file mode 100644
index 00000000000..9117f1a76d4
--- /dev/null
+++ b/studio/frontend/src/features/hub/lib/dataset-filters.ts
@@ -0,0 +1,90 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+/** The Hub's dataset modalities, as its `modality:` tags spell them. */
+export const DATASET_MODALITIES = [
+ "3d",
+ "audio",
+ "document",
+ "geospatial",
+ "image",
+ "tabular",
+ "text",
+ "timeseries",
+ "video",
+] as const;
+export type DatasetModality = (typeof DATASET_MODALITIES)[number];
+
+// The Hub's size_categories buckets, smallest first: bucket i lies between stop i - 1 and stop i.
+const SIZE_BUCKETS = [
+ "n<1k",
+ "1k<n<10k",
+ "10k<n<100k",
+ "100k<n<1m",
+ "1m<n<10m",
+ "10m<n<100m",
+ "100m<n<1b",
+ "1b<n<10b",
+ "10b<n<100b",
+ "100b<n<1t",
+ "n>1t",
+];
+export const DATASET_ROW_STOPS = [
+ 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12,
+] as const;
+
+export function datasetModalities(tags: readonly string[]): string[] {
+ return tags
+ .filter((tag) => tag.startsWith("modality:"))
+ .map((tag) => tag.slice("modality:".length).toLowerCase());
+}
+
+export function datasetSizeBucket(tags: readonly string[]): number | undefined {
+ for (const tag of tags) {
+ if (tag.startsWith("size_categories:")) {
+ const index = SIZE_BUCKETS.indexOf(
+ tag.slice("size_categories:".length).toLowerCase(),
+ );
+ if (index >= 0) {
+ return index;
+ }
+ }
+ }
+ return undefined;
+}
+
+/** A dataset with any picked modality (none picked: all) whose size bucket meets the row range.
+ * Datasets that don't publish what a filter asks for are left out of it. */
+export function matchesDatasetFilters(
+ dataset: { modalities: readonly string[]; sizeBucket?: number },
+ modalities: readonly string[],
+ minRows: number | undefined,
+ maxRows: number | undefined,
+): boolean {
+ if (
+ modalities.length > 0 &&
+ !dataset.modalities.some((modality) => modalities.includes(modality))
+ ) {
+ return false;
+ }
+ if (minRows === undefined && maxRows === undefined) {
+ return true;
+ }
+ const bucket = dataset.sizeBucket;
+ if (bucket === undefined) {
+ return false;
+ }
+ const low = bucket === 0 ? 0 : DATASET_ROW_STOPS[bucket - 1];
+ const high =
+ bucket === DATASET_ROW_STOPS.length
+ ? Number.POSITIVE_INFINITY
+ : DATASET_ROW_STOPS[bucket];
+ // Both thumbs on one stop: the buckets either side of it.
+ if (minRows !== undefined && minRows === maxRows) {
+ return low <= minRows && high >= minRows;
+ }
+ return (
+ (minRows === undefined || high > minRows) &&
+ (maxRows === undefined || low < maxRows)
+ );
+}
diff --git a/studio/frontend/src/features/hub/lib/model-capabilities.ts b/studio/frontend/src/features/hub/lib/model-capabilities.ts
index 7f9f6a19d53..3003738c4ad 100644
--- a/studio/frontend/src/features/hub/lib/model-capabilities.ts
+++ b/studio/frontend/src/features/hub/lib/model-capabilities.ts
@@ -19,6 +19,77 @@ export interface Capability {
label: string;
}
+/** What the Hub's filter picks from. Image and video generation share the "diffusion" capability
+ * everywhere else (loading, the Images and Video pages) but are different models to look for. */
+export type HubCapabilityFilter =
+ | "text"
+ | "reasoning"
+ | "vision"
+ | "audio"
+ | "embedding"
+ | "image-gen"
+ | "video-gen";
+
+export const HUB_CAPABILITY_FILTERS: readonly HubCapabilityFilter[] = [
+ "text",
+ "reasoning",
+ "vision",
+ "audio",
+ "embedding",
+ "image-gen",
+ "video-gen",
+];
+
+const VIDEO_GEN_TAGS = new Set([
+ "text-to-video",
+ "image-to-video",
+ "image-text-to-video",
+]);
+const VIDEO_GEN_ID_RE =
+ /(?:^|[-_.])wan2|hunyuan[-_]?video|\bltx(?:[-_]?video|v|[-_]?\d)|minimax[-_]?h\d|cogvideo|mochi|skyreels|[-_]t2v\b|[-_]i2v\b/;
+
+const NEITHER_GEN_TASKS = new Set([
+ "video-to-video",
+ "text-to-audio",
+ "audio-to-audio",
+ "text-to-speech",
+ "text-to-3d",
+ "image-to-3d",
+]);
+
+/** A video family in the repo name (not the owner), e.g. LTX-2.3 or Wan2.2. */
+export function isVideoFamilyName(modelId: string): boolean {
+ return VIDEO_GEN_ID_RE.test(modelId.toLowerCase().split("/").pop() ?? "");
+}
+
+/** Which generation an image/video model does, from its tags and name. A video signal wins: several
+ * video repos carry an image tag for their first-frame path, and the picker reads them the same
+ * way. Anything else is taken for an image model, as most are. */
+export function generationKinds(
+ tags: string[] | undefined,
+ pipelineTag: string | undefined,
+ modelId: string,
+): { image: boolean; video: boolean } {
+ const tagSet = lower(tags);
+ const pipeline = pipelineTag?.toLowerCase();
+ // The repo name only: "hunyuanvideo-community/HunyuanImage-2.1" is an image model.
+ const repo = modelId.toLowerCase().split("/").pop() ?? "";
+ // Neither: the Video page takes a prompt and reference images, never a video, and the audio
+ // tasks belong to the Audio pages.
+ if (
+ pipeline !== undefined
+ ? NEITHER_GEN_TASKS.has(pipeline)
+ : [...NEITHER_GEN_TASKS].some((task) => tagSet.has(task))
+ ) {
+ return { image: false, video: false };
+ }
+ const video =
+ [...VIDEO_GEN_TAGS].some((tag) => tagSet.has(tag)) ||
+ (pipeline !== undefined && VIDEO_GEN_TAGS.has(pipeline)) ||
+ VIDEO_GEN_ID_RE.test(repo);
+ return { image: !video, video };
+}
+
const VISION_TAGS = new Set([
"vision",
"vision-language",
@@ -37,6 +108,8 @@ const VISION_TAGS = new Set([
const AUDIO_TAGS = new Set([
"audio",
"audio-text-to-text",
+ "text-to-audio",
+ "audio-to-audio",
"automatic-speech-recognition",
"text-to-speech",
"audio-classification",
@@ -63,7 +136,7 @@ const REASONING_TAGS = new Set([
"step-by-step",
]);
-// Image generation / diffusion (surfaced as "Image/video gen" in filters).
+// Image and video generation (one "diffusion" capability; the Hub filter splits it, generationKinds).
const DIFFUSION_TAGS = new Set([
"diffusers",
"diffusion",
@@ -74,6 +147,8 @@ const DIFFUSION_TAGS = new Set([
"image-to-image",
"text-to-video",
"image-to-video",
+ "image-text-to-video",
+ "image-text-to-image",
"unconditional-image-generation",
]);
@@ -227,7 +302,7 @@ export function detectCapabilities(
out.push({ key: "embedding", label: "Embeddings" });
}
const imageGenName =
- /stable[-_]?diffusion|\bsdxl\b|\bflux\b|qwen[-_]?image|hunyuan[-_]?(?:video|image)|wan2|latent[-_]?consistency|[-_]lcm\b|dreamshaper/.test(
+ /stable[-_]?diffusion|\bsdxl\b|\bflux\b|qwen[-_]?image|hunyuan[-_]?(?:video|image)|(?:^|[-_/.])wan2|latent[-_]?consistency|[-_]lcm\b|dreamshaper/.test(
lowerId,
);
const textDiffusionLm =
@@ -238,8 +313,13 @@ export function detectCapabilities(
(tag) => tag !== "diffusion" && (tagSet.has(tag) || pipeline === tag),
)
: hasAny(DIFFUSION_TAGS);
- if (imageGenTagged || imageGenName) {
- out.push({ key: "diffusion", label: "Image/video gen" });
+ const kinds = generationKinds(tags, pipelineTag, modelId);
+ // A Diffusers audio or video-to-video pipeline makes neither, so it gets no generation pill.
+ if ((imageGenTagged || imageGenName) && (kinds.image || kinds.video)) {
+ out.push({
+ key: "diffusion",
+ label: kinds.video ? "Video gen" : "Image gen",
+ });
}
const languageCodes = new Set<string>();
for (const tag of tags ?? []) {
diff --git a/studio/frontend/src/features/hub/lib/model-search-filters.ts b/studio/frontend/src/features/hub/lib/model-search-filters.ts
index d278ec2108d..ed1f89e0b53 100644
--- a/studio/frontend/src/features/hub/lib/model-search-filters.ts
+++ b/studio/frontend/src/features/hub/lib/model-search-filters.ts
@@ -1,12 +1,25 @@
// SPDX-License-Identifier: AGPL-3.0-only
// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+/** Who uploaded a model: the unsloth org, any other organization, or a personal account. */
+export type HubUploader = "unsloth" | "organization" | "personal";
+
+export const HUB_UPLOADERS: readonly HubUploader[] = [
+ "unsloth",
+ "organization",
+ "personal",
+];
+
export interface ModelSearchFilters {
minParams?: number;
maxParams?: number;
minContext?: number;
maxContext?: number;
- organizationsOnly?: boolean;
+ /** Absent lists every uploader. */
+ uploaders?: HubUploader[];
+ /** Dataset rows; the dataset list filters on these, the model search ignores them. */
+ minRows?: number;
+ maxRows?: number;
}
export function hasModelSearchFilters(filters: ModelSearchFilters): boolean {
@@ -109,17 +122,23 @@ export async function* filterModelListing(
) {
return null;
}
- if (filters.organizationsOnly) {
- // isVerified would drop unverified labs such as Qwen; personal accounts 404 here.
+ const uploaders = filters.uploaders;
+ if (uploaders && uploaders.length < HUB_UPLOADERS.length) {
const owner = model.name.split("/")[0];
- let isOrganization = owners.get(owner);
- if (!isOrganization) {
- isOrganization = fetchJson(
- `/api/organizations/${encodeURIComponent(owner)}/overview`,
- ).then((data) => data !== null);
- owners.set(owner, isOrganization);
- }
- if (!(await isOrganization)) {
+ const wantsOrganization = uploaders.includes("organization");
+ if (owner.toLowerCase() === "unsloth") {
+ if (!uploaders.includes("unsloth")) return null;
+ } else if (wantsOrganization !== uploaders.includes("personal")) {
+ // isVerified would drop unverified labs such as Qwen; personal accounts 404 here.
+ let isOrganization = owners.get(owner);
+ if (!isOrganization) {
+ isOrganization = fetchJson(
+ `/api/organizations/${encodeURIComponent(owner)}/overview`,
+ ).then((data) => data !== null);
+ owners.set(owner, isOrganization);
+ }
+ if ((await isOrganization) !== wantsOrganization) return null;
+ } else if (!wantsOrganization) {
return null;
}
}
diff --git a/studio/frontend/src/features/hub/lib/view-models.ts b/studio/frontend/src/features/hub/lib/view-models.ts
index 8a9d83e19ce..df4843e160d 100644
--- a/studio/frontend/src/features/hub/lib/view-models.ts
+++ b/studio/frontend/src/features/hub/lib/view-models.ts
@@ -18,6 +18,10 @@ import {
type CapabilityKey,
detectBaseModel,
detectCapabilities,
+ generationKinds,
+ isVideoFamilyName,
+ HUB_CAPABILITY_FILTERS,
+ type HubCapabilityFilter,
} from "./model-capabilities";
export {
detectResultFormat,
@@ -32,15 +36,17 @@ export {
export { isGgufLike } from "./hf-model-meta";
export const CAPABILITY_FILTER_OPTIONS: ReadonlyArray<{
- value: CapabilityFilter;
+ value: HubCapabilityFilter;
label: string;
}> = [
- { value: "all", label: "All capabilities" },
+ // Models with none of the others, so ticking every box lists every model.
+ { value: "text", label: "Text only" },
{ value: "reasoning", label: "Reasoning" },
{ value: "vision", label: "Vision" },
{ value: "audio", label: "Audio" },
{ value: "embedding", label: "Embeddings" },
- { value: "diffusion", label: "Image/video gen" },
+ { value: "image-gen", label: "Image gen" },
+ { value: "video-gen", label: "Video gen" },
];
export const FORMAT_FILTER_OPTIONS: ReadonlyArray<{
@@ -267,6 +273,63 @@ export function buildDiscoverRows(
});
}
+// Pipelines that make pictures, video or sound, which Text only must never list.
+const MEDIA_OUTPUT_TASKS: ReadonlySet<string> = new Set([
+ "text-to-image",
+ "image-to-image",
+ "image-text-to-image",
+ "unconditional-image-generation",
+ "text-to-video",
+ "image-to-video",
+ "image-text-to-video",
+ "video-to-video",
+ "text-to-speech",
+ "text-to-audio",
+ "audio-to-audio",
+ "text-to-3d",
+ "image-to-3d",
+]);
+
+/** One Hub filter pick against a row; image and video gen split the shared "diffusion" capability. */
+export function matchesHubCapability(
+ row: {
+ capabilities: Array<{ key: CapabilityKey }>;
+ result: Pick<HfModelResult, "tags" | "pipelineTag" | "id">;
+ },
+ key: HubCapabilityFilter,
+): boolean {
+ if (key === "text") {
+ return (
+ !HUB_CAPABILITY_FILTERS.some(
+ (other) => other !== "text" && matchesHubCapability(row, other),
+ ) &&
+ // A generator neither box claims (video-to-video), or a media task the detector misses.
+ !matchesCapability(row.capabilities, "diffusion") &&
+ !MEDIA_OUTPUT_TASKS.has(row.result.pipelineTag?.toLowerCase() ?? "") &&
+ !(row.result.tags ?? []).some((tag) =>
+ MEDIA_OUTPUT_TASKS.has(tag.toLowerCase()),
+ )
+ );
+ }
+ if (key !== "image-gen" && key !== "video-gen")
+ return matchesCapability(row.capabilities, key);
+ // A video family is video gen from its name alone: LTX GGUFs carry no pipeline tag.
+ // Still through generationKinds, so a video-to-video family repo stays out.
+ if (key === "video-gen" && isVideoFamilyName(row.result.id))
+ return generationKinds(
+ row.result.tags,
+ row.result.pipelineTag,
+ row.result.id,
+ ).video;
+ if (!matchesCapability(row.capabilities, "diffusion")) return false;
+ const kinds = generationKinds(
+ row.result.tags,
+ row.result.pipelineTag,
+ row.result.id,
+ );
+ return key === "image-gen" ? kinds.image : kinds.video;
+}
+
export function matchesCapability(
capabilities: Array<{ key: CapabilityKey }>,
capabilityFilter: CapabilityFilter,
diff --git a/studio/frontend/src/features/images/images-page.tsx b/studio/frontend/src/features/images/images-page.tsx
index 3eace9bb9ec..a5fd76f58aa 100644
--- a/studio/frontend/src/features/images/images-page.tsx
+++ b/studio/frontend/src/features/images/images-page.tsx
@@ -5067,7 +5067,7 @@ export function ImagesPage({
task={IMAGE_GEN_TASKS}
catalog={IMAGE_CATALOG}
opaqueKind={opaqueKind}
- hubCapability="diffusion"
+ hubCapability="image-gen"
placeholder="Select image model"
open={active && selectorOpen}
onOpenChange={(o) => setSelectorOpen(active && o)}
diff --git a/studio/frontend/src/features/model-picker/components/model-selector.tsx b/studio/frontend/src/features/model-picker/components/model-selector.tsx
index f9a4107cd91..8b4acbee377 100644
--- a/studio/frontend/src/features/model-picker/components/model-selector.tsx
+++ b/studio/frontend/src/features/model-picker/components/model-selector.tsx
@@ -11,7 +11,7 @@ import {
import { TooltipProvider } from "@/components/ui/tooltip";
import { ApiProviderLogo } from "@/features/chat/api-provider-logo";
-import type { CapabilityKey } from "@/features/hub";
+import type { HubCapabilityFilter } from "@/features/hub";
import type { HfTaskFilter } from "@/features/hub/hooks/use-hub-model-search";
// eslint-disable-next-line no-restricted-imports -- The settings barrel imports this feature back.
import { useSettingsDialogStore } from "@/features/settings/stores/settings-dialog-store";
@@ -149,7 +149,7 @@ interface ModelSelectorProps {
opaqueKind?: "diffusers_pipeline" | "diffusers_modular_pipeline";
rowFilter?: ModelPickerRowFilter;
/** Hub filter the Search Hub button opens with. Also shows Search Hub on curated task pickers. */
- hubCapability?: CapabilityKey;
+ hubCapability?: HubCapabilityFilter;
/** Tasks the Search Hub link narrows the Audio filter to, when the page's runs differ from `task`. */
hubTask?: HfTaskFilter;
/** Trigger text when nothing is loaded. Defaults to "Select model"; task pages name what they
diff --git a/studio/frontend/src/features/model-picker/components/model-selector/pickers.tsx b/studio/frontend/src/features/model-picker/components/model-selector/pickers.tsx
index d2bc85f2a01..579382c0237 100644
--- a/studio/frontend/src/features/model-picker/components/model-selector/pickers.tsx
+++ b/studio/frontend/src/features/model-picker/components/model-selector/pickers.tsx
@@ -6072,7 +6072,7 @@ export function HubModelPicker({
"h-(--picker-control-h) w-(--picker-control-w) shrink-0 justify-between gap-1.5 pl-4 pr-3.5 !border-0 text-xs [&>span]:!text-clip";
// Tighter menu matching the trigger; keep the option's right padding so the checkmark never overlaps the label.
const sortMenuContentClassName =
- "!p-1 !rounded-[14px] [&_[role=option]]:!pl-2 [&_[role=option]]:!py-1.5 [&_[role=option]]:!text-xs [&_[role=option]]:!rounded-[10px]";
+ "picker-option-menu !p-1 !rounded-[14px] [&_[role=option]]:!pl-2 [&_[role=option]]:!py-1.5 [&_[role=option]]:!text-xs [&_[role=option]]:!rounded-[10px]";
// Device-fit toggle inside the sort menu. The whole row is the button: a Checkbox renders as a
// <button> and label-click forwarding is unreliable, so the Checkbox is presentational.
const fitOnDeviceFooter = (
@@ -6124,6 +6124,7 @@ export function HubModelPicker({
align="end"
className={sortTriggerClassName}
contentClassName={sortMenuContentClassName}
+ composer={false}
triggerContent={sortTriggerContent(
RECOMMENDED_SORT_OPTIONS.find((o) => o.value === recommendedSort)
?.label ?? recommendedSort,
@@ -6139,6 +6140,7 @@ export function HubModelPicker({
align="end"
className={sortTriggerClassName}
contentClassName={sortMenuContentClassName}
+ composer={false}
triggerContent={sortTriggerContent(
LOCAL_SORT_OPTIONS.find((o) => o.value === downloadedSort)?.label ??
downloadedSort,
@@ -6153,6 +6155,7 @@ export function HubModelPicker({
align="end"
className={sortTriggerClassName}
contentClassName={sortMenuContentClassName}
+ composer={false}
triggerContent={sortTriggerContent(
LOCAL_SORT_OPTIONS.find((o) => o.value === customSort)?.label ??
customSort,
@@ -7274,6 +7277,7 @@ export function HubModelPicker({
align="end"
className={sortTriggerClassName}
contentClassName={sortMenuContentClassName}
+ composer={false}
/>
<HubOptionMenu
value={connectedSort}
@@ -7283,6 +7287,7 @@ export function HubModelPicker({
align="end"
className={sortTriggerClassName}
contentClassName={sortMenuContentClassName}
+ composer={false}
triggerContent={sortTriggerContent(
CONNECTED_SORT_OPTIONS.find(
(option) => option.value === connectedSort,
@@ -7300,6 +7305,7 @@ export function HubModelPicker({
align="end"
className={sortTriggerClassName}
contentClassName={sortMenuContentClassName}
+ composer={false}
// Audio has no sort for its listing, so the fit toggle lives here.
footer={
audioTaskPicker && section === "recommended"
diff --git a/studio/frontend/src/features/video/video-page.tsx b/studio/frontend/src/features/video/video-page.tsx
index 0fd880f3b65..3a0e19ad3ca 100644
--- a/studio/frontend/src/features/video/video-page.tsx
+++ b/studio/frontend/src/features/video/video-page.tsx
@@ -3815,7 +3815,7 @@ function VideoGenerator({
task={VIDEO_GEN_TASKS}
catalog={VIDEO_CATALOG}
opaqueKind={opaqueKind}
- hubCapability="diffusion"
+ hubCapability="video-gen"
placeholder="Select video model"
open={active && selectorOpen}
onOpenChange={(o) => setSelectorOpen(active && o)}
diff --git a/studio/frontend/tests/hub-audio-task-link.test.ts b/studio/frontend/tests/hub-audio-task-link.test.ts
index f6f4a69c720..18413c467d2 100644
--- a/studio/frontend/tests/hub-audio-task-link.test.ts
+++ b/studio/frontend/tests/hub-audio-task-link.test.ts
@@ -31,10 +31,11 @@ test("the Hub link keeps only known audio tasks, and only with the Audio filter"
test("an audio page's Search Hub link narrows the Audio filter to its tasks", () => {
assert.match(hubPageSource, /urlCapability === "audio" && urlTaskKey/);
assert.match(hubPageSource, /capability: undefined,\s*audioTask: undefined,/);
- assert.match(hubPageSource, /if \(capabilityFilter !== "audio" && linkedAudioTask !== null\) \{\s*setLinkedAudioTask\(null\);/);
+ assert.match(hubPageSource, /if \(!capabilityFilters\.includes\("audio"\) && linkedAudioTask !== null\) \{\s*setLinkedAudioTask\(null\);/);
assert.match(
hubPageSource,
- /task:\s*capabilityFilter === "audio" \? \(linkedAudioTask \?\? undefined\) : undefined,/,
+ // Only with Audio as the one filter: asking the Hub for audio tasks would drop the others' models.
+ /capabilityFilters\.length === 1 && capabilityFilters\[0\] === "audio"\s*\? \(linkedAudioTask \?\? undefined\)\s*: undefined,/,
);
assert.match(discoverSource, /channel,\s*filters,\s*task,\s*\}\);/);
});
@@ -50,7 +51,7 @@ test("a typed Hub search still keeps only the linked audio tasks", () => {
assert.equal(matchesHubAudioTask("text-to-speech", []), true);
assert.match(
hubPageSource,
- /deferredCapabilityFilter !== "audio" \|\|\s*matchesHubAudioTask\(row\.result\.pipelineTag, linkedAudioTask\)/,
+ /key !== "audio" \|\|\s*matchesHubAudioTask\(row\.result\.pipelineTag, linkedAudioTask\)/,
);
});
diff --git a/studio/frontend/tests/hub-capability-split.test.ts b/studio/frontend/tests/hub-capability-split.test.ts
new file mode 100644
index 00000000000..c27604506ae
--- /dev/null
+++ b/studio/frontend/tests/hub-capability-split.test.ts
@@ -0,0 +1,203 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+// The Hub filters image and video generation separately, though both stay one "diffusion"
+// capability for loading and the Images and Video pages.
+
+import assert from "node:assert/strict";
+import test from "node:test";
+
+import { readSrc, registerBundlerResolver } from "./helpers/kit.ts";
+
+registerBundlerResolver();
+
+const { detectCapabilities, generationKinds, HUB_CAPABILITY_FILTERS } = await import(
+ "../src/features/hub/lib/model-capabilities.ts"
+);
+
+test("video models are video gen, image models image gen", () => {
+ assert.deepEqual(generationKinds(["diffusers"], "text-to-video", "Wan-AI/Wan2.2-T2V"), { image: false, video: true });
+ assert.deepEqual(generationKinds(["diffusers"], "text-to-image", "black-forest-labs/FLUX.1-dev"), { image: true, video: false });
+ // A video family named without a video tag still counts as video.
+ assert.equal(generationKinds(["diffusers"], undefined, "tencent/HunyuanVideo").video, true);
+ // MiniMax-H3's pipeline, which the Video page runs.
+ assert.deepEqual(generationKinds(["diffusers"], "image-text-to-video", "MiniMaxAI/MiniMax-H3"), { image: false, video: true });
+ assert.deepEqual(
+ detectCapabilities([], "image-text-to-video", "MiniMaxAI/MiniMax-H3").find((c) => c.key === "diffusion"),
+ { key: "diffusion", label: "Video gen" },
+ );
+ // A generator with no signal either way is taken for an image model.
+ assert.deepEqual(generationKinds(["diffusers"], undefined, "someone/custom-gen"), { image: true, video: false });
+});
+
+test("the shared capability stays diffusion, labelled for what the model makes", () => {
+ const video = detectCapabilities(["diffusers"], "text-to-video", "Wan-AI/Wan2.2-T2V");
+ assert.deepEqual(video.find((c) => c.key === "diffusion"), { key: "diffusion", label: "Video gen" });
+ const image = detectCapabilities(["diffusers"], "text-to-image", "black-forest-labs/FLUX.1-dev");
+ assert.deepEqual(image.find((c) => c.key === "diffusion"), { key: "diffusion", label: "Image gen" });
+});
+
+test("the Hub lists Image gen and Video gen as two picks", () => {
+ assert.ok(HUB_CAPABILITY_FILTERS.includes("image-gen"));
+ assert.ok(HUB_CAPABILITY_FILTERS.includes("video-gen"));
+ assert.ok(!(HUB_CAPABILITY_FILTERS as readonly string[]).includes("diffusion"));
+ const options = readSrc("features/hub/lib/view-models.ts");
+ assert.match(options, /\{ value: "image-gen", label: "Image gen" \}/);
+ assert.match(options, /\{ value: "video-gen", label: "Video gen" \}/);
+});
+
+test("the Images and Video pages' Search Hub links open their own pick", () => {
+ assert.match(readSrc("features/images/images-page.tsx"), /hubCapability="image-gen"/);
+ assert.match(readSrc("features/video/video-page.tsx"), /hubCapability="video-gen"/);
+ // Older links carry the single "diffusion" filter.
+ assert.match(readSrc("app/routes/hub.tsx"), /search\.capability === "diffusion" \? "image-gen"/);
+});
+
+test("capabilities are picked in the filter popover, which sits right after the search", () => {
+ const toolbar = readSrc("features/hub/catalog/models-toolbar.tsx");
+ assert.doesNotMatch(toolbar, /ariaLabel="Capability filter"/);
+ const filter = toolbar.indexOf("<ModelSearchFiltersControl");
+ assert.ok(filter > toolbar.indexOf("<Input") && filter < toolbar.indexOf('ariaLabel="Sort models"'));
+ assert.match(toolbar, /capabilities=\{capabilityFilters\}/);
+ const popover = readSrc("features/hub/catalog/model-search-filters.tsx");
+ assert.match(popover, /CAPABILITY_FILTER_OPTIONS\.map\(\(option\) => \{/);
+ assert.match(popover, /role="checkbox"\s+aria-checked=\{checked\}/);
+ assert.match(popover, /\{showModelFilters && \(/);
+});
+
+test("Text only lists the models no other box covers, so every box ticked lists every model", () => {
+ assert.equal(HUB_CAPABILITY_FILTERS[0], "text");
+ const viewModels = readSrc("features/hub/lib/view-models.ts");
+ assert.match(viewModels, /\{ value: "text", label: "Text only" \}/);
+ assert.match(viewModels, /if \(key === "text"\) \{\s*return \(\s*!HUB_CAPABILITY_FILTERS\.some\(\s*\(other\) => other !== "text" && matchesHubCapability\(row, other\),/);
+});
+
+test("every capability starts ticked, and the last tick can't be removed", () => {
+ const popover = readSrc("features/hub/catalog/model-search-filters.tsx");
+ assert.match(popover, /capabilities\.length === 0 \|\| capabilities\.includes\(key\)/);
+ assert.match(popover, /locked=\{next\.length === 0\}/);
+ assert.match(popover, /icon=\{FilterMailIcon\}/);
+});
+
+test("the first pick from the default keeps just that capability", () => {
+ const popover = readSrc("features/hub/catalog/model-search-filters.tsx");
+ assert.match(popover, /capabilities\.length === 0 && isolateFirstCapability\s*\? \[option\.value\]/);
+ // Armed once, until the first change from the defaults; the resets arm it again.
+ const page = readSrc("features/hub/hub-page.tsx");
+ assert.match(page, /setFirstPickArmed\(false\);\s*setCapabilityFilters\(next\);/);
+ assert.match(page, /isolateFirstCapability=\{firstPickArmed\}/);
+ assert.doesNotMatch(popover, />\s*Only\s*</);
+});
+
+test("size and context are stepped ranges whose ends mean no limit", () => {
+ const popover = readSrc("features/hub/catalog/model-search-filters.tsx");
+ assert.match(popover, /\[1, 3, 6, 9, 12, 24, 32, 64, 128, 256, 500\]/);
+ assert.match(popover, /\[16, 24, 32, 48, 64, 96, 128, 192, 256, 512, 1024\]/);
+ // Every inner stop draws a tick, under the range so its fill runs unbroken.
+ assert.match(popover, /i === 0 \|\| i === last \? null/);
+ assert.match(popover, /\[spec\.min\]: next\[0\] === 0 \? undefined : spec\.stops\[next\[0\]\]/);
+ assert.match(popover, /\[spec\.max\]: next\[1\] === last \? undefined : spec\.stops\[next\[1\]\]/);
+ assert.doesNotMatch(popover, /Apply (filters|limits)/);
+});
+
+test("Uploader is a two-way toggle between Unsloth and every uploader", () => {
+ const popover = readSrc("features/hub/catalog/model-search-filters.tsx");
+ assert.match(popover, /role="radiogroup"\s+aria-label=\{label\}/);
+ assert.match(popover, /label="Uploader"/);
+ assert.match(popover, /\["unsloth", "Unsloth"\],\s*\["all", "All uploaders"\]/);
+ assert.match(popover, /next === "unsloth" \? \["unsloth"\] : \[\.\.\.HUB_UPLOADERS\]/);
+});
+
+test("a video signal wins over image tags, and family names are read from the repo name", () => {
+ // Several video repos carry an image tag for their first-frame path.
+ assert.deepEqual(generationKinds(["diffusers", "text-to-image"], "image-to-video", "Wan-AI/Wan2.2-I2V"), { image: false, video: true });
+ // An image model published by a video org stays an image model.
+ assert.deepEqual(generationKinds(["diffusers"], undefined, "hunyuanvideo-community/HunyuanImage-2.1"), { image: true, video: false });
+});
+
+test("the range thumbs can share a stop, so <1B and >500B are reachable as limits", () => {
+ assert.match(readSrc("features/hub/catalog/model-search-filters.tsx"), /minStepsBetweenThumbs=\{0\}/);
+});
+
+test("Datasets only replaces the toolbar's Models / Datasets toggle", () => {
+ const popover = readSrc("features/hub/catalog/model-search-filters.tsx");
+ assert.doesNotMatch(popover, /Base only/);
+ assert.match(popover, /label="Datasets only"[\s\S]{0,200}checked=\{datasets\}/);
+ const toolbar = readSrc("features/hub/catalog/models-toolbar.tsx");
+ assert.doesNotMatch(toolbar, /aria-label="Resource type"/);
+ assert.match(toolbar, /onResourceTypeChange\(on \? "datasets" : "models"\)/);
+});
+
+test("LTX versions are video, and video-to-video is not offered as runnable video gen", () => {
+ assert.equal(generationKinds(["diffusers"], undefined, "unsloth/LTX-2.3-GGUF").video, true);
+ assert.equal(generationKinds(["diffusers"], undefined, "Lightricks/LTX-Video").video, true);
+ // The Video page takes a prompt and reference images, never a source video.
+ assert.deepEqual(generationKinds(["diffusers"], "video-to-video", "someone/restyle"), { image: false, video: false });
+ assert.equal(generationKinds(["diffusers"], undefined, "unsloth/MiniMax-H3-GGUF").video, true);
+});
+
+test("Text only never lists a media pipeline, even one no capability box claims", () => {
+ const viewModels = readSrc("features/hub/lib/view-models.ts");
+ assert.match(viewModels, /!matchesCapability\(row\.capabilities, "diffusion"\) &&\s*!MEDIA_OUTPUT_TASKS\.has\(/);
+ for (const task of ["image-text-to-image", "text-to-audio", "audio-to-audio", "video-to-video"]) {
+ assert.match(viewModels, new RegExp(`"${task}",`));
+ }
+});
+
+test("audio Diffusers pipelines are neither image nor video gen; a video family name is video gen", () => {
+ assert.deepEqual(generationKinds(["diffusers"], "text-to-audio", "someone/audio-ldm"), { image: false, video: false });
+ assert.match(readSrc("features/hub/lib/view-models.ts"), /key === "video-gen" && isVideoFamilyName\(row\.result\.id\)\)\s*return generationKinds\(/);
+ assert.equal(generationKinds(["diffusers"], "video-to-video", "Lightricks/LTX-2.3-V2V").video, false);
+});
+
+test("a Diffusers pipeline that makes neither images nor video gets no generation pill", () => {
+ const caps = detectCapabilities(["diffusers"], "text-to-audio", "someone/audio-ldm");
+ assert.equal(caps.some((c) => c.key === "diffusion"), false);
+});
+
+test("a new search starts on every uploader", () => {
+ assert.match(readSrc("features/hub/hub-page.tsx"), /\} else if \(query\.trim\(\) === ""\) \{[\s\S]{0,160}setUploaderPick\(null\);/);
+});
+
+test("image-text-to-image is image gen; Text only checks media tasks in tags too", () => {
+ assert.equal(
+ detectCapabilities([], "image-text-to-image", "someone/edit-model").some((c) => c.key === "diffusion"),
+ true,
+ );
+ assert.match(readSrc("features/hub/lib/view-models.ts"), /\(row\.result\.tags \?\? \[\]\)\.some\(\(tag\) =>\s*MEDIA_OUTPUT_TASKS\.has\(tag\.toLowerCase\(\)\)/);
+});
+
+test("text-to-audio and audio-to-audio pipelines are Audio, so isolating Audio keeps them", () => {
+ for (const task of ["text-to-audio", "audio-to-audio"]) {
+ assert.equal(detectCapabilities([], task, "declare-lab/tango").some((c) => c.key === "audio"), true);
+ }
+});
+
+test("3D Diffusers pipelines are neither image nor video gen, and Text only never lists them", () => {
+ for (const task of ["text-to-3d", "image-to-3d"]) {
+ assert.deepEqual(generationKinds(["diffusers"], task, "openai/shap-e"), { image: false, video: false });
+ assert.equal(detectCapabilities(["diffusers"], task, "openai/shap-e").some((c) => c.key === "diffusion"), false);
+ assert.match(readSrc("features/hub/lib/view-models.ts"), new RegExp(`"${task}",`));
+ }
+});
+
+test("changing tabs clears dataset modalities along with the other hidden filters", () => {
+ assert.match(readSrc("features/hub/hub-page.tsx"), /setSearchFilters\(\{\}\);\s*setDatasetModalities\(\[\]\);\s*setUploaderPick\(null\);\s*setFirstPickArmed\(true\);\s*setModelsTab\(next\);/);
+});
+
+test("Wan is matched as a family name, not anywhere in the repo name", () => {
+ assert.equal(generationKinds(["diffusers"], undefined, "Wan-AI/Wan2.2-T2V-A14B").video, true);
+ assert.equal(generationKinds([], undefined, "someone/swan2-7b").video, false);
+ assert.equal(detectCapabilities([], undefined, "someone/swan2-7b").some((c) => c.key === "diffusion"), false);
+});
+
+test("back/forward between models and datasets drops the other kind's hidden bounds", () => {
+ assert.match(
+ readSrc("features/hub/hub-page.tsx"),
+ /syncedUrlKind\.current = urlResourceType;[\s\S]{0,300}setSearchFilters\(\{\}\);\s*setDatasetModalities\(\[\]\);/,
+ );
+});
+
+test("capabilities light the filter dot only where they apply", () => {
+ assert.match(readSrc("features/hub/catalog/model-search-filters.tsx"), /\(modelSections && capabilities\.length > 0\)/);
+});
diff --git a/studio/frontend/tests/hub-dataset-filters.test.ts b/studio/frontend/tests/hub-dataset-filters.test.ts
new file mode 100644
index 00000000000..57d5e3df564
--- /dev/null
+++ b/studio/frontend/tests/hub-dataset-filters.test.ts
@@ -0,0 +1,58 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+// The Hub's dataset filters: modalities (any picked) and a row range over its size categories.
+
+import assert from "node:assert/strict";
+import test from "node:test";
+import {
+ datasetModalities,
+ datasetSizeBucket,
+ matchesDatasetFilters,
+} from "../src/features/hub/lib/dataset-filters.ts";
+
+const tags = ["modality:text", "modality:tabular", "size_categories:10K<n<100K"];
+const dataset = { modalities: datasetModalities(tags), sizeBucket: datasetSizeBucket(tags) };
+
+test("reads the Hub's modality and size tags", () => {
+ assert.deepEqual(dataset.modalities, ["text", "tabular"]);
+ assert.equal(dataset.sizeBucket, 2);
+ assert.equal(datasetSizeBucket(["size_categories:n>1T"]), 10);
+ assert.equal(datasetSizeBucket(["license:mit"]), undefined);
+});
+
+test("any picked modality matches; none picked lists every dataset", () => {
+ assert.equal(matchesDatasetFilters(dataset, [], undefined, undefined), true);
+ assert.equal(matchesDatasetFilters(dataset, ["image", "text"], undefined, undefined), true);
+ assert.equal(matchesDatasetFilters(dataset, ["image"], undefined, undefined), false);
+});
+
+test("a size bucket matches when it overlaps the row range", () => {
+ // 10K-100K rows.
+ assert.equal(matchesDatasetFilters(dataset, [], 1e4, undefined), true);
+ assert.equal(matchesDatasetFilters(dataset, [], 1e5, undefined), false);
+ assert.equal(matchesDatasetFilters(dataset, [], undefined, 1e4), false);
+ assert.equal(matchesDatasetFilters(dataset, [], undefined, 1e6), true);
+ // No size published: left out once a range is set.
+ assert.equal(matchesDatasetFilters({ modalities: [] }, [], 1e3, undefined), false);
+});
+
+test("dataset filters count as active and reset the list's scroll", async () => {
+ const { readFileSync } = await import("node:fs");
+ const page = readFileSync(new URL("../src/features/hub/hub-page.tsx", import.meta.url), "utf8");
+ assert.match(page, /isDatasetMode &&\s*\(deferredDatasetModalities\.length > 0 \|\|\s*minRows !== undefined \|\|\s*maxRows !== undefined\)/);
+ assert.match(page, /deferredCapabilityFilters,\s*deferredDatasetModalities,\s*searchFilters,/);
+});
+
+test("a row range alone lights the filter dot and Reset all", async () => {
+ const { readFileSync } = await import("node:fs");
+ const popover = readFileSync(new URL("../src/features/hub/catalog/model-search-filters.tsx", import.meta.url), "utf8");
+ assert.match(popover, /\(showModelFilters \|\| datasetSections\) && hasModelSearchFilters\(value\)/);
+});
+
+test("both thumbs on one stop keep the buckets either side of it", () => {
+ // The dataset sits in 10K<n<100K, so a point at 10K or 100K keeps it and 1M does not.
+ assert.equal(matchesDatasetFilters(dataset, [], 1e4, 1e4), true);
+ assert.equal(matchesDatasetFilters(dataset, [], 1e5, 1e5), true);
+ assert.equal(matchesDatasetFilters(dataset, [], 1e6, 1e6), false);
+});
diff --git a/studio/frontend/tests/hub-uploader-filter.test.ts b/studio/frontend/tests/hub-uploader-filter.test.ts
new file mode 100644
index 00000000000..040f0df03f3
--- /dev/null
+++ b/studio/frontend/tests/hub-uploader-filter.test.ts
@@ -0,0 +1,56 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+// The uploader is picked in the Hub's filter popover, Unsloth's uploads until a search is typed.
+
+import assert from "node:assert/strict";
+import { existsSync } from "node:fs";
+import test from "node:test";
+
+import { readSrc } from "./helpers/kit.ts";
+
+const page = readSrc("features/hub/hub-page.tsx");
+const popover = readSrc("features/hub/catalog/model-search-filters.tsx");
+
+test("the results header's Unsloth / All dropdown is gone", () => {
+ assert.doesNotMatch(page, /OwnerScopeToggle|actions=\{ownerToggle\}/);
+ assert.equal(existsSync(new URL("../src/features/hub/catalog/owner-scope-toggle.tsx", import.meta.url)), false);
+});
+
+test("Unsloth's uploads by default, every uploader once a search is typed", () => {
+ assert.match(page, /uploaderPick \?\? \(debouncedQuery\.trim\(\) \? HUB_UPLOADERS : UNSLOTH_UPLOADER\)/);
+ assert.match(page, /uploaders\.length === 1 && uploaders\[0\] === "unsloth" \? "unsloth" : "all"/);
+});
+
+test("the popover's uploader toggle picks Unsloth or every uploader", () => {
+ assert.match(readSrc("features/hub/lib/model-search-filters.ts"), /"unsloth",\s*"organization",\s*"personal",/);
+ assert.match(popover, /\["all", "All uploaders"\]/);
+ assert.doesNotMatch(popover, /Organizations only|Non-organization/);
+});
+
+test("the range notes are hover tooltips beside Parameters and Context length", () => {
+ assert.doesNotMatch(popover, /Ranges include both limits/);
+ assert.match(popover, /aria-label=\{`About \$\{label\.toLowerCase\(\)\}`\}/);
+ assert.match(popover, /icon=\{InformationCircleIcon\}/);
+});
+
+test("the Hub's menus take the composer + menu's shape", () => {
+ const css = readSrc("features/hub/hub.css");
+ assert.match(css, /\.hub-composer-menu\[data-slot\] \{\s*border-radius: 21px !important;/);
+ assert.match(readSrc("features/hub/catalog/hub-option-menu.tsx"), /hub-composer-menu/);
+ assert.match(popover, /hub-composer-menu/);
+ assert.match(popover, /const SEPARATOR = "mx-1 my-2 h-px bg-border";/);
+});
+
+test("Reasoning draws the composer's thinking bulb", () => {
+ assert.match(popover, /<BulbIcon className="size-4 shrink-0" \/>/);
+ const shared = readSrc("features/hub/catalog/shared.tsx");
+ assert.match(shared, /capability\.key === "reasoning" \? \(\s*<BulbIcon className="size-3 shrink-0" \/>/);
+ assert.doesNotMatch(shared + popover, /BrainIcon/);
+});
+
+test("a picked Unsloth during a search counts as a filter, and the row range resets the list", () => {
+ const page = readSrc("features/hub/hub-page.tsx");
+ assert.match(page, /\(isModelDiscover &&\s*uploaderPick !== null &&\s*ownerScope === "unsloth" &&\s*debouncedQuery\.trim\(\) !== ""\)/);
+ assert.match(page, /const filterResetSignature = useMemo\([\s\S]{0,400}minRows,\s*maxRows,/);
+});
diff --git a/studio/frontend/tests/model-search-filters.test.ts b/studio/frontend/tests/model-search-filters.test.ts
index f3a4def901d..8f530b1099c 100644
--- a/studio/frontend/tests/model-search-filters.test.ts
+++ b/studio/frontend/tests/model-search-filters.test.ts
@@ -49,7 +49,7 @@ test("parameter ranges are inclusive and exclude unknown counts only when active
]) {
assert.equal(matchesRange(count, 2e9, 8e9), false);
}
- assert.equal(hasModelSearchFilters({ organizationsOnly: false }), false);
+ assert.equal(hasModelSearchFilters({ uploaders: undefined }), false);
assert.equal(hasModelSearchFilters({ minParams: 0 }), true);
});
@@ -96,7 +96,7 @@ test("combined filters use actual parameters, GGUF context, and organization own
maxParams: 8e9,
minContext: 32768,
maxContext: 131072,
- organizationsOnly: true,
+ uploaders: ["unsloth", "organization"],
},
async (path) => {
requests.push(path);
@@ -363,3 +363,28 @@ test("rejected Unsloth rows stop delaying other publishers after a bounded scan"
assert.equal(rows.length, limit + 1);
assert.deepEqual(rows.at(-1), { name: "Qwen/match" });
});
+
+test("uploaders split Unsloth, other organizations and personal accounts", async () => {
+ const rows = [
+ { name: "unsloth/a" },
+ { name: "Qwen/b" },
+ { name: "someone/c" },
+ ];
+ const requests: string[] = [];
+ const fetchJson = async (path: string) => {
+ requests.push(path);
+ return path.includes("/organizations/Qwen/") ? {} : null;
+ };
+ const names = async (uploaders: ("unsloth" | "organization" | "personal")[]) =>
+ (await collect(filterModelListing(listing(rows), { uploaders }, fetchJson)))
+ .filter(Boolean)
+ .map((m) => (m as { name: string }).name);
+ assert.deepEqual(await names(["personal"]), ["someone/c"]);
+ assert.deepEqual(await names(["unsloth", "personal"]), ["unsloth/a", "someone/c"]);
+ assert.deepEqual(await names(["organization"]), ["Qwen/b"]);
+ requests.length = 0;
+ // Organizations and personal accounts together need no lookup.
+ assert.deepEqual(await names(["organization", "personal"]), ["Qwen/b", "someone/c"]);
+ assert.deepEqual(await names(["unsloth"]), ["unsloth/a"]);
+ assert.deepEqual(requests, []);
+});