mirror of
https://github.com/open-webui/open-webui
synced 2025-02-20 12:00:22 +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}
|
{#each message.files as file}
|
||||||
<div>
|
<div>
|
||||||
{#if file.type === 'image'}
|
{#if file.type === 'image'}
|
||||||
<Image src={file.url} />
|
<Image src={file.url} alt={message.content} />
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
|
@ -9,14 +9,14 @@
|
|||||||
|
|
||||||
let previewElement = null;
|
let previewElement = null;
|
||||||
|
|
||||||
const downloadImage = (url, filename) => {
|
const downloadImage = (url, filename, prefixName = '') => {
|
||||||
fetch(url)
|
fetch(url)
|
||||||
.then((response) => response.blob())
|
.then((response) => response.blob())
|
||||||
.then((blob) => {
|
.then((blob) => {
|
||||||
const objectUrl = window.URL.createObjectURL(blob);
|
const objectUrl = window.URL.createObjectURL(blob);
|
||||||
const link = document.createElement('a');
|
const link = document.createElement('a');
|
||||||
link.href = objectUrl;
|
link.href = objectUrl;
|
||||||
link.download = filename;
|
link.download = `${prefixName}${filename}`;
|
||||||
document.body.appendChild(link);
|
document.body.appendChild(link);
|
||||||
link.click();
|
link.click();
|
||||||
document.body.removeChild(link);
|
document.body.removeChild(link);
|
||||||
@ -87,7 +87,7 @@
|
|||||||
<button
|
<button
|
||||||
class=" p-5"
|
class=" p-5"
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
downloadImage(src, src.substring(src.lastIndexOf('/') + 1));
|
downloadImage(src, src.substring(src.lastIndexOf('/') + 1), alt);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<svg
|
<svg
|
||||||
|
Loading…
Reference in New Issue
Block a user