replace_instruct_placeholders is now default

This commit is contained in:
Concedo 2025-06-20 22:11:58 +08:00
parent 9c27ccde50
commit 2ba7803b95
3 changed files with 27 additions and 8 deletions

View file

@ -3326,7 +3326,7 @@ Current version indicated by LITEVER below.
img_gen_from_instruct: true,
img_autogen_type: 0, //0 is off, 1 is on, 2 is smart
img_allownsfw: true,
img_cfgscale: 7,
img_cfgscale: 6,
img_allowhd: true,
img_crop: false,
img_newturn: false,
@ -9162,6 +9162,11 @@ Current version indicated by LITEVER below.
final = final.includes("+")?("+"+final.split("+")[1]):final;
return `https://char-archive.evulid.cc/api/archive/v1/${parts[0]}/image/character/${final}?definition=true`;
}
if (parts.length == 2 || parts[0] == 'generic') {
let final = parts[1];
final = final.includes("+")?(final.split("+")[1]):final;
return `https://char-archive.evulid.cc/api/archive/v1/${parts[0]}/image/character/${final}?definition=true`;
}
if (parts.length !== 4 || parts[2] !== 'character') {
//bad format, return original
return userInput;
@ -13944,11 +13949,18 @@ Current version indicated by LITEVER below.
function sanitize_css(input)
{
input = input.replace(/<\s*\/?\s*\w+\s*[^>]*>/gi, "");
input = input.replace(/</g, "");
input = input.replace(/(?:javascript|vbscript|file):/gi, "");
//remove all data elements that aren't jpg, png, gif, webp;base64
input = input.replace(/data:(?!image\/(jpeg|jpg|png|gif|webp);base64,)[^;\s]*(?:;[^,\s]*)*(?:,[^)\s'"]*)?/gi, "");
let safeImages = [];
let counter = 0;
input = input.replace(/<\s*\/?\s*\w+\s*[^>]*>/gi, ""); //replace html tags
input = input.replace(/</g, ""); // Remove any remaining `<` characters
input = input.replace(/data:image\/(jpeg|jpg|png|gif|webp);base64,[A-Za-z0-9+\/=]+/gi, function(match) {
safeImages.push(match);
return "__SAFE_IMG_" + (counter++) + "__";
});
input = input.replace(/(?:javascript|data|vbscript|file):/gi, "");
for(let i = 0; i < safeImages.length; i++) {
input = input.replace("__SAFE_IMG_" + i + "__", safeImages[i]);
}
return input;
}
function apply_custom_css()

View file

@ -2408,7 +2408,7 @@ ws ::= | " " | "\n" [ \t]{0,20}
genparams["prompt"] = ollamasysprompt + ollamabodyprompt
#final transformations (universal template replace)
replace_instruct_placeholders = genparams.get('replace_instruct_placeholders', False)
replace_instruct_placeholders = genparams.get('replace_instruct_placeholders', True)
stop_sequence = (genparams.get('stop_sequence', []) if genparams.get('stop_sequence', []) is not None else [])
stop_sequence = stop_sequence[:stop_token_max]
if replace_instruct_placeholders:

View file

@ -151,7 +151,7 @@ public:
const std::string& vae_path,
const std::string control_net_path,
const std::string embeddings_path,
const std::string id_embeddings_path,
const std::string id_embeddings_path_original,
const std::string& taesd_path,
bool vae_tiling_,
ggml_type wtype,
@ -163,6 +163,7 @@ public:
use_tiny_autoencoder = taesd_path.size() > 0;
std::string taesd_path_fixed = taesd_path;
is_loaded_chroma = false;
std::string id_embeddings_path = id_embeddings_path_original;
#ifdef SD_USE_CUDA
LOG_DEBUG("Using CUDA backend");
backend = ggml_backend_cuda_init(0);
@ -257,6 +258,12 @@ public:
LOG_INFO("Version: %s ", model_version_to_str[version]);
if(id_embeddings_path!="" && version!=VERSION_SDXL)
{
printf("\n!!!!\nWARNING: PhotoMaker is only compatible with SDXL models. PhotoMaker will be disabled!\n!!!!\n");
id_embeddings_path = "";
}
if(use_tiny_autoencoder)
{
std::string to_search = "taesd.embd";