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.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio: reuse Model Hub filter metadata between searches (#14265)
alkinun9ec8618dca39
diff --git a/studio/frontend/scripts/check-bundle-budget.ts b/studio/frontend/scripts/check-bundle-budget.tsindex 1943bb13af7..93c70eed59f 100644--- a/studio/frontend/scripts/check-bundle-budget.ts+++ b/studio/frontend/scripts/check-bundle-budget.ts@@ -398,8 +398,11 @@ export const BUDGET = {// 2,085,257 -> 2,085,884 B transfer against 1f5576747, Node 24, 98 chunks), where main was already 315 B raw /// 239 B transfer over. Set to the measured build plus about 300 B raw / 100 B transfer (CI builds measure// about 100 B over a local one).- transferBytes: 2_085_990,- rawBytes: 6_925_130,+ // Hub metadata caching and hidden-row filtering (#14265): +548 B raw / +146 B transfer (6,925,639 ->+ // 6,926,187 B raw, 2,086,290 -> 2,086,436 B transfer against 0ee5cfc58, Node 24, 98 chunks), where main+ // was already over the line above. Set to the merged build plus about 200 B.+ transferBytes: 2_086_630,+ rawBytes: 6_926_390,};// The chunk count is reported but not budgeted. Splitting a page out of the entry raises it while lowering thediff --git a/studio/frontend/src/features/hub/hooks/use-discover-search.ts b/studio/frontend/src/features/hub/hooks/use-discover-search.tsindex c12f9e36ebe..dc130d993b3 100644--- a/studio/frontend/src/features/hub/hooks/use-discover-search.ts+++ b/studio/frontend/src/features/hub/hooks/use-discover-search.ts@@ -106,6 +106,7 @@ export function useDiscoverSearch({channel,ownerScope,filters,+ keepResult,task,}: {debouncedQuery: string;@@ -117,6 +118,7 @@ export function useDiscoverSearch({channel: HfModelSearchChannel | null;ownerScope: "unsloth" | "all";filters?: ModelSearchFilters;+ keepResult?: (result: HfModelResult) => boolean;task?: HfTaskFilter;}): DiscoverSearch {const { phase, failure } = useHubAvailability();@@ -140,6 +142,7 @@ export function useDiscoverSearch({ownerScope,enabled: canProbe && isDiscoverTab && !isDatasetMode,keepUnsupportedTags: true,+ keepResult,channel,filters,task,diff --git a/studio/frontend/src/features/hub/hooks/use-hub-model-search.ts b/studio/frontend/src/features/hub/hooks/use-hub-model-search.tsindex e59c6c9b1c9..32db337ad66 100644--- a/studio/frontend/src/features/hub/hooks/use-hub-model-search.ts+++ b/studio/frontend/src/features/hub/hooks/use-hub-model-search.ts@@ -30,6 +30,7 @@ import {providerSearchTerms,} from "../lib/provider-search";import { fetchWithTimeout } from "../lib/network";+import { LruMap } from "../lib/lru-map";import {type UnslothSupport,type UnslothSupportStatus,@@ -38,6 +39,7 @@ import {import {filterModelListing,hasModelSearchFilters,+ needsModelMetadata,parameterRange,type ModelSearchFilters,} from "../lib/model-search-filters";@@ -124,6 +126,7 @@ export interface HfModelResult {// HF rejects direction=1 (asc) for trendingScore — only descending is supported.const DESC_ONLY_SORTS = new Set<HfSortKey>(["trendingScore"]);const HF_SEARCH_TIMEOUT_MS = 15_000;+const FILTER_METADATA_TTL_MS = 5 * 60 * 1000;// The HF listModels lib doesn't whitelist gguf metadata, but the listing supports it. Append// expand=gguf so GGUF repos report a param count for the size / OOM badge even when the name@@ -876,6 +879,8 @@ export function useHubModelSearch(hideEmptyUploads?: boolean;channel?: HfModelSearchChannel | null;filters?: ModelSearchFilters;+ /** False for a result the caller hides anyway; such rows skip per-row filter lookups. */+ keepResult?: (result: HfModelResult) => boolean;},) {const {@@ -892,6 +897,7 @@ export function useHubModelSearch(hideEmptyUploads = false,channel = null,filters,+ keepResult,} = options ?? {};const unslothOnly = ownerScope === "unsloth";@@ -924,6 +930,16 @@ export function useHubModelSearch([isPublisherQuery, trimmed],);const hfEndpoint = useHfEndpoint();+ // Filter changes and retries reuse settled metadata; another Hub or token must not.+ const filterMetadata = useMemo(+ () =>+ new LruMap<+ string,+ { data: Record<string, unknown> | null; expires: number }+ >(2048),+ // eslint-disable-next-line react-hooks/exhaustive-deps+ [hfEndpoint, accessToken],+ );const hasFilters = !!filters && hasModelSearchFilters(filters);const filterRange = filters ? parameterRange(filters) : "";const createListing = useCallback(@@ -1112,6 +1128,42 @@ export function useHubModelSearch(],);+ const deviceType = usePlatformStore((s) => s.deviceType);+ const mapModel = useMemo(+ () =>+ makeMapModel(+ excludeGguf,+ keepUnsupportedTags,+ channelIdSuffix,+ deviceType,+ hideEmptyUploads,+ ),+ [+ excludeGguf,+ keepUnsupportedTags,+ channelIdSuffix,+ deviceType,+ hideEmptyUploads,+ ],+ );+ const needsMetadata = !!filters && needsModelMetadata(filters);+ // Only a row the list can show is worth a per-row Hub request.+ const keepRow = useMemo(+ () =>+ needsMetadata+ ? (raw: unknown) => {+ try {+ const result = mapModel(raw);+ return result !== null && (keepResult?.(result) ?? true);+ } catch {+ // Pagination skips a row its mapper throws on; skip it here too, not the search.+ return false;+ }+ }+ : undefined,+ [needsMetadata, mapModel, keepResult],+ );+const createIter = useCallback((signal: AbortSignal) => {if (!filters || !hasFilters) return createListing(signal);@@ -1120,6 +1172,8 @@ export function useHubModelSearch(Promise<Record<string, unknown> | null>>();const requestJson = async (path: string) => {+ const cached = filterMetadata.get(path);+ if (cached && cached.expires > Date.now()) return cached.data;const response = await fetchWithTimeout(`${hfEndpoint}${path}`,{@@ -1130,14 +1184,24 @@ export function useHubModelSearch(},HF_SEARCH_TIMEOUT_MS,);- if ([401, 403, 404].includes(response.status)) return null;- if (!response.ok) {+ if ([401, 403].includes(response.status)) return null;+ if (!response.ok && response.status !== 404) {throw new Error(`Model filter metadata request failed (HTTP ${response.status})`,);}- // One repo's malformed config.json must not abort the whole search.- return response.json().catch(() => null);+ try {+ const data = response.status === 404 ? null : await response.json();+ if (!signal.aborted) {+ filterMetadata.set(path, {+ data,+ expires: Date.now() + FILTER_METADATA_TTL_MS,+ });+ }+ return data;+ } catch {+ return null;+ }};const fetchJson = (path: string) => {let request = metadata.get(path);@@ -1148,7 +1212,7 @@ export function useHubModelSearch(return request;};const filterPriority: ModelListingTransform = (iterator) =>- filterModelListing(iterator, filters, fetchJson);+ filterModelListing(iterator, filters, fetchJson, undefined, keepRow);const iterator = createListing(signal, filterPriority);const pinnedPromise =pinnedId &&@@ -1164,7 +1228,13 @@ export function useHubModelSearch(...(accessToken ? { credentials: { accessToken } } : {}),}).catch(() => null): undefined;- return filterModelListing(iterator, filters, fetchJson, pinnedPromise);+ return filterModelListing(+ iterator,+ filters,+ fetchJson,+ pinnedPromise,+ keepRow,+ );},[createListing,@@ -1177,27 +1247,11 @@ export function useHubModelSearch(channelQuery,hfEndpoint,accessToken,+ filterMetadata,+ keepRow,],);- const deviceType = usePlatformStore((s) => s.deviceType);- const mapModel = useMemo(- () =>- makeMapModel(- excludeGguf,- keepUnsupportedTags,- channelIdSuffix,- deviceType,- hideEmptyUploads,- ),- [- excludeGguf,- keepUnsupportedTags,- channelIdSuffix,- deviceType,- hideEmptyUploads,- ],- );const search = useHubPaginatedSearch(createIter, mapModel, { enabled });// Secondary sort only with no user query (the merged iterator already floats unsloth results) anddiff --git a/studio/frontend/src/features/hub/hub-page.tsx b/studio/frontend/src/features/hub/hub-page.tsxindex 6f21a97d9cb..31a01cb719b 100644--- a/studio/frontend/src/features/hub/hub-page.tsx+++ b/studio/frontend/src/features/hub/hub-page.tsx@@ -117,6 +117,7 @@ import {} from "./lib/model-run-selection";import { inventoryRowFormat } from "./catalog/inventory-sort";import { matchesInventoryCapabilities } from "./lib/model-type-filter";+import { ownerOf, repoOf } from "./lib/format";import { resolveOwnerProviderLogo } from "./lib/provider-logos";import { subscribeResidentStatusRefresh } from "./lib/resident-status-refresh";import {@@ -128,7 +129,10 @@ import {type DatasetModality,matchesDatasetFilters,} from "./lib/dataset-filters";-import type { HubCapabilityFilter } from "./lib/model-capabilities";+import {+ detectCapabilities,+ type HubCapabilityFilter,+} from "./lib/model-capabilities";import { studioPageForTask } from "./lib/unsloth-support";import {buildDiscoverRows,@@ -168,10 +172,39 @@ const RUN_CONFIG_REFRESH_TIMEOUT_MS = 5_000;const MIN_ICONLESS_MODEL_LIKES = 30;// Image and video models skip Recommended's likes rules: new diffusion uploads rarely clear them.+function isDiffusionResult(result: HfModelResult): boolean {+ return detectCapabilities(result.tags, result.pipelineTag, result.id).some(+ (c) => c.key === "diffusion",+ );+}+function isDiffusionRow(row: DiscoverRow): boolean {return row.capabilities.some((c) => c.key === "diffusion");}+// Recommended curates browsing to logo'd models plus well-liked iconless ones, and to well-liked+// checkpoints; a typed search and every other format show all matches.+function matchesDiscoverFormat(+ result: HfModelResult,+ format: ModelFormatFilter,+ browsing: boolean,+ diffusion: boolean,+ quantFormats: readonly string[],+): boolean {+ if (format !== "recommended") {+ return matchesFormat(detectResultFormat(result), format);+ }+ if (diffusion) return matchesRecommendedDiffusion(result, quantFormats);+ return (+ (!browsing ||+ ((resolveOwnerProviderLogo(ownerOf(result.id), repoOf(result.id)) !==+ null ||+ (result.likes ?? 0) >= MIN_ICONLESS_MODEL_LIKES) &&+ hasRecommendedCheckpointLikes(result))) &&+ matchesRecommended(result, quantFormats)+ );+}+function withoutGgufTag(tags: readonly string[] | undefined,): readonly string[] | undefined {@@ -950,6 +983,22 @@ export function ModelsPage() {};}, [liveListChannel, widenRecommendedChannel]);+ // checkpointQuantFormats is a superset of diffusionQuantFormats, so this never skips a row the list shows.+ const searchBrowsing = debouncedQuery.trim() === "";+ // Keyed by contents: a system poll hands out a new array, which would restart the search.+ const quantFormatsKey = checkpointQuantFormats.join(",");+ const keepSearchResult = useMemo(() => {+ const quantFormats = quantFormatsKey ? quantFormatsKey.split(",") : [];+ return (result: HfModelResult) =>+ matchesDiscoverFormat(+ result,+ effectiveDiscoverFormat,+ searchBrowsing,+ isDiffusionResult(result),+ quantFormats,+ );+ }, [effectiveDiscoverFormat, searchBrowsing, quantFormatsKey]);+const {results,datasetResults,@@ -972,6 +1021,7 @@ export function ModelsPage() {channel: listChannel,ownerScope,filters: searchFilters,+ keepResult: keepSearchResult,task:// Asked of the Hub only when Audio is the one filter: with others it would drop their models.capabilityFilters.length === 1 && capabilityFilters[0] === "audio"@@ -1108,25 +1158,13 @@ export function ModelsPage() {(row) =>!isHiddenModelId(row.id) &&!isConfiguredHiddenModelId(hiddenEmbeddingModelIds, row.id) &&- // Recommended curates browsing to logo'd models plus well-liked iconless ones, and to- // well-liked checkpoints; a typed search and every other format show all matches.- (effectiveDiscoverFormat !== "recommended" ||- hasQuery ||- isDiffusionRow(row) ||- resolveOwnerProviderLogo(row.owner, row.repo) !== null ||- (row.result.likes ?? 0) >= MIN_ICONLESS_MODEL_LIKES) &&- (effectiveDiscoverFormat !== "recommended" ||- hasQuery ||- isDiffusionRow(row) ||- hasRecommendedCheckpointLikes(row.result)) &&- (effectiveDiscoverFormat === "recommended"- ? isDiffusionRow(row)- ? matchesRecommendedDiffusion(row.result, diffusionQuantFormats)- : matchesRecommended(row.result, checkpointQuantFormats)- : matchesFormat(- detectResultFormat(row.result),- effectiveDiscoverFormat,- )) &&+ matchesDiscoverFormat(+ row.result,+ effectiveDiscoverFormat,+ !hasQuery,+ isDiffusionRow(row),+ isDiffusionRow(row) ? diffusionQuantFormats : checkpointQuantFormats,+ ) &&(deferredCapabilityFilters.length === 0 ||deferredCapabilityFilters.some((key) =>diff --git a/studio/frontend/src/features/hub/lib/model-search-filters.ts b/studio/frontend/src/features/hub/lib/model-search-filters.tsindex adab7ae11dc..26608669812 100644--- a/studio/frontend/src/features/hub/lib/model-search-filters.ts+++ b/studio/frontend/src/features/hub/lib/model-search-filters.ts@@ -30,6 +30,17 @@ export function hasModelSearchFilters(filters: ModelSearchFilters): boolean {);}+export function needsModelMetadata(filters: ModelSearchFilters): boolean {+ const uploaders = filters.uploaders;+ return (+ filters.minContext !== undefined ||+ filters.maxContext !== undefined ||+ (!!uploaders &&+ uploaders.length < HUB_UPLOADERS.length &&+ uploaders.includes("organization") !== uploaders.includes("personal"))+ );+}+export function parameterRange(filters: ModelSearchFilters): string {return [filters.minParams === undefined@@ -108,6 +119,7 @@ export async function* filterModelListing(filters: ModelSearchFilters,fetchJson: JsonFetch,pinnedModel?: Promise<unknown | null>,+ keep?: (raw: unknown) => boolean,): AsyncGenerator<unknown> {const owners = new Map<string, Promise<boolean>>();async function filter(raw: unknown): Promise<ListingModel | null> {@@ -127,6 +139,9 @@ export async function* filterModelListing() {return null;}+ if (keep && !keep(model)) {+ return null;+ }const uploaders = filters.uploaders;if (uploaders && uploaders.length < HUB_UPLOADERS.length) {const owner = model.name.split("/")[0];diff --git a/studio/frontend/tests/hub-filter-metadata.test.ts b/studio/frontend/tests/hub-filter-metadata.test.tsnew file mode 100644index 00000000000..4ac5af87cd8--- /dev/null+++ b/studio/frontend/tests/hub-filter-metadata.test.ts@@ -0,0 +1,266 @@+// 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 assert from "node:assert/strict";+import test from "node:test";+import * as filters from "../src/features/hub/lib/model-search-filters.ts";+import { LruMap } from "../src/features/hub/lib/lru-map.ts";+import { loadWithStubs } from "./helpers/module-stubs.ts";+import type * as SearchModule from "../src/features/hub/hooks/use-hub-model-search.ts";++type Options = NonNullable<+ Parameters<typeof SearchModule.useHubModelSearch>[1]+>;++function searchHarness(request: typeof fetch) {+ let endpoint = "https://huggingface.co";+ let index = 0;+ const cells: { deps: unknown[]; value: unknown }[] = [];+ const memo = (create: () => unknown, deps: unknown[]) => {+ const i = index++;+ const cell = cells[i];+ if (+ !cell ||+ deps.length !== cell.deps.length ||+ deps.some((dep, j) => !Object.is(dep, cell.deps[j]))+ ) {+ cells[i] = { deps, value: create() };+ }+ return cells[i].value;+ };+ let iterator!: AsyncGenerator<unknown>;+ const rows = [+ { name: "unsloth/small", safetensors: { total: 4e9 } },+ { name: "unsloth/large", safetensors: { total: 8e9 } },+ ];+ const mod = loadWithStubs<typeof SearchModule>(+ new URL(+ "../src/features/hub/hooks/use-hub-model-search.ts",+ import.meta.url,+ ),+ {+ react: {+ useMemo: memo,+ useCallback: (fn: unknown, deps: unknown[]) => memo(() => fn, deps),+ useState: (value: unknown) => [value, () => {}],+ useEffect: () => {},+ },+ "@/config/env": {+ usePlatformStore: (select: (s: unknown) => unknown) =>+ select({ deviceType: "linux" }),+ },+ "@/lib/model-size": {+ ggufRepoParams: (_id: string, total: number | undefined) => total,+ },+ "@/lib/hf-endpoint": {+ getHfEndpoint: () => endpoint,+ useHfEndpoint: () => endpoint,+ },+ "@huggingface/hub": {+ listModels: async function* () {+ yield* rows;+ },+ },+ "../lib/hf-cache": {},+ "../lib/hf-model-meta": {+ EMBEDDING_TAGS: new Set(),+ estimateSizeFromDtypes: () => undefined,+ },+ "../lib/merge-task-iterators": {+ mergeTaskIterators: (+ _tasks: unknown,+ create: (+ task: undefined,+ signal?: AbortSignal,+ ) => AsyncGenerator<unknown>,+ signal?: AbortSignal,+ ) => create(undefined, signal),+ },+ "../lib/model-capabilities": { detectBaseModel: () => undefined },+ "../lib/model-identifiers": { isGgufLike: () => false },+ "../lib/fresh-ranking": {},+ "../lib/provider-logos": {},+ "../lib/provider-search": {},+ "../lib/network": { fetchWithTimeout: request },+ "../lib/unsloth-support": {+ classifyUnslothSupport: () => ({ status: "supported" }),+ },+ "../lib/model-search-filters": filters,+ "../lib/lru-map": { LruMap },+ "./use-hub-paginated-search": {+ useHubPaginatedSearch: (+ create: (signal: AbortSignal) => AsyncGenerator<unknown>,+ ) => {+ iterator = create(controller.signal);+ return { results: [] };+ },+ },+ },+ );+ let controller = new AbortController();+ return {+ setEndpoint: (value: string) => {+ endpoint = value;+ },+ abort: () => controller.abort(),+ async search(next: filters.ModelSearchFilters, options: Options = {}) {+ controller.abort();+ controller = new AbortController();+ index = 0;+ mod.useHubModelSearch("", {+ ownerScope: "unsloth",+ filters: next,+ ...options,+ });+ const found: unknown[] = [];+ for await (const row of iterator) if (row) found.push(row);+ return found;+ },+ rows,+ };+}++test("changing context bounds reuses configs instead of exhausting the Hub quota", async () => {+ let requests = 0;+ const hook = searchHarness(async (url) => {+ if (++requests > 2) return new Response(null, { status: 429 });+ return Response.json({+ max_position_embeddings: String(url).includes("/small/") ? 4096 : 32768,+ });+ });+ assert.deepEqual(await hook.search({ minContext: 2048 }), hook.rows);+ assert.deepEqual(await hook.search({ minContext: 8192 }), [hook.rows[1]]);+ assert.deepEqual(await hook.search({}), hook.rows);+ assert.deepEqual(await hook.search({ maxContext: 8192 }), [hook.rows[0]]);+ assert.equal(requests, 2);+});++test("a retry reuses successful configs but fetches the failed request again", async () => {+ const requests = new Map<string, number>();+ const hook = searchHarness(async (url) => {+ const key = String(url);+ const count = (requests.get(key) ?? 0) + 1;+ requests.set(key, count);+ if (key.includes("/large/") && count === 1)+ return new Response(null, { status: 429 });+ return Response.json({ max_position_embeddings: 32768 });+ });+ await assert.rejects(hook.search({ minContext: 2048 }), /429/);+ assert.deepEqual(await hook.search({ minContext: 2048 }), hook.rows);+ assert.equal(+ requests.get(+ "https://huggingface.co/unsloth/small/resolve/main/config.json",+ ),+ 1,+ );+ assert.equal(+ requests.get(+ "https://huggingface.co/unsloth/large/resolve/main/config.json",+ ),+ 2,+ );+});++test("a different token or Hub endpoint cannot reuse filter metadata", async () => {+ let requests = 0;+ const hook = searchHarness(async () => {+ requests++;+ return Response.json({ max_position_embeddings: 32768 });+ });+ for (const accessToken of [+ undefined,+ "first-token",+ "second-token",+ undefined,+ ]) {+ await hook.search({ minContext: 2048 }, { accessToken });+ }+ hook.setEndpoint("https://mirror.example");+ await hook.search({ minContext: 2048 });+ assert.equal(requests, 10);+});++test("expired metadata is refreshed so a changed context limit takes effect", async (t) => {+ t.mock.timers.enable({ apis: ["Date"], now: 1_000_000 });+ let context = 32768;+ let requests = 0;+ const hook = searchHarness(async () => {+ requests++;+ return Response.json({ max_position_embeddings: context });+ });+ await hook.search({ minContext: 16384 });+ context = 8192;+ t.mock.timers.tick(60_000);+ assert.deepEqual(await hook.search({ minContext: 16384 }), hook.rows);+ assert.equal(requests, 2);+ t.mock.timers.tick(5 * 60_000);+ assert.deepEqual(await hook.search({ minContext: 16384 }), []);+ assert.equal(requests, 4);+});++test("missing configs are reused but access errors and malformed JSON are retried", async () => {+ for (const status of [404, 401, 403, 200]) {+ let requests = 0;+ const hook = searchHarness(async () => {+ requests++;+ return new Response("not JSON", { status });+ });+ assert.deepEqual(await hook.search({ minContext: 2048 }), []);+ assert.deepEqual(await hook.search({ minContext: 8192 }), []);+ assert.equal(requests, status === 404 ? 2 : 4, `HTTP ${status}`);+ }+});++test("an aborted search cannot cache metadata that arrives after cancellation", async () => {+ let release!: () => void;+ const pending = new Promise<void>((resolve) => {+ release = resolve;+ });+ let requests = 0;+ const hook = searchHarness(async () => {+ requests++;+ await pending;+ return Response.json({ max_position_embeddings: 32768 });+ });+ const first = hook.search({ minContext: 2048 });+ await new Promise((resolve) => setImmediate(resolve));+ hook.abort();+ release();+ await first;+ assert.deepEqual(await hook.search({ minContext: 8192 }), hook.rows);+ assert.equal(requests, 4);+});++test("rows the list hides cost no metadata request", async () => {+ const requested: string[] = [];+ const hook = searchHarness(async (url) => {+ requested.push(String(url));+ return Response.json({ max_position_embeddings: 32768 });+ });+ const keepResult = (result: { id: string }) => result.id !== "unsloth/small";+ assert.deepEqual(await hook.search({ minContext: 2048 }, { keepResult }), [+ hook.rows[1],+ ]);+ assert.deepEqual(requested, [+ "https://huggingface.co/unsloth/large/resolve/main/config.json",+ ]);+ // Without a per-row lookup nothing is skipped: the list keeps filtering as before.+ assert.deepEqual(+ await hook.search({ maxParams: 9e9 }, { keepResult: () => false }),+ hook.rows,+ );+ assert.equal(requested.length, 1);+});++test("a row the mapper throws on is skipped, not the whole search", async () => {+ const hook = searchHarness(async () =>+ Response.json({ max_position_embeddings: 32768 }),+ );+ const keepResult = (result: { id: string }) => {+ if (result.id === "unsloth/small") throw new RangeError("Invalid time value");+ return true;+ };+ assert.deepEqual(await hook.search({ minContext: 2048 }, { keepResult }), [+ hook.rows[1],+ ]);+});diff --git a/studio/frontend/tests/hub-recommended-format.test.ts b/studio/frontend/tests/hub-recommended-format.test.tsindex 4a017750126..3b319a50ab2 100644--- a/studio/frontend/tests/hub-recommended-format.test.ts+++ b/studio/frontend/tests/hub-recommended-format.test.ts@@ -91,7 +91,7 @@ test("Recommended browsing lists checkpoints only past 30 likes", async () => {const page = await readSrcAsync("features/hub/hub-page.tsx");assert.match(page,- /effectiveDiscoverFormat !== "recommended" \|\|\s*hasQuery \|\|\s*isDiffusionRow\(row\) \|\|\s*hasRecommendedCheckpointLikes\(row\.result\)/,+ /\(!browsing \|\|[\s\S]{0,240}hasRecommendedCheckpointLikes\(result\)\)\) &&\s*matchesRecommended\(result, quantFormats\)/,);assert.match(page,@@ -118,7 +118,11 @@ test("image and video models skip the likes rules and list full-precision checkpconst page = await readSrcAsync("features/hub/hub-page.tsx");assert.match(page,- /isDiffusionRow\(row\)\s*\?\s*matchesRecommendedDiffusion\(row\.result, diffusionQuantFormats\)\s*:\s*matchesRecommended\(row\.result, checkpointQuantFormats\)/,+ /isDiffusionRow\(row\) \? diffusionQuantFormats : checkpointQuantFormats/,+ );+ assert.match(+ page,+ /searchBrowsing,\s*isDiffusionResult\(result\),\s*quantFormats,/,);});@@ -132,7 +136,16 @@ test("the likes threshold only curates Recommended, and Recommended is the defauconst page = await readSrcAsync("features/hub/hub-page.tsx");assert.match(page,- /effectiveDiscoverFormat !== "recommended" \|\|\s*hasQuery \|\|\s*isDiffusionRow\(row\) \|\|\s*resolveOwnerProviderLogo/,+ /if \(format !== "recommended"\) \{\s*return matchesFormat\(detectResultFormat\(result\), format\);\s*\}\s*if \(diffusion\) return matchesRecommendedDiffusion\(result, quantFormats\);\s*return \(\s*\(!browsing \|\|\s*\(\(resolveOwnerProviderLogo/,+ );+ // The search's skip test follows the formats' contents: a system poll's new array must not restart it.+ assert.match(+ page,+ /const quantFormatsKey = checkpointQuantFormats\.join\(","\);[\s\S]{0,600}\[effectiveDiscoverFormat, searchBrowsing, quantFormatsKey\]/,+ );+ assert.match(+ page,+ /matchesDiscoverFormat\(\s*row\.result,\s*effectiveDiscoverFormat,\s*!hasQuery,\s*isDiffusionRow\(row\),/,);assert.doesNotMatch(page, /preset\?\.format \?\? "gguf"/);const channels = await readSrcAsync("features/hub/lib/channels.ts");