From 4ae2e1766ebda6169b6ad89a4a5f96af3687dad1 Mon Sep 17 00:00:00 2001 From: jtydhr88 Date: Wed, 31 May 2023 13:55:51 -0400 Subject: [PATCH] webui plugin: check empty str --- packages/stablestudio-plugin-webui/src/Utilities.ts | 2 +- packages/stablestudio-plugin-webui/src/index.ts | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/stablestudio-plugin-webui/src/Utilities.ts b/packages/stablestudio-plugin-webui/src/Utilities.ts index 88e163b5..2f4f1d39 100644 --- a/packages/stablestudio-plugin-webui/src/Utilities.ts +++ b/packages/stablestudio-plugin-webui/src/Utilities.ts @@ -41,7 +41,7 @@ export async function setOptions(baseUrl: string | undefined, options: any) { } export async function getImageInfo( - baseUrl: string | undefined, + baseUrl: string | null, base64image: any ) { const imageInfoResponse = await fetch(`${baseUrl}/sdapi/v1/png-info`, { diff --git a/packages/stablestudio-plugin-webui/src/index.ts b/packages/stablestudio-plugin-webui/src/index.ts index e115482a..6a4d8850 100644 --- a/packages/stablestudio-plugin-webui/src/index.ts +++ b/packages/stablestudio-plugin-webui/src/index.ts @@ -94,7 +94,6 @@ export const createPlugin = StableStudio.createPlugin<{ | "getStableDiffusionDefaultInput" | "getStableDiffusionExistingImages" > => { - webuiHostUrl = webuiHostUrl ?? "http://127.0.0.1:7861"; return { createStableDiffusionImages: async (options) => { @@ -244,8 +243,11 @@ export const createPlugin = StableStudio.createPlugin<{ }; }; - const webuiHostUrl = - localStorage.getItem("webui-host-url") ?? "http://127.0.0.1:7861"; + let webuiHostUrl = localStorage.getItem("webui-host-url"); + + if (!webuiHostUrl || webuiHostUrl === "") { + webuiHostUrl = "http://127.0.0.1:7861"; + } return { ...webuiLoad(webuiHostUrl),