diff --git a/modules/cmd_args.py b/modules/cmd_args.py index bf3553031..016a33d10 100644 --- a/modules/cmd_args.py +++ b/modules/cmd_args.py @@ -124,3 +124,4 @@ parser.add_argument("--disable-extra-extensions", action='store_true', help="pre parser.add_argument("--skip-load-model-at-start", action='store_true', help="if load a model at web start, only take effect when --nowebui") parser.add_argument("--unix-filenames-sanitization", action='store_true', help="allow any symbols except '/' in filenames. May conflict with your browser and file system") parser.add_argument("--filenames-max-length", type=int, default=128, help='maximal length of filenames of saved images. If you override it, it can conflict with your file system') +parser.add_argument("--no-prompt-history", action='store_true', help="disable read prompt from last generation feature; settings this argument will not create '--data_path/params.txt' file") diff --git a/modules/infotext_utils.py b/modules/infotext_utils.py index db1866449..a1cbfb17d 100644 --- a/modules/infotext_utils.py +++ b/modules/infotext_utils.py @@ -462,7 +462,7 @@ def get_override_settings(params, *, skip_fields=None): def connect_paste(button, paste_fields, input_comp, override_settings_component, tabname): def paste_func(prompt): - if not prompt and not shared.cmd_opts.hide_ui_dir_config: + if not prompt and not shared.cmd_opts.hide_ui_dir_config and not shared.cmd_opts.no_prompt_history: filename = os.path.join(data_path, "params.txt") try: with open(filename, "r", encoding="utf8") as file: diff --git a/modules/processing.py b/modules/processing.py index 93493f80e..86194b057 100644 --- a/modules/processing.py +++ b/modules/processing.py @@ -904,7 +904,7 @@ def process_images_inner(p: StableDiffusionProcessing) -> Processed: # infotext could be modified by that callback # Example: a wildcard processed by process_batch sets an extra model # strength, which is saved as "Model Strength: 1.0" in the infotext - if n == 0: + if n == 0 and not cmd_opts.no_prompt_history: with open(os.path.join(paths.data_path, "params.txt"), "w", encoding="utf8") as file: processed = Processed(p, []) file.write(processed.infotext(p, 0))