From cd96b5147df878b174cb21396f177e859e66ede0 Mon Sep 17 00:00:00 2001 From: Jin Yi Date: Wed, 22 Oct 2025 11:35:50 +0900 Subject: [PATCH] feat: Add includePublic parameter to getAssetsByTag API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add optional includePublic parameter (defaults to true) to getAssetsByTag - Exclude public assets for media assets in sidebar by passing false - Use URLSearchParams for cleaner query string construction 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .../composables/useMediaAssets/useAssetsApi.ts | 2 +- src/platform/assets/services/assetService.ts | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/platform/assets/composables/useMediaAssets/useAssetsApi.ts b/src/platform/assets/composables/useMediaAssets/useAssetsApi.ts index 9e3036d03..77e408a6d 100644 --- a/src/platform/assets/composables/useMediaAssets/useAssetsApi.ts +++ b/src/platform/assets/composables/useMediaAssets/useAssetsApi.ts @@ -31,7 +31,7 @@ export function useAssetsApi() { try { // For input directory, just return assets without history if (directory === 'input') { - const assets = await assetService.getAssetsByTag(directory) + const assets = await assetService.getAssetsByTag(directory, false) // Process assets to truncate long filenames for display return assets.map((asset) => ({ ...asset, diff --git a/src/platform/assets/services/assetService.ts b/src/platform/assets/services/assetService.ts index 626a52d20..f0f8afdd1 100644 --- a/src/platform/assets/services/assetService.ts +++ b/src/platform/assets/services/assetService.ts @@ -190,11 +190,21 @@ function createAssetService() { * Gets assets filtered by a specific tag * * @param tag - The tag to filter by (e.g., 'models') + * @param includePublic - Whether to include public assets (default: true) * @returns Promise - Full asset objects filtered by tag, excluding missing assets */ - async function getAssetsByTag(tag: string): Promise { + async function getAssetsByTag( + tag: string, + includePublic: boolean = true + ): Promise { + const queryParams = new URLSearchParams({ + include_tags: tag, + limit: DEFAULT_LIMIT.toString(), + include_public: includePublic ? 'true' : 'false' + }) + const data = await handleAssetRequest( - `${ASSETS_ENDPOINT}?include_tags=${tag}&limit=${DEFAULT_LIMIT}`, + `${ASSETS_ENDPOINT}?${queryParams.toString()}`, `assets for tag ${tag}` )