Skip to content

Commit 1751cc0

Browse files
committed
refactor: Simplify asset ID handling and remove UUID extraction, Access promptId directly from metadata instead of encoding/parsing it in IDs
1 parent a2c62d9 commit 1751cc0

File tree

5 files changed

+7
-198
lines changed

5 files changed

+7
-198
lines changed

src/components/sidebar/tabs/AssetsSidebarTab.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ const enterFolderView = (asset: AssetItem) => {
251251
folderExecutionTime.value = executionTimeInSeconds
252252
253253
folderAssets.value = allOutputs.map((output) => ({
254-
id: `${promptId}-${output.nodeId}-${output.filename}`,
254+
id: `${output.nodeId}-${output.filename}`,
255255
name: output.filename,
256256
size: 0,
257257
created_at: asset.created_at,

src/platform/assets/composables/media/assetMappers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ export function mapTaskOutputToAssetItem(
3636
}
3737

3838
return {
39-
id: `${taskItem.promptId}-${output.nodeId}-${output.filename}`,
39+
id: taskItem.promptId,
4040
name: output.filename,
41-
size: 0, // Size not available from history API
41+
size: 0,
4242
created_at: taskItem.executionStartTimestamp
4343
? new Date(taskItem.executionStartTimestamp).toISOString()
4444
: new Date().toISOString(),

src/platform/assets/composables/useMediaAssetActions.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { inject } from 'vue'
55
import { downloadFile } from '@/base/common/downloadUtil'
66
import { t } from '@/i18n'
77
import { api } from '@/scripts/api'
8-
import { extractPromptIdFromAssetId } from '@/utils/uuidUtil'
8+
import { getOutputAssetMetadata } from '../schemas/assetMetadataSchema'
99

1010
import type { AssetMeta } from '../schemas/mediaAssetSchema'
1111
import { MediaAssetKey } from '../schemas/mediaAssetSchema'
@@ -59,7 +59,9 @@ export function useMediaAssetActions() {
5959
const asset = mediaContext?.asset.value
6060
if (!asset) return
6161

62-
const promptId = extractPromptIdFromAssetId(asset.id)
62+
// Get promptId from metadata instead of parsing the ID string
63+
const metadata = getOutputAssetMetadata(asset.user_metadata)
64+
const promptId = metadata?.promptId
6365

6466
if (!promptId) {
6567
toast.add({

src/utils/uuidUtil.ts

Lines changed: 0 additions & 38 deletions
This file was deleted.

tests-ui/tests/utils/uuidUtil.test.ts

Lines changed: 0 additions & 155 deletions
This file was deleted.

0 commit comments

Comments
 (0)