mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2024-06-07 21:20:49 +00:00
feat: add \00\00\00
as separator for prompts and infotext
This commit is contained in:
parent
ddb28b33a3
commit
cba1238cd1
@ -250,13 +250,14 @@ Steps: 20, Sampler: Euler a, CFG scale: 7, Seed: 965400086, Size: 512x512, Model
|
||||
|
||||
done_with_prompt = False
|
||||
|
||||
*lines, lastline = x.strip().split("\n")
|
||||
separator = '\00\00\00\n' if '\00\00\00\n' in x.strip() else '\n'
|
||||
*lines, lastline = x.strip().split(separator)
|
||||
if len(re_param.findall(lastline)) < 3:
|
||||
lines.append(lastline)
|
||||
lastline = ''
|
||||
|
||||
for line in lines:
|
||||
line = line.strip()
|
||||
line = line.strip().replace('\00', '')
|
||||
if line.startswith("Negative prompt:"):
|
||||
done_with_prompt = True
|
||||
line = line[16:].strip()
|
||||
@ -296,8 +297,8 @@ Steps: 20, Sampler: Euler a, CFG scale: 7, Seed: 965400086, Size: 512x512, Model
|
||||
if (shared.opts.infotext_styles == "Apply if any" and found_styles) or shared.opts.infotext_styles == "Apply":
|
||||
res['Styles array'] = found_styles
|
||||
|
||||
res["Prompt"] = prompt
|
||||
res["Negative prompt"] = negative_prompt
|
||||
res["Prompt"] = prompt.replace('\00', '')
|
||||
res["Negative prompt"] = negative_prompt.replace('\00', '')
|
||||
|
||||
# Missing CLIP skip means it was set to 1 (the default)
|
||||
if "Clip skip" not in res:
|
||||
|
@ -813,9 +813,9 @@ def create_infotext(p, all_prompts, all_seeds, all_subseeds, comments=None, iter
|
||||
|
||||
generation_params_text = ", ".join([k if k == v else f'{k}: {infotext_utils.quote(v)}' for k, v in generation_params.items() if v is not None])
|
||||
|
||||
negative_prompt_text = f"\nNegative prompt: {negative_prompt}" if negative_prompt else ""
|
||||
negative_prompt_text = f"\00\00\00\nNegative prompt: {negative_prompt}" if negative_prompt else ""
|
||||
|
||||
return f"{prompt_text}{negative_prompt_text}\n{generation_params_text}".strip()
|
||||
return f"{prompt_text}{negative_prompt_text}\00\00\00\n{generation_params_text}".strip()
|
||||
|
||||
|
||||
def process_images(p: StableDiffusionProcessing) -> Processed:
|
||||
|
@ -29,7 +29,8 @@ def update_generation_info(generation_info, html_info, img_index):
|
||||
|
||||
|
||||
def plaintext_to_html(text, classname=None):
|
||||
content = "<br>\n".join(html.escape(x) for x in text.split('\n'))
|
||||
separator = '\00\00\00\n' if '\00\00\00\n' in text else '\n'
|
||||
content = "<br>\n".join(html.escape(x) for x in text.split(separator))
|
||||
|
||||
return f"<p class='{classname}'>{content}</p>" if classname else f"<p>{content}</p>"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user