From fe3690b6a98255bfd36f27cdf894b96a36d216ef Mon Sep 17 00:00:00 2001 From: Alexander Brown <448862+DrJKL@users.noreply.github.com> Date: Tue, 20 Jan 2026 13:29:56 -0800 Subject: [PATCH 1/3] feat: add session download tracking to assetDownloadStore --- src/stores/assetDownloadStore.ts | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/stores/assetDownloadStore.ts b/src/stores/assetDownloadStore.ts index 88818c31c42..054f28a775a 100644 --- a/src/stores/assetDownloadStore.ts +++ b/src/stores/assetDownloadStore.ts @@ -17,6 +17,7 @@ export interface AssetDownload { assetId?: string error?: string modelType?: string + acknowledged?: boolean } interface CompletedDownload { @@ -59,9 +60,29 @@ export const useAssetDownloadStore = defineStore('assetDownload', () => { (d) => d.status === 'completed' || d.status === 'failed' ) ) + const unacknowledgedDownloads = computed(() => + finishedDownloads.value.filter( + (d) => d.status === 'completed' && d.assetId && !d.acknowledged + ) + ) + const sessionDownloadCount = computed( + () => unacknowledgedDownloads.value.length + ) const hasActiveDownloads = computed(() => activeDownloads.value.length > 0) const hasDownloads = computed(() => downloads.value.size > 0) + function isDownloadedThisSession(assetId: string): boolean { + return unacknowledgedDownloads.value.some((d) => d.assetId === assetId) + } + + function acknowledgeAsset(assetId: string) { + for (const download of downloads.value.values()) { + if (download.assetId === assetId) { + download.acknowledged = true + } + } + } + function trackDownload(taskId: string, modelType: string, assetName: string) { if (downloads.value.has(taskId)) return @@ -172,7 +193,10 @@ export const useAssetDownloadStore = defineStore('assetDownload', () => { hasDownloads, downloadList, lastCompletedDownload, + sessionDownloadCount, trackDownload, - clearFinishedDownloads + clearFinishedDownloads, + isDownloadedThisSession, + acknowledgeAsset } }) From 0494cb615400522a78ad884119406bae83180e32 Mon Sep 17 00:00:00 2001 From: Alexander Brown <448862+DrJKL@users.noreply.github.com> Date: Tue, 20 Jan 2026 14:33:22 -0800 Subject: [PATCH 2/3] test: add session download tracking tests Amp-Thread-ID: https://ampcode.com/threads/T-019bdfa1-0746-72d8-b898-ca16ec54155f Co-authored-by: Amp --- src/stores/assetDownloadStore.test.ts | 76 +++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/src/stores/assetDownloadStore.test.ts b/src/stores/assetDownloadStore.test.ts index 5882c4b9adb..fd428c36eb9 100644 --- a/src/stores/assetDownloadStore.test.ts +++ b/src/stores/assetDownloadStore.test.ts @@ -236,4 +236,80 @@ describe('useAssetDownloadStore', () => { expect(store.finishedDownloads).toHaveLength(0) }) }) + + describe('session download tracking', () => { + it('counts unacknowledged completed downloads with asset IDs', () => { + const store = useAssetDownloadStore() + + dispatch( + createDownloadMessage({ + status: 'completed', + progress: 100, + asset_id: 'asset-456' + }) + ) + + expect(store.sessionDownloadCount).toBe(1) + }) + + it('does not count completed downloads without asset IDs', () => { + const store = useAssetDownloadStore() + + dispatch( + createDownloadMessage({ + status: 'completed', + progress: 100, + asset_id: undefined + }) + ) + + expect(store.sessionDownloadCount).toBe(0) + }) + + it('does not count failed downloads', () => { + const store = useAssetDownloadStore() + + dispatch( + createDownloadMessage({ + status: 'failed', + asset_id: 'asset-456' + }) + ) + + expect(store.sessionDownloadCount).toBe(0) + }) + + it('isDownloadedThisSession returns true for unacknowledged downloads', () => { + const store = useAssetDownloadStore() + + dispatch( + createDownloadMessage({ + status: 'completed', + progress: 100, + asset_id: 'asset-456' + }) + ) + + expect(store.isDownloadedThisSession('asset-456')).toBe(true) + expect(store.isDownloadedThisSession('other-asset')).toBe(false) + }) + + it('acknowledgeAsset decrements session count', () => { + const store = useAssetDownloadStore() + + dispatch( + createDownloadMessage({ + status: 'completed', + progress: 100, + asset_id: 'asset-456' + }) + ) + expect(store.sessionDownloadCount).toBe(1) + + store.acknowledgeAsset('asset-456') + + expect(store.sessionDownloadCount).toBe(0) + expect(store.isDownloadedThisSession('asset-456')).toBe(false) + }) + }) }) From f796c657eb3df631f7db0a6091148d276fbadf0d Mon Sep 17 00:00:00 2001 From: Alexander Brown <448862+DrJKL@users.noreply.github.com> Date: Wed, 21 Jan 2026 14:55:01 -0800 Subject: [PATCH 3/3] feat: integrate session download tracking with Asset Browser nav - Add 'Imported' nav item with badge showing session download count - Refactor useAssetBrowser to use selectedNavItem for nav selection - Add i18n keys for imported, byType, and emptyImported messages - Update tests for new nav-based ownership filtering Amp-Thread-ID: https://ampcode.com/threads/T-019be2a9-fcd7-703a-a2ca-26b30b837c7a Co-authored-by: Amp --- src/locales/en/main.json | 6 + .../assets/components/AssetBrowserModal.vue | 9 +- .../composables/useAssetBrowser.test.ts | 158 ++++++++++-------- .../assets/composables/useAssetBrowser.ts | 83 +++++++-- 4 files changed, 171 insertions(+), 85 deletions(-) diff --git a/src/locales/en/main.json b/src/locales/en/main.json index 749273d208f..75afcfd0702 100644 --- a/src/locales/en/main.json +++ b/src/locales/en/main.json @@ -2315,6 +2315,12 @@ "assetBrowser": { "allCategory": "All {category}", "allModels": "All Models", + "byType": "By type", + "emptyImported": { + "canImport": "No imported models yet. Click \"Import Model\" to add your own.", + "restricted": "Personal models are only available at Creator tier and above." + }, + "imported": "Imported", "assetCollection": "Asset collection", "assets": "Assets", "baseModels": "Base models", diff --git a/src/platform/assets/components/AssetBrowserModal.vue b/src/platform/assets/components/AssetBrowserModal.vue index b7db7494c3e..8344a807fe9 100644 --- a/src/platform/assets/components/AssetBrowserModal.vue +++ b/src/platform/assets/components/AssetBrowserModal.vue @@ -7,12 +7,12 @@ >