Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
d435968
feat(assets): group model library by model_type tags
synap5e Jun 18, 2026
01a51fc
refactor(assets): gate model_type grouping on supports_model_type_tags
synap5e Jun 18, 2026
86faaee
refactor(assets): run model-asset store on non-cloud builds
synap5e Jun 19, 2026
1897ec5
fix(assets): strip model_type: prefix from asset card type badge
synap5e Jun 21, 2026
31c043e
fix(assets): strip model_type: prefix from the asset browser title
synap5e Jun 22, 2026
979f01f
fix(assets): port model_type node-category resolution to resolveModel…
synap5e Jun 23, 2026
c8af4c5
fix(assets): keep reserved-tag constants local in assetMetadataUtils
synap5e Jun 23, 2026
7117caf
test(assets): restore mocks after each resolveModelNodeFromAsset test
synap5e Jun 23, 2026
ccc6a1f
fix(assets): prefer resolvable model_type over incidental slash tags
synap5e Jul 1, 2026
c34bef8
fix(assets): align badge and loader resolution with model_type tags
synap5e Jul 12, 2026
09877d7
fix(assets): surface refresh errors and harden pagination races
synap5e Jul 12, 2026
ece07cc
fix(assets): close pagination-termination and title-preservation gaps
synap5e Jul 12, 2026
d43ecf8
fix(assets): represent every category of a shared multi-type asset
synap5e Jul 12, 2026
74e4e38
fix(assets): dedupe category candidates and share pagination tolerance
synap5e Jul 20, 2026
8c3b946
test(assets): align cache tests with cursor pagination
synap5e Jul 23, 2026
b7c0e2d
fix(assets): exclude model_type: tags from legacy model folder list
synap5e Jul 28, 2026
61210a2
fix(assets): keep is_immutable-omitting assets in ownership views
synap5e Jul 28, 2026
1ba23b5
fix(assets): give asset browser search and upload accessible names
synap5e Jul 28, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/components/ui/search-input/SearchInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
)
"
:placeholder="placeholderText"
:aria-label="ariaLabel"
:auto-focus="autofocus"
/>
</ComboboxAnchor>
Expand All @@ -78,6 +79,7 @@ const { t } = useI18n()

const {
placeholder,
ariaLabel,
icon = 'icon-[lucide--search]',
debounceTime = 300,
autofocus = false,
Expand All @@ -87,6 +89,7 @@ const {
class: className
} = defineProps<{
placeholder?: string
ariaLabel?: string
icon?: string
debounceTime?: number
autofocus?: boolean
Expand Down
9 changes: 8 additions & 1 deletion src/composables/useFeatureFlags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ export enum ServerFeatureFlag {
CONSOLIDATED_BILLING_ENABLED = 'consolidated_billing_enabled',
BILLING_CONTROL_ENABLED = 'billing_control_enabled',
FREE_TIER_JOB_ALLOWANCE_ENABLED = 'free_tier_job_allowance_enabled',
SIGNUP_TURNSTILE = 'signup_turnstile'
SIGNUP_TURNSTILE = 'signup_turnstile',
SUPPORTS_MODEL_TYPE_TAGS = 'supports_model_type_tags'
}

/**
Expand Down Expand Up @@ -236,6 +237,12 @@ export function useFeatureFlags() {
remoteConfig.value.signup_turnstile,
'off'
)
},
get supportsModelTypeTags() {
return api.getServerFeature(
ServerFeatureFlag.SUPPORTS_MODEL_TYPE_TAGS,
false
)
}
})

Expand Down
1 change: 1 addition & 0 deletions src/locales/en/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -3446,6 +3446,7 @@
"processingModelDescription": "You can close this dialog. The download will continue in the background.",
"providerCivitai": "Civitai",
"providerHuggingFace": "Hugging Face",
"searchModels": "Search models",
"selectFrameworks": "Select Frameworks",
"selectModelType": "Select model type",
"selectProjects": "Select Projects",
Expand Down
30 changes: 30 additions & 0 deletions src/platform/assets/components/AssetBrowserModal.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,20 @@ import { useAssetsStore } from '@/stores/assetsStore'

const mockAssetsByKey = vi.hoisted(() => new Map<string, AssetItem[]>())
const mockLoadingByKey = vi.hoisted(() => new Map<string, boolean>())
const mockSupportsModelTypeTags = vi.hoisted(() => ({ value: false }))

vi.mock('@/composables/useFeatureFlags', () => ({
useFeatureFlags: () => ({
flags: {
get supportsModelTypeTags() {
return mockSupportsModelTypeTags.value
},
get modelUploadButtonEnabled() {
return false
}
}
})
}))

vi.mock('@/i18n', () => ({
t: (key: string, params?: Record<string, string>) =>
Expand Down Expand Up @@ -226,6 +240,7 @@ describe('AssetBrowserModal', () => {
vi.resetAllMocks()
mockAssetsByKey.clear()
mockLoadingByKey.clear()
mockSupportsModelTypeTags.value = false
})

describe('Integration with useAssetBrowser', () => {
Expand Down Expand Up @@ -432,5 +447,20 @@ describe('AssetBrowserModal', () => {
'assetBrowser.allCategory:{"category":"Checkpoints"}'
)
})

it('strips the model_type: prefix from the title when the flag is on', async () => {
mockSupportsModelTypeTags.value = true
const assets = [
createTestAsset('asset1', 'Model A', 'model_type:checkpoints')
]
mockAssetsByKey.set('CheckpointLoaderSimple', assets)

renderModal({ nodeType: 'CheckpointLoaderSimple' })
await flushPromises()

expect(screen.getByTestId('modal-title').textContent).toBe(
'assetBrowser.allCategory:{"category":"Checkpoints"}'
)
})
})
})
19 changes: 18 additions & 1 deletion src/platform/assets/components/AssetBrowserModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,15 @@
v-model="searchQuery"
:autofocus="true"
size="lg"
:aria-label="$t('assetBrowser.searchModels')"
:placeholder="$t('g.searchPlaceholder', { subject: '' })"
class="max-w-lg flex-1"
/>
<Button
v-if="isUploadButtonEnabled"
variant="primary"
:size="breakpoints.md ? 'lg' : 'icon'"
:aria-label="$t('assetBrowser.uploadModel')"
data-attr="upload-model-button"
@click="showUploadDialog"
>
Expand Down Expand Up @@ -100,6 +102,7 @@ import SearchInput from '@/components/ui/search-input/SearchInput.vue'
import Button from '@/components/ui/button/Button.vue'
import BaseModalLayout from '@/components/widget/layout/BaseModalLayout.vue'
import LeftSidePanel from '@/components/widget/panel/LeftSidePanel.vue'
import { useFeatureFlags } from '@/composables/useFeatureFlags'
import { usePrimeVueOverlayChildStyle } from '@/composables/usePopoverSizing'
import AssetFilterBar from '@/platform/assets/components/AssetFilterBar.vue'
import AssetGrid from '@/platform/assets/components/AssetGrid.vue'
Expand All @@ -109,12 +112,14 @@ import { useAssetBrowser } from '@/platform/assets/composables/useAssetBrowser'
import { useModelTypes } from '@/platform/assets/composables/useModelTypes'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: (non-blocking) two accessibility gaps in this file (pre-existing, but newly exercised by the upload and search paths):

1. Upload button -- no accessible name in icon mode: below 880 px the button renders icon-only; the label span is CSS-hidden with no aria-label fallback. Violates WCAG 2.1 SC 4.1.2. Fix: add :aria-label="$t('assetBrowser.uploadModel')" to the Button.

2. SearchInput -- no accessible name: SearchInput does not forward aria-label to its inner input, and placeholder text alone does not satisfy SC 4.1.2. Fix: add an aria-label prop to SearchInput forwarded to the input, or wrap with a visually-hidden label.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both valid and pre-existing (this PR just newly exercises the upload and search paths). Taking them as a follow-up rather than widening this PR's scope, the fixes are small (aria-label on the icon-mode upload button, and forwarding aria-label through SearchInput) but they touch shared components beyond the model_type grouping this PR is about.

Posted by Claude Code on Simon's behalf.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Simon. Flagging our standard here: we're not deferring review items out of the PR that surfaces them — an "address later" without a tracked, linked owner is how these silently rot, and both of these are small, self-contained fixes. Let's land them in this PR rather than as an unbacked follow-up.

Concrete fix (both are additive, no behavior change to the grouping this PR is about):

  1. Upload button (icon mode): add :aria-label="$t('assetBrowser.uploadModel')" to the Button so it has an accessible name below 880px.
  2. SearchInput: add an aria-label prop forwarded to the inner input (or wrap with a visually-hidden label). Placeholder text alone does not satisfy WCAG 2.1 SC 4.1.2.

If touching the shared SearchInput genuinely can't ride here, then this thread stays open with a linked issue and an owner before merge — not resolved as "follow-up". Keeping it open.

import { useModelUpload } from '@/platform/assets/composables/useModelUpload'
import type { AssetItem } from '@/platform/assets/schemas/assetSchema'
import { getPrimaryCategoryTag } from '@/platform/assets/utils/assetMetadataUtils'
import { formatCategoryLabel } from '@/platform/assets/utils/categoryLabel'
import { useAssetsStore } from '@/stores/assetsStore'
import { useModelToNodeStore } from '@/stores/modelToNodeStore'
import { OnCloseKey } from '@/types/widgetTypes'

const { t } = useI18n()
const { flags } = useFeatureFlags()
const assetStore = useAssetsStore()
const modelToNodeStore = useModelToNodeStore()
const breakpoints = useBreakpoints(breakpointsTailwind)
Expand Down Expand Up @@ -191,9 +196,21 @@ const focusedAsset = ref<AssetDisplayItem | null>(null)
const isRightPanelOpen = ref(false)

const primaryCategoryTag = computed(() => {
const modelTypeMode = flags.supportsModelTypeTags
// A node-typed picker is FOR a category; title off that category rather
// than guessing from the first asset, whose first model_type value may be
// a different category it shares a root with.
Comment thread
christian-byrne marked this conversation as resolved.
Resolved
if (modelTypeMode && props.nodeType) {
const mapped = modelToNodeStore.getCategoryForNodeType(props.nodeType)
if (mapped) return mapped
}

const assets = fetchedAssets.value ?? []
// Covered assets title off the model_type value they group under (so title
// and grouping cannot diverge); uncovered assets keep the legacy verbatim
// first tag.
const tagFromAssets = assets
.map((asset) => asset.tags?.find((tag) => tag !== 'models'))
.map((asset) => getPrimaryCategoryTag(asset, modelTypeMode))
.find((tag): tag is string => typeof tag === 'string' && tag.length > 0)

if (tagFromAssets) return tagFromAssets
Expand Down
59 changes: 59 additions & 0 deletions src/platform/assets/composables/useAssetBrowser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,22 @@ vi.mock('@/i18n', () => ({
d: (date: Date) => date.toLocaleDateString()
}))

const mockSupportsModelTypeTags = vi.hoisted(() => ({ value: false }))
vi.mock('@/composables/useFeatureFlags', () => ({
useFeatureFlags: () => ({
flags: {
get supportsModelTypeTags() {
return mockSupportsModelTypeTags.value
}
}
})
}))

describe('useAssetBrowser', () => {
beforeEach(() => {
setActivePinia(createPinia())
vi.restoreAllMocks()
mockSupportsModelTypeTags.value = false
})

// Test fixtures - minimal data focused on functionality being tested
Expand Down Expand Up @@ -138,6 +150,25 @@ describe('useAssetBrowser', () => {
})
})

it('strips the model_type: prefix from the badge when the flag is on', () => {
mockSupportsModelTypeTags.value = true
const apiAsset = createApiAsset({
tags: ['models', 'model_type:checkpoints', 'sdxl']
})

const { filteredAssets } = useAssetBrowser(ref([apiAsset]))
const result = filteredAssets.value[0]

expect(result.badges).toContainEqual({
label: 'checkpoints',
type: 'type'
})
expect(result.badges).not.toContainEqual({
label: 'model_type:checkpoints',
type: 'type'
})
})

it('handles tags with multiple slashes in badges', () => {
const apiAsset = createApiAsset({
tags: ['models', 'checkpoint/subfolder/model-name']
Expand Down Expand Up @@ -668,6 +699,34 @@ describe('useAssetBrowser', () => {
])
})

it('groups by model_type:* value and ignores other tags when the flag is on', () => {
mockSupportsModelTypeTags.value = true
const assets = [
createApiAsset({ tags: ['models', 'model_type:checkpoints', 'sdxl'] }),
createApiAsset({ tags: ['models', 'model_type:LLM'] })
]

const { navItems } = useAssetBrowser(ref(assets))

const typeGroup = navItems.value[2] as { items: { id: string }[] }
expect(typeGroup.items.map((i) => i.id)).toEqual(['LLM', 'checkpoints'])
})

it('ignores model_type: and groups by bare tags when the flag is off', () => {
const assets = [
createApiAsset({ tags: ['models', 'model_type:checkpoints'] }),
createApiAsset({ tags: ['models', 'model_type:LLM'] })
]

const { navItems } = useAssetBrowser(ref(assets))

const typeGroup = navItems.value[2] as { items: { id: string }[] }
expect(typeGroup.items.map((i) => i.id)).toEqual([
'model_type:LLM',
'model_type:checkpoints'
])
})

it('handles assets with no category tag', () => {
const assets = [
createApiAsset({ tags: ['models'] }), // No second tag
Expand Down
53 changes: 32 additions & 21 deletions src/platform/assets/composables/useAssetBrowser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@ import {
} from '@/platform/assets/utils/assetFilterUtils'
import {
getAssetBaseModels,
getAssetFilename
getAssetCategories,
getAssetFilename,
getAssetTypeBadges
} from '@/platform/assets/utils/assetMetadataUtils'
import { MODELS_TAG } from '@/platform/assets/services/assetService'
import { sortAssets } from '@/platform/assets/utils/assetSortUtils'
import { useFeatureFlags } from '@/composables/useFeatureFlags'
import { useAssetDownloadStore } from '@/stores/assetDownloadStore'
import type { NavGroupData, NavItemData } from '@/types/navTypes'

Expand All @@ -43,18 +46,19 @@ export interface AssetDisplayItem extends AssetItem {
}
}

const displayItemCache = new WeakMap<AssetItem, AssetDisplayItem>()
const displayItemCache = new WeakMap<
AssetItem,
{ modelTypeMode: boolean; item: AssetDisplayItem }
>()

function buildDisplayItem(asset: AssetItem): AssetDisplayItem {
function buildDisplayItem(
asset: AssetItem,
modelTypeMode: boolean
): AssetDisplayItem {
const badges: AssetBadge[] = []

const typeTag = asset.tags.find((tag) => tag !== 'models')
if (typeTag) {
const badgeLabel = typeTag.includes('/')
? typeTag.substring(typeTag.indexOf('/') + 1)
: typeTag

badges.push({ label: badgeLabel, type: 'type' })
for (const typeBadge of getAssetTypeBadges(asset, modelTypeMode)) {
badges.push({ label: typeBadge, type: 'type' })
}

for (const model of getAssetBaseModels(asset)) {
Expand All @@ -75,12 +79,15 @@ function buildDisplayItem(asset: AssetItem): AssetDisplayItem {
}
}

function transformAssetForDisplay(asset: AssetItem): AssetDisplayItem {
function transformAssetForDisplay(
asset: AssetItem,
modelTypeMode: boolean
): AssetDisplayItem {
const cached = displayItemCache.get(asset)
if (cached) return cached
const built = buildDisplayItem(asset)
displayItemCache.set(asset, built)
return built
if (cached && cached.modelTypeMode === modelTypeMode) return cached.item
const item = buildDisplayItem(asset, modelTypeMode)
displayItemCache.set(asset, { modelTypeMode, item })
return item
}

/**
Expand All @@ -93,6 +100,7 @@ export function useAssetBrowser(
const assets = computed<AssetItem[]>(() => assetsSource.value ?? [])
const assetDownloadStore = useAssetDownloadStore()
const { sessionDownloadCount } = storeToRefs(assetDownloadStore)
const { flags } = useFeatureFlags()

// State
const searchQuery = ref('')
Expand Down Expand Up @@ -122,12 +130,10 @@ export function useAssetBrowser(
})

const typeCategories = computed<NavItemData[]>(() => {
const modelTypeMode = flags.supportsModelTypeTags
const categories = assets.value
.filter((asset) => asset.tags.includes(MODELS_TAG))
.flatMap((asset) =>
asset.tags.filter((tag) => tag !== MODELS_TAG && tag.length > 0)
)
.map((tag) => tag.split('/')[0])
.flatMap((asset) => getAssetCategories(asset, modelTypeMode))

return Array.from(new Set(categories))
.sort()
Comment thread
christian-byrne marked this conversation as resolved.
Resolved
Expand Down Expand Up @@ -191,7 +197,9 @@ export function useAssetBrowser(

// Category-filtered assets for filter options (before search/format/base model filters)
const categoryFilteredAssets = computed(() => {
return assets.value.filter(filterByCategory(selectedCategory.value))
return assets.value.filter(
filterByCategory(selectedCategory.value, flags.supportsModelTypeTags)
)
})

const { availableFileFormats, availableBaseModels } = useAssetFilterOptions(
Expand Down Expand Up @@ -248,7 +256,10 @@ export function useAssetBrowser(
const sortedAssets = sortAssets(filtered, filters.value.sortBy)

// Transform to display format
return sortedAssets.map(transformAssetForDisplay)
const modelTypeMode = flags.supportsModelTypeTags
return sortedAssets.map((asset) =>
transformAssetForDisplay(asset, modelTypeMode)
)
})

function updateFilters(newFilters: AssetFilterState) {
Expand Down
16 changes: 16 additions & 0 deletions src/platform/assets/services/assetService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,22 @@ describe(assetService.getAssetModelFolders, () => {
expect(params.has('include_public')).toBe(false)
expect(params.get('exclude_tags')).toBe(MISSING_TAG)
})

it('excludes namespaced model_type: tags from folder names', async () => {
fetchApiMock.mockResolvedValueOnce(
buildAssetListResponse([
validAsset({
id: 'a',
tags: ['models', 'checkpoints', 'model_type:checkpoints']
}),
validAsset({ id: 'b', tags: ['models', 'model_type:loras'] })
])
)

const folders = await assetService.getAssetModelFolders()

expect(folders).toEqual([{ name: 'checkpoints', folders: [] }])
})
})

describe(assetService.updateAsset, () => {
Expand Down
Loading
Loading