mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2024-12-29 19:05:05 +08:00
Fix remove textual inversion
prompt
This commit is contained in:
parent
ce38ee8f26
commit
e378590d33
@ -68,18 +68,27 @@ var re_extranet_g = /\s+<([^:]+:[^:]+):[\d\.]+>/g;
|
|||||||
|
|
||||||
function tryToRemoveExtraNetworkFromPrompt(textarea, text){
|
function tryToRemoveExtraNetworkFromPrompt(textarea, text){
|
||||||
var m = text.match(re_extranet)
|
var m = text.match(re_extranet)
|
||||||
if(! m) return false
|
|
||||||
|
|
||||||
var partToSearch = m[1]
|
|
||||||
var replaced = false
|
var replaced = false
|
||||||
var newTextareaText = textarea.value.replaceAll(re_extranet_g, function(found){
|
var newTextareaText
|
||||||
m = found.match(re_extranet);
|
if(m) {
|
||||||
if(m[1] == partToSearch){
|
var partToSearch = m[1]
|
||||||
replaced = true;
|
newTextareaText = textarea.value.replaceAll(re_extranet_g, function(found){
|
||||||
return ""
|
m = found.match(re_extranet);
|
||||||
}
|
if(m[1] == partToSearch){
|
||||||
return found;
|
replaced = true;
|
||||||
})
|
return ""
|
||||||
|
}
|
||||||
|
return found;
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
newTextareaText = textarea.value.replaceAll(new RegExp(text, "g"), function(found){
|
||||||
|
if(found == text) {
|
||||||
|
replaced = true;
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return found;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
if(replaced){
|
if(replaced){
|
||||||
textarea.value = newTextareaText
|
textarea.value = newTextareaText
|
||||||
|
Loading…
Reference in New Issue
Block a user