forked from open-webui/open-webui
feat: comfyui integration
This commit is contained in:
parent
862c96fcef
commit
98624a406f
4 changed files with 315 additions and 8 deletions
|
@ -323,6 +323,7 @@
|
|||
class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
|
||||
bind:value={selectedModel}
|
||||
placeholder={$i18n.t('Select a model')}
|
||||
required
|
||||
>
|
||||
{#if !selectedModel}
|
||||
<option value="" disabled selected>{$i18n.t('Select a model')}</option>
|
||||
|
|
|
@ -2,6 +2,22 @@
|
|||
export let show = false;
|
||||
export let src = '';
|
||||
export let alt = '';
|
||||
|
||||
const downloadImage = (url, filename) => {
|
||||
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;
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
window.URL.revokeObjectURL(objectUrl);
|
||||
})
|
||||
.catch((error) => console.error('Error downloading image:', error));
|
||||
};
|
||||
</script>
|
||||
|
||||
{#if show}
|
||||
|
@ -35,10 +51,7 @@
|
|||
<button
|
||||
class=" p-5"
|
||||
on:click={() => {
|
||||
const a = document.createElement('a');
|
||||
a.href = src;
|
||||
a.download = 'Image.png';
|
||||
a.click();
|
||||
downloadImage(src, 'Image.png');
|
||||
}}
|
||||
>
|
||||
<svg
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue