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
				
			
		| 
						 | 
				
			
			@ -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