This commit is contained in:
xds
2026-02-06 18:50:21 +03:00
parent fb701911d7
commit 86646ff8e5
2 changed files with 63 additions and 45 deletions

View File

@@ -420,13 +420,22 @@ const reusePrompt = (gen) => {
} }
const reuseAsset = (gen) => { const reuseAsset = (gen) => {
if (gen.input_assets && Array.isArray(gen.input_assets)) { const assetIds = gen.assets_list || gen.input_assets || []
selectedAssets.value = gen.input_assets.map(id => ({
if (assetIds && assetIds.length > 0) {
selectedAssets.value = assetIds.map(id => {
// Check if we have it in characterAssets
const existing = characterAssets.value.find(a => a.id === id)
if (existing) return existing
return {
id, id,
url: `/assets/${id}` url: `/assets/${id}`,
})) name: 'Asset ' + id.substring(0, 6)
}
})
} else { } else {
console.warn("Input assets not found in history object:", gen) console.warn("No linked/input assets found in history object:", gen)
} }
} }

View File

@@ -383,17 +383,26 @@ const reuseAsset = (gen) => {
// Attempt to access input assets if available, otherwise warn or try to fetch. // Attempt to access input assets if available, otherwise warn or try to fetch.
// NOTE: In many systems, the input assets are stored in metadata. // NOTE: In many systems, the input assets are stored in metadata.
if (gen.input_assets && Array.isArray(gen.input_assets)) { const reuseAsset = (gen) => {
selectedAssets.value = gen.input_assets.map(id => ({ // Try to find input assets field from history object
// We check linked_assets or input_assets, and fallback to empty array if not found
const assetIds = gen.linked_assets || gen.input_assets || []
if (assetIds && assetIds.length > 0) {
selectedAssets.value = assetIds.map(id => {
// Check if we already have the full asset object loaded to get the name/type
const existing = allAssets.value.find(a => a.id === id)
if (existing) return existing
// Fallback: Construct object to display thumbnail
return {
id, id,
url: `/assets/${id}` // Construct URL url: `/assets/${id}`,
})) name: 'Asset ' + id.substring(0, 6) // Placeholder name
}
})
} else { } else {
// Fallback or todo: Backend might need to provide `input_assets` in history. console.warn("No linked/input assets found in history object:", gen)
// For now, let's toast or log.
console.warn("Input assets not found in history object:", gen)
// If the user meant the generated asset (the prompt is slightly ambiguous "associated asset" vs "result"),
// but point 3 is explicitly "use result".
} }
} }