mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Merge branch 'dev' of https://github.com/Cohee1207/SillyTavern into dev
This commit is contained in:
@ -2096,11 +2096,6 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add quiet generation prompt at depth 0
|
|
||||||
if (quiet_prompt && quiet_prompt.length) {
|
|
||||||
finalPromt += `\n${quiet_prompt}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
finalPromt = finalPromt.replace(/\r/gm, '');
|
finalPromt = finalPromt.replace(/\r/gm, '');
|
||||||
|
|
||||||
if (power_user.collapse_newlines) {
|
if (power_user.collapse_newlines) {
|
||||||
|
@ -229,6 +229,10 @@ async function loadHordeSamplers() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function loadExtrasSamplers() {
|
async function loadExtrasSamplers() {
|
||||||
|
if (!modules.includes('sd')) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
const url = new URL(getApiUrl());
|
const url = new URL(getApiUrl());
|
||||||
url.pathname = '/api/image/samplers';
|
url.pathname = '/api/image/samplers';
|
||||||
const result = await fetch(url, defaultRequestArgs);
|
const result = await fetch(url, defaultRequestArgs);
|
||||||
@ -276,6 +280,10 @@ async function loadHordeModels() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function loadExtrasModels() {
|
async function loadExtrasModels() {
|
||||||
|
if (!modules.includes('sd')) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
const url = new URL(getApiUrl());
|
const url = new URL(getApiUrl());
|
||||||
url.pathname = '/api/image/model';
|
url.pathname = '/api/image/model';
|
||||||
const getCurrentModelResult = await fetch(url, defaultRequestArgs);
|
const getCurrentModelResult = await fetch(url, defaultRequestArgs);
|
||||||
@ -401,11 +409,12 @@ async function generateExtrasImage(prompt) {
|
|||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
if (result.ok) {
|
if (result.ok) {
|
||||||
const data = await result.json();
|
const data = await result.json();
|
||||||
const base64Image = `data:image/jpeg;base64,${data.image}`;
|
const base64Image = `data:image/jpeg;base64,${data.image}`;
|
||||||
sendMessage(prompt, base64Image);
|
sendMessage(prompt, base64Image);
|
||||||
|
} else {
|
||||||
|
callPopup('Image generation has failed. Please try again.', 'text');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -431,6 +440,8 @@ async function generateHordeImage(prompt) {
|
|||||||
const data = await result.text();
|
const data = await result.text();
|
||||||
const base64Image = `data:image/webp;base64,${data}`;
|
const base64Image = `data:image/webp;base64,${data}`;
|
||||||
sendMessage(prompt, base64Image);
|
sendMessage(prompt, base64Image);
|
||||||
|
} else {
|
||||||
|
callPopup('Image generation has failed. Please try again.', 'text');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2974,9 +2974,11 @@ app.post('/horde_generateimage', jsonParser, async (request, response) => {
|
|||||||
return response.send(result.generations[0].img);
|
return response.send(result.generations[0].img);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
if (!check.is_possible) {
|
if (!check.is_possible) {
|
||||||
return response.sendStatus(503);
|
return response.sendStatus(503);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if (check.faulted) {
|
if (check.faulted) {
|
||||||
return response.sendStatus(500);
|
return response.sendStatus(500);
|
||||||
|
Reference in New Issue
Block a user