Skip to content

Commit 8951fd7

Browse files
committed
Wording tweaks
1 parent 562685e commit 8951fd7

2 files changed

Lines changed: 35 additions & 24 deletions

File tree

packages/stablestudio-plugin-webui/src/utils.ts renamed to packages/stablestudio-plugin-webui/src/Utilities.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,16 @@ export async function setOptions(baseUrl: string | undefined, options: any) {
4040
return await optionsResponse.json();
4141
}
4242

43-
export async function getImageInfo(baseUrl: string | undefined, base64image: any) {
43+
export async function getImageInfo(
44+
baseUrl: string | undefined,
45+
base64image: any
46+
) {
4447
const imageInfoResponse = await fetch(`${baseUrl}/sdapi/v1/png-info`, {
4548
method: "POST",
4649
headers: {
4750
"Content-Type": "application/json",
4851
},
49-
body: JSON.stringify({image:base64image}),
52+
body: JSON.stringify({ image: base64image }),
5053
});
5154

5255
const imageInfoJson = await imageInfoResponse.json();
@@ -64,12 +67,12 @@ export async function getImageInfo(baseUrl: string | undefined, base64image: any
6467
let detailIndex = 1;
6568

6669
if (info.length === 3) {
67-
data.nagtivePrompt = info[1].split(":")[1].trim()
70+
data.nagtivePrompt = info[1].split(":")[1].trim();
6871

6972
detailIndex = 2;
7073
}
7174

72-
const details = info[detailIndex].split(",")
75+
const details = info[detailIndex].split(",");
7376

7477
details.map((detail: any) => {
7578
const detailInfo = detail.trim().split(":");

packages/stablestudio-plugin-webui/src/index.ts

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,20 @@ import {
55
base64ToBlob,
66
constructPayload,
77
fetchOptions,
8+
getImageInfo,
89
setOptions,
910
testForHistoryPlugin,
10-
getImageInfo
11-
} from "./utils";
11+
} from "./Utilities";
1212

1313
const manifest = {
14-
name: "Stable Diffusion Webui",
14+
name: "stable-diffusion-webui",
1515
author: "Terry Jia",
1616
link: "https://github.com/jtydhr88",
1717
icon: `${window.location.origin}/DummyImage.png`,
1818
version: "0.0.0",
1919
license: "MIT",
20-
description: "Stable Diffusion Webui Plugin",
20+
description:
21+
"This plugin uses [`stable-diffusion-webui`](https://github.com/AUTOMATIC1111/stable-diffusion-webui) as its back-end for inference",
2122
};
2223

2324
const webuiUpscalers = [
@@ -295,9 +296,12 @@ export const createPlugin = StableStudio.createPlugin<{
295296
const images = [];
296297

297298
for (let i = 0; i < responseData.length; i++) {
298-
const imageInfo = await getImageInfo(webuiHostUrl, responseData[i].content);
299+
const imageInfo = await getImageInfo(
300+
webuiHostUrl,
301+
responseData[i].content
302+
);
299303

300-
const blob = await base64ToBlob(responseData[i].content, 'image/jpeg');
304+
const blob = await base64ToBlob(responseData[i].content, "image/jpeg");
301305

302306
const timestampInSeconds = responseData[i].create_date;
303307
const timestampInMilliseconds = timestampInSeconds * 1000;
@@ -308,20 +312,22 @@ export const createPlugin = StableStudio.createPlugin<{
308312
createdAt: createdAt,
309313
blob: blob,
310314
input: {
311-
prompts: [{
312-
text: imageInfo["prompt"],
313-
weight: imageInfo["CFG scale"],
314-
}],
315+
prompts: [
316+
{
317+
text: imageInfo["prompt"],
318+
weight: imageInfo["CFG scale"],
319+
},
320+
],
315321
style: "",
316322
steps: Number(imageInfo["Steps"]) ?? -1,
317323
seed: Number(imageInfo["Seed"]) ?? -1,
318-
model: imageInfo["Model"]??"",
324+
model: imageInfo["Model"] ?? "",
319325
width: responseData[i].width,
320-
height: responseData[i].height
321-
}
322-
}
326+
height: responseData[i].height,
327+
},
328+
};
323329

324-
images.push(stableDiffusionImage)
330+
images.push(stableDiffusionImage);
325331
}
326332

327333
return [
@@ -335,24 +341,26 @@ export const createPlugin = StableStudio.createPlugin<{
335341
settings: {
336342
baseUrl: {
337343
type: "string",
338-
title: "WebUI Host URL",
339-
description:
340-
"The URL of the WebUI host. This is usually http://127.0.0.1:7861",
344+
title: "Host URL",
341345
placeholder: "http://127.0.0.1:7861",
342346
value: localStorage.getItem("webui-host-url") ?? "",
347+
description:
348+
"The URL of the `stable-diffusion-webui` host, usually http://127.0.0.1:7861",
343349
},
350+
344351
upscaler: {
345352
type: "string",
346353
title: "Upscaler 1",
347354
options: webuiUpscalers,
348355
value: localStorage.getItem("upscaler1") ?? webuiUpscalers[0].value,
349356
description:
350-
"Select the upscaler that is used when downloading images at more than 1x size.",
357+
"Select the upscaler used when downloading images at more than 1x size",
351358
},
359+
352360
historyImagesCount: {
353361
type: "number",
354362
title: "History image count",
355-
description: "How many images do you get from webui locally?",
363+
description: "How many images should be fetched from local history?",
356364
min: 0,
357365
max: 50,
358366
step: 1,

0 commit comments

Comments
 (0)