fix
This commit is contained in:
@@ -411,6 +411,45 @@ const undoImprovePrompt = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --- Reuse Logic ---
|
||||||
|
|
||||||
|
const reusePrompt = (gen) => {
|
||||||
|
if (gen.prompt) {
|
||||||
|
prompt.value = gen.prompt
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const reuseAsset = (gen) => {
|
||||||
|
if (gen.input_assets && Array.isArray(gen.input_assets)) {
|
||||||
|
selectedAssets.value = gen.input_assets.map(id => ({
|
||||||
|
id,
|
||||||
|
url: `/assets/${id}`
|
||||||
|
}))
|
||||||
|
} else {
|
||||||
|
console.warn("Input assets not found in history object:", gen)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const useResultAsReference = (gen) => {
|
||||||
|
if (gen.assets_list && gen.assets_list.length > 0) {
|
||||||
|
// 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,
|
||||||
|
// but constructing objects with IDs and URLs is usually enough for the selection preview.
|
||||||
|
const newAssets = gen.assets_list.map(id => ({
|
||||||
|
id,
|
||||||
|
url: `/assets/${id}`
|
||||||
|
}))
|
||||||
|
|
||||||
|
// Filter out duplicates
|
||||||
|
const existingIds = new Set(selectedAssets.value.map(a => a.id))
|
||||||
|
newAssets.forEach(asset => {
|
||||||
|
if (!existingIds.has(asset.id)) {
|
||||||
|
selectedAssets.value.push(asset)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const triggerFileUpload = () => {
|
const triggerFileUpload = () => {
|
||||||
if (fileInput.value) fileInput.value.click()
|
if (fileInput.value) fileInput.value.click()
|
||||||
}
|
}
|
||||||
@@ -862,7 +901,9 @@ const handleLogout = () => {
|
|||||||
<span class="capitalize"
|
<span class="capitalize"
|
||||||
:class="gen.status === 'done' ? 'text-green-500' : (gen.status === 'failed' ? 'text-red-500' : 'text-amber-500')">{{
|
:class="gen.status === 'done' ? 'text-green-500' : (gen.status === 'failed' ? 'text-red-500' : 'text-amber-500')">{{
|
||||||
gen.status }}</span>
|
gen.status }}</span>
|
||||||
<i v-if="gen.failed_reason" v-tooltip.right="gen.failed_reason" class="pi pi-exclamation-circle text-red-500" style="font-size: 12px;" />
|
<i v-if="gen.failed_reason" v-tooltip.right="gen.failed_reason"
|
||||||
|
class="pi pi-exclamation-circle text-red-500"
|
||||||
|
style="font-size: 12px;" />
|
||||||
</div>
|
</div>
|
||||||
<!-- Metrics in history -->
|
<!-- Metrics in history -->
|
||||||
<div v-if="gen.execution_time_seconds || gen.token_usage"
|
<div v-if="gen.execution_time_seconds || gen.token_usage"
|
||||||
@@ -876,6 +917,23 @@ const handleLogout = () => {
|
|||||||
<span v-if="gen.token_usage" title="Tokens"><i
|
<span v-if="gen.token_usage" title="Tokens"><i
|
||||||
class="pi pi-bolt mr-0.5"></i>{{ gen.token_usage }}</span>
|
class="pi pi-bolt mr-0.5"></i>{{ gen.token_usage }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Action Buttons -->
|
||||||
|
<div class="flex gap-2 mt-1 border-t border-white/5 pt-2 w-full">
|
||||||
|
<Button icon="pi pi-copy" label="Prompt" size="small" text
|
||||||
|
class="!text-[10px] !py-0.5 !px-1.5 text-slate-400 hover:bg-white/5 flex-1"
|
||||||
|
@click.stop="reusePrompt(gen)"
|
||||||
|
v-tooltip.bottom="'Use this prompt'" />
|
||||||
|
<Button icon="pi pi-images" label="Asset" size="small" text
|
||||||
|
class="!text-[10px] !py-0.5 !px-1.5 text-slate-400 hover:bg-white/5 flex-1"
|
||||||
|
@click.stop="reuseAsset(gen)"
|
||||||
|
v-tooltip.bottom="'Use original assets'" />
|
||||||
|
<Button icon="pi pi-reply" label="Result" size="small" text
|
||||||
|
class="!text-[10px] !py-0.5 !px-1.5 text-slate-400 hover:bg-white/5 flex-1"
|
||||||
|
:disabled="gen.status !== 'done' || !gen.assets_list?.length"
|
||||||
|
@click.stop="useResultAsReference(gen)"
|
||||||
|
v-tooltip.bottom="'Use result as reference'" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user