mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2024-12-29 19:05:05 +08:00
Error if prompt missing SR token to prevent mis-gens (#2209)
This commit is contained in:
parent
948533950c
commit
255be75d30
@ -27,9 +27,16 @@ def apply_field(field):
|
||||
|
||||
|
||||
def apply_prompt(p, x, xs):
|
||||
|
||||
orig_prompt = p.prompt
|
||||
orig_negative_prompt = p.negative_prompt
|
||||
|
||||
p.prompt = p.prompt.replace(xs[0], x)
|
||||
p.negative_prompt = p.negative_prompt.replace(xs[0], x)
|
||||
|
||||
if p.prompt == orig_prompt and p.negative_prompt == orig_negative_prompt:
|
||||
raise RuntimeError(f"Prompt S/R did not find {xs[0]} in prompt or negative prompt. Did you forget to add the token?")
|
||||
|
||||
|
||||
def apply_order(p, x, xs):
|
||||
token_order = []
|
||||
|
Loading…
Reference in New Issue
Block a user