diff --git a/modules/infotext_utils.py b/modules/infotext_utils.py index f1e8f54ba..afab6ebfb 100644 --- a/modules/infotext_utils.py +++ b/modules/infotext_utils.py @@ -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: diff --git a/modules/processing.py b/modules/processing.py index 76557dd7f..82d659e0a 100644 --- a/modules/processing.py +++ b/modules/processing.py @@ -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: diff --git a/modules/ui_common.py b/modules/ui_common.py index 48992a3c1..019e1d29c 100644 --- a/modules/ui_common.py +++ b/modules/ui_common.py @@ -29,7 +29,8 @@ def update_generation_info(generation_info, html_info, img_index): def plaintext_to_html(text, classname=None): - content = "
\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 = "
\n".join(html.escape(x) for x in text.split(separator)) return f"

{content}

" if classname else f"

{content}

"