diff --git a/src/views/ImageGenerationView.vue b/src/views/ImageGenerationView.vue
index 1b245ef..c3358df 100644
--- a/src/views/ImageGenerationView.vue
+++ b/src/views/ImageGenerationView.vue
@@ -350,6 +350,71 @@ const undoImprovePrompt = () => {
}
}
+const clearPrompt = () => {
+ prompt.value = ''
+}
+
+// --- Reuse Logic ---
+
+const reusePrompt = (gen) => {
+ if (gen.prompt) {
+ prompt.value = gen.prompt
+ }
+}
+
+const reuseAsset = (gen) => {
+ // Assuming 'assets_list' from history are the generated assets,
+ // we need to check if there is a field for INPUT assets.
+ // If we want to reuse the assets that were USED to generate this image:
+ // We need to look for that field.
+ // IF the user means "Reuse the ASSET resulting from the generation", that is 'useResultAsReference'.
+ // IF the user means "Reuse the ASSETS that were INPUTS", we need to find them.
+ // Let's assume 'linked_assets' might be available or we use 'assets_list' if it's input-based?
+ // Based on `handleGenerate`, payload uses `assets_list` as INPUT IDs.
+ // The history response `assets_list` usually contains the IDs of the GENERATED assets (outputs).
+ // Let's check `gen` structure. Since I cannot see the full backend response structure here,
+ // I will assume there might be `input_assets` or similar.
+ // If not available, we might fallback or if the user meant "Reuse this generated image as an asset".
+
+ // Waiting for clarification on "Reuse Asset" (input) vs "Use Result" (output).
+ // The prompt says: "2) reuse asset (binds associated asset)", "3) use result (binds result as reference)".
+ // So (2) implies INPUT assets.
+
+ // Attempt to access input assets if available, otherwise warn or try to fetch.
+ // NOTE: In many systems, the input assets are stored in metadata.
+
+ if (gen.input_assets && Array.isArray(gen.input_assets)) {
+ selectedAssets.value = gen.input_assets.map(id => ({
+ id,
+ url: `/assets/${id}` // Construct URL
+ }))
+ } else {
+ // Fallback or todo: Backend might need to provide `input_assets` in history.
+ // 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".
+ }
+}
+
+const useResultAsReference = (gen) => {
+ if (gen.assets_list && gen.assets_list.length > 0) {
+ // Appends the generated assets to the selection
+ 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)
+ }
+ })
+ }
+}
+
// --- Utils ---
const copyToClipboard = () => {
@@ -459,10 +524,13 @@ onMounted(() => {
-
+
+