diff --git a/public/scripts/RossAscends-mods.js b/public/scripts/RossAscends-mods.js
index 721d2bd53..9552a488d 100644
--- a/public/scripts/RossAscends-mods.js
+++ b/public/scripts/RossAscends-mods.js
@@ -380,6 +380,7 @@ function RA_autoconnect(PrevApi) {
|| (secret_state[SECRET_KEYS.PERPLEXITY] && oai_settings.chat_completion_source == chat_completion_sources.PERPLEXITY)
|| (secret_state[SECRET_KEYS.GROQ] && oai_settings.chat_completion_source == chat_completion_sources.GROQ)
|| (secret_state[SECRET_KEYS.ZEROONEAI] && oai_settings.chat_completion_source == chat_completion_sources.ZEROONEAI)
+ || (secret_state[SECRET_KEYS.BLOCKENTROPY] && oai_settings.chat_completion_source == chat_completion_sources.BLOCKENTROPY)
|| (isValidUrl(oai_settings.custom_url) && oai_settings.chat_completion_source == chat_completion_sources.CUSTOM)
) {
$('#api_button_openai').trigger('click');
diff --git a/public/scripts/extensions/stable-diffusion/index.js b/public/scripts/extensions/stable-diffusion/index.js
index 73f1412dc..dbdfd4201 100644
--- a/public/scripts/extensions/stable-diffusion/index.js
+++ b/public/scripts/extensions/stable-diffusion/index.js
@@ -51,6 +51,7 @@ const sources = {
drawthings: 'drawthings',
pollinations: 'pollinations',
stability: 'stability',
+ blockentropy: 'blockentropy',
};
const initiators = {
@@ -1222,7 +1223,7 @@ async function onModelChange() {
extension_settings.sd.model = $('#sd_model').find(':selected').val();
saveSettingsDebounced();
- const cloudSources = [sources.horde, sources.novel, sources.openai, sources.togetherai, sources.pollinations, sources.stability];
+ const cloudSources = [sources.horde, sources.novel, sources.openai, sources.togetherai, sources.pollinations, sources.stability, sources.blockentropy];
if (cloudSources.includes(extension_settings.sd.source)) {
return;
@@ -1434,6 +1435,9 @@ async function loadSamplers() {
case sources.stability:
samplers = ['N/A'];
break;
+ case sources.blockentropy:
+ samplers = ['N/A'];
+ break;
}
for (const sampler of samplers) {
@@ -1620,6 +1624,9 @@ async function loadModels() {
case sources.stability:
models = await loadStabilityModels();
break;
+ case sources.blockentropy:
+ models = await loadBlockEntropyModels();
+ break;
}
for (const model of models) {
@@ -1714,6 +1721,26 @@ async function loadTogetherAIModels() {
return [];
}
+async function loadBlockEntropyModels() {
+ if (!secret_state[SECRET_KEYS.BLOCKENTROPY]) {
+ console.debug('Block Entropy API key is not set.');
+ return [];
+ }
+
+ const result = await fetch('/api/sd/blockentropy/models', {
+ method: 'POST',
+ headers: getRequestHeaders(),
+ });
+ console.log(result);
+ if (result.ok) {
+ const data = await result.json();
+ console.log(data);
+ return data;
+ }
+
+ return [];
+}
+
async function loadHordeModels() {
const result = await fetch('/api/horde/sd-models', {
method: 'POST',
@@ -1980,6 +2007,9 @@ async function loadSchedulers() {
case sources.stability:
schedulers = ['N/A'];
break;
+ case sources.blockentropy:
+ schedulers = ['N/A'];
+ break;
}
for (const scheduler of schedulers) {
@@ -2056,6 +2086,9 @@ async function loadVaes() {
case sources.stability:
vaes = ['N/A'];
break;
+ case sources.blockentropy:
+ vaes = ['N/A'];
+ break;
}
for (const vae of vaes) {
@@ -2584,6 +2617,9 @@ async function sendGenerationRequest(generationType, prompt, additionalNegativeP
case sources.stability:
result = await generateStabilityImage(prefixedPrompt, negativePrompt, signal);
break;
+ case sources.blockentropy:
+ result = await generateBlockEntropyImage(prefixedPrompt, negativePrompt, signal);
+ break;
}
if (!result.data) {
@@ -2639,6 +2675,40 @@ async function generateTogetherAIImage(prompt, negativePrompt, signal) {
}
}
+async function generateBlockEntropyImage(prompt, negativePrompt, signal) {
+ const result = await fetch('/api/sd/blockentropy/generate', {
+ method: 'POST',
+ headers: getRequestHeaders(),
+ signal: signal,
+ body: JSON.stringify({
+ prompt: prompt,
+ negative_prompt: negativePrompt,
+ model: extension_settings.sd.model,
+ steps: extension_settings.sd.steps,
+ width: extension_settings.sd.width,
+ height: extension_settings.sd.height,
+ seed: extension_settings.sd.seed >= 0 ? extension_settings.sd.seed : undefined,
+ }),
+ });
+
+ if (result.ok) {
+ const data = await result.json();
+
+ // Default format is 'jpg'
+ let format = 'jpg';
+
+ // Check if a format is specified in the result
+ if (data.format) {
+ format = data.format.toLowerCase();
+ }
+
+ return { format: format, data: data.images[0] };
+ } else {
+ const text = await result.text();
+ throw new Error(text);
+ }
+}
+
/**
* Generates an image using the Pollinations API.
* @param {string} prompt - The main instruction used to guide the image generation.
@@ -3459,6 +3529,8 @@ function isValidState() {
return true;
case sources.stability:
return secret_state[SECRET_KEYS.STABILITY];
+ case sources.blockentropy:
+ return secret_state[SECRET_KEYS.BLOCKENTROPY];
}
}
diff --git a/public/scripts/extensions/stable-diffusion/settings.html b/public/scripts/extensions/stable-diffusion/settings.html
index 33317f695..b9f8b0a4c 100644
--- a/public/scripts/extensions/stable-diffusion/settings.html
+++ b/public/scripts/extensions/stable-diffusion/settings.html
@@ -37,6 +37,7 @@
-
+