mirror of
https://github.com/open-webui/open-webui
synced 2024-11-16 05:24:02 +00:00
enh: prepend image filename with prompt
This commit is contained in:
parent
63b3076d64
commit
614c219010
@ -344,7 +344,7 @@
|
||||
{#each message.files as file}
|
||||
<div>
|
||||
{#if file.type === 'image'}
|
||||
<Image src={file.url} />
|
||||
<Image src={file.url} alt={message.content} />
|
||||
{/if}
|
||||
</div>
|
||||
{/each}
|
||||
|
@ -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 @@
|
||||
<button
|
||||
class=" p-5"
|
||||
on:click={() => {
|
||||
downloadImage(src, src.substring(src.lastIndexOf('/') + 1));
|
||||
downloadImage(src, src.substring(src.lastIndexOf('/') + 1), alt);
|
||||
}}
|
||||
>
|
||||
<svg
|
||||
|
Loading…
Reference in New Issue
Block a user