From 614c21901057d16587df1f5bd956668aa5ce5322 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Wed, 18 Sep 2024 01:04:20 +0200 Subject: [PATCH] enh: prepend image filename with prompt --- src/lib/components/chat/Messages/ResponseMessage.svelte | 2 +- src/lib/components/common/ImagePreview.svelte | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/components/chat/Messages/ResponseMessage.svelte b/src/lib/components/chat/Messages/ResponseMessage.svelte index 9a03b0c4a..79c507a5a 100644 --- a/src/lib/components/chat/Messages/ResponseMessage.svelte +++ b/src/lib/components/chat/Messages/ResponseMessage.svelte @@ -344,7 +344,7 @@ {#each message.files as file}
{#if file.type === 'image'} - + {message.content} {/if}
{/each} diff --git a/src/lib/components/common/ImagePreview.svelte b/src/lib/components/common/ImagePreview.svelte index 956f0b492..8f20a32d7 100644 --- a/src/lib/components/common/ImagePreview.svelte +++ b/src/lib/components/common/ImagePreview.svelte @@ -9,14 +9,14 @@ let previewElement = null; - const downloadImage = (url, filename) => { + const downloadImage = (url, filename, prefixName = '') => { fetch(url) .then((response) => response.blob()) .then((blob) => { const objectUrl = window.URL.createObjectURL(blob); const link = document.createElement('a'); link.href = objectUrl; - link.download = filename; + link.download = `${prefixName}${filename}`; document.body.appendChild(link); link.click(); document.body.removeChild(link); @@ -87,7 +87,7 @@