mirror of
https://github.com/open-webui/open-webui.git
synced 2026-11-12 09:01:18 +00:00
fix: resolve generated image urls against the api base url in the Images playground
This commit is contained in:
parent
29541cbb52
commit
84a253ec68
1 changed files with 5 additions and 2 deletions
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
import { user } from '$lib/stores';
|
||||
import { imageGenerations, imageEdits } from '$lib/apis/images';
|
||||
import { WEBUI_BASE_URL } from '$lib/constants';
|
||||
|
||||
import Spinner from '$lib/components/common/Spinner.svelte';
|
||||
|
||||
|
|
@ -97,6 +98,8 @@
|
|||
}
|
||||
};
|
||||
|
||||
const resolveImageUrl = (url: string) => (url.startsWith('/') ? `${WEBUI_BASE_URL}${url}` : url);
|
||||
|
||||
const downloadImage = async (url: string, index: number) => {
|
||||
try {
|
||||
const response = await fetch(url);
|
||||
|
|
@ -136,10 +139,10 @@
|
|||
{#each generatedImages as image, index}
|
||||
<button
|
||||
class="relative group cursor-pointer"
|
||||
on:click={() => downloadImage(image.url, index)}
|
||||
on:click={() => downloadImage(resolveImageUrl(image.url), index)}
|
||||
>
|
||||
<img
|
||||
src={image.url}
|
||||
src={resolveImageUrl(image.url)}
|
||||
alt=""
|
||||
class="w-full aspect-square object-cover rounded-lg border border-gray-100/30 dark:border-gray-850/30"
|
||||
/>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue