123
This commit is contained in:
@@ -367,11 +367,14 @@ const restoreGeneration = async (gen) => {
|
|||||||
// 4. Set Result if status is 'done'
|
// 4. Set Result if status is 'done'
|
||||||
if (gen.status === 'done') {
|
if (gen.status === 'done') {
|
||||||
const assets = characterAssets.value
|
const assets = characterAssets.value
|
||||||
if (gen.assets_list && gen.assets_list.length > 0) {
|
if (gen.result_list && gen.result_list.length > 0) {
|
||||||
selectedAssets.value = assets.filter(a => gen.assets_list.includes(a.id))
|
|
||||||
generatedResult.value = {
|
generatedResult.value = {
|
||||||
type: 'assets',
|
type: 'assets',
|
||||||
assets: selectedAssets.value,
|
assets: gen.result_list.map(id => ({
|
||||||
|
id,
|
||||||
|
url: `/assets/${id}`,
|
||||||
|
name: 'Generated Result'
|
||||||
|
})),
|
||||||
tech_prompt: gen.tech_prompt,
|
tech_prompt: gen.tech_prompt,
|
||||||
execution_time: gen.execution_time_seconds,
|
execution_time: gen.execution_time_seconds,
|
||||||
api_execution_time: gen.api_execution_time_seconds,
|
api_execution_time: gen.api_execution_time_seconds,
|
||||||
@@ -440,11 +443,11 @@ const reuseAsset = (gen) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const useResultAsReference = (gen) => {
|
const useResultAsReference = (gen) => {
|
||||||
if (gen.assets_list && gen.assets_list.length > 0) {
|
if (gen.result_list && gen.result_list.length > 0) {
|
||||||
// Appends the generated assets to the selection
|
// Appends the generated assets to the selection
|
||||||
// In this view, we might need to fetch full asset objects if we want to show thumbnails immediately,
|
// In this view, we might need to fetch full asset objects if we want to show thumbnails immediately,
|
||||||
// but constructing objects with IDs and URLs is usually enough for the selection preview.
|
// but constructing objects with IDs and URLs is usually enough for the selection preview.
|
||||||
const newAssets = gen.assets_list.map(id => ({
|
const newAssets = gen.result_list.map(id => ({
|
||||||
id,
|
id,
|
||||||
url: `/assets/${id}`
|
url: `/assets/${id}`
|
||||||
}))
|
}))
|
||||||
@@ -884,10 +887,10 @@ const handleLogout = () => {
|
|||||||
@click="restoreGeneration(gen)"
|
@click="restoreGeneration(gen)"
|
||||||
class="glass-panel p-2 rounded-lg border border-white/5 flex gap-3 items-start hover:bg-white/10 cursor-pointer transition-colors group">
|
class="glass-panel p-2 rounded-lg border border-white/5 flex gap-3 items-start hover:bg-white/10 cursor-pointer transition-colors group">
|
||||||
<div class="w-12 h-12 rounded bg-black/40 border border-white/10 flex-shrink-0 mt-0.5 relative z-0"
|
<div class="w-12 h-12 rounded bg-black/40 border border-white/10 flex-shrink-0 mt-0.5 relative z-0"
|
||||||
@mouseenter="onThumbnailEnter($event, API_URL + '/assets/' + gen.assets_list[0] + '?thumbnail=true')"
|
@mouseenter="onThumbnailEnter($event, API_URL + '/assets/' + gen.result_list[0] + '?thumbnail=true')"
|
||||||
@mouseleave="onThumbnailLeave">
|
@mouseleave="onThumbnailLeave">
|
||||||
<img v-if="gen.assets_list && gen.assets_list.length > 0"
|
<img v-if="gen.result_list && gen.result_list.length > 0"
|
||||||
:src="API_URL + '/assets/' + gen.assets_list[0] + '?thumbnail=true'"
|
:src="API_URL + '/assets/' + gen.result_list[0] + '?thumbnail=true'"
|
||||||
class="w-full h-full object-cover rounded opacity-100" />
|
class="w-full h-full object-cover rounded opacity-100" />
|
||||||
<div v-else
|
<div v-else
|
||||||
class="w-full h-full flex items-center justify-center text-slate-700 overflow-hidden rounded">
|
class="w-full h-full flex items-center justify-center text-slate-700 overflow-hidden rounded">
|
||||||
|
|||||||
@@ -239,7 +239,7 @@ const pollStatus = async (id) => {
|
|||||||
generationSuccess.value = true
|
generationSuccess.value = true
|
||||||
|
|
||||||
// For global generation, we might need to fetch the assets by ID if returned
|
// For global generation, we might need to fetch the assets by ID if returned
|
||||||
if (response.assets_list && response.assets_list.length > 0) {
|
if (response.result_list && response.result_list.length > 0) {
|
||||||
// Since we don't have a direct "getAssetsByIds" batch endpoint easily available in dataService yet,
|
// Since we don't have a direct "getAssetsByIds" batch endpoint easily available in dataService yet,
|
||||||
// we might just fetch the first one or construct objects if URL is provided.
|
// we might just fetch the first one or construct objects if URL is provided.
|
||||||
// Assuming response includes asset details or just IDs.
|
// Assuming response includes asset details or just IDs.
|
||||||
@@ -287,18 +287,18 @@ const restoreGeneration = async (gen) => {
|
|||||||
const foundAspect = aspectRatioOptions.value.find(opt => opt.key === gen.aspect_ratio)
|
const foundAspect = aspectRatioOptions.value.find(opt => opt.key === gen.aspect_ratio)
|
||||||
if (foundAspect) aspectRatio.value = foundAspect
|
if (foundAspect) aspectRatio.value = foundAspect
|
||||||
|
|
||||||
if (gen.status === 'done' && gen.assets_list && gen.assets_list.length > 0) {
|
if (gen.status === 'done' && gen.result_list && gen.result_list.length > 0) {
|
||||||
// We need to fetch details or just display the image
|
// We need to fetch details or just display the image
|
||||||
// history list usually has the main image preview
|
// history list usually has the main image preview
|
||||||
generatedResult.value = {
|
generatedResult.value = {
|
||||||
type: 'assets',
|
type: 'assets',
|
||||||
// Mocking asset object structure from history usage in DetailView
|
// Mocking asset object structure from history usage in DetailView
|
||||||
assets: gen.assets_list.map(id => ({
|
assets: gen.result_list.map(id => ({
|
||||||
id,
|
id,
|
||||||
url: `/assets/${id}`, // This might need adjustment based on how API serves files
|
url: `/assets/${id}`, // This might need adjustment based on how API serves files
|
||||||
// Ideally history API should return full asset objects or URLs.
|
// Ideally history API should return full asset objects or URLs.
|
||||||
// If not, we rely on the implementation in CharacterDetailView:
|
// If not, we rely on the implementation in CharacterDetailView:
|
||||||
// :src="API_URL + '/assets/' + gen.assets_list[0]"
|
// :src="API_URL + '/assets/' + gen.result_list[0]"
|
||||||
// So let's construct it similarly
|
// So let's construct it similarly
|
||||||
})),
|
})),
|
||||||
tech_prompt: gen.tech_prompt,
|
tech_prompt: gen.tech_prompt,
|
||||||
@@ -363,9 +363,8 @@ const reusePrompt = (gen) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const reuseAsset = (gen) => {
|
const reuseAsset = (gen) => {
|
||||||
// Try to find input assets field from history object
|
// Assets used as INPUT are now explicitly in assets_list (per user request)
|
||||||
// We check linked_assets or input_assets, and fallback to empty array if not found
|
const assetIds = gen.assets_list || []
|
||||||
const assetIds = gen.assets_list || gen.input_assets || []
|
|
||||||
|
|
||||||
if (assetIds && assetIds.length > 0) {
|
if (assetIds && assetIds.length > 0) {
|
||||||
selectedAssets.value = assetIds.map(id => {
|
selectedAssets.value = assetIds.map(id => {
|
||||||
@@ -386,9 +385,10 @@ const reuseAsset = (gen) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const useResultAsReference = (gen) => {
|
const useResultAsReference = (gen) => {
|
||||||
if (gen.assets_list && gen.assets_list.length > 0) {
|
// Result (output) is now in result_list
|
||||||
|
if (gen.result_list && gen.result_list.length > 0) {
|
||||||
// Appends the generated assets to the selection
|
// Appends the generated assets to the selection
|
||||||
const newAssets = gen.assets_list.map(id => ({
|
const newAssets = gen.result_list.map(id => ({
|
||||||
id,
|
id,
|
||||||
url: `/assets/${id}`
|
url: `/assets/${id}`
|
||||||
}))
|
}))
|
||||||
@@ -697,8 +697,8 @@ onMounted(() => {
|
|||||||
<div class="flex gap-3 items-start cursor-pointer" @click="restoreGeneration(gen)">
|
<div class="flex gap-3 items-start cursor-pointer" @click="restoreGeneration(gen)">
|
||||||
<div
|
<div
|
||||||
class="w-12 h-12 rounded bg-black/40 border border-white/10 overflow-hidden flex-shrink-0 mt-0.5">
|
class="w-12 h-12 rounded bg-black/40 border border-white/10 overflow-hidden flex-shrink-0 mt-0.5">
|
||||||
<img v-if="gen.assets_list && gen.assets_list.length > 0"
|
<img v-if="gen.result_list && gen.result_list.length > 0"
|
||||||
:src="API_URL + '/assets/' + gen.assets_list[0] + '?thumbnail=true'"
|
:src="API_URL + '/assets/' + gen.result_list[0] + '?thumbnail=true'"
|
||||||
class="w-full h-full object-cover" />
|
class="w-full h-full object-cover" />
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-1 min-w-0">
|
<div class="flex-1 min-w-0">
|
||||||
|
|||||||
Reference in New Issue
Block a user