chore: fix image not save because of saving method for old user not existed

main
namkazt 2023-10-23 21:09:11 +07:00
parent 53cb5422a1
commit 2ea7b0d67e
2 changed files with 10 additions and 2 deletions

View File

@ -22,6 +22,6 @@ def process_images(p: processing.StableDiffusionProcessing, original_function):
shared.opts.return_grid = old_state
# add result to history
global_state.add_config( uuid.uuid4().hex, res.prompt[:64], shared.opts.sd_model_checkpoint, res.infotexts[0], res.images[0])
global_state.add_config( uuid.uuid4().hex, res.prompt, shared.opts.sd_model_checkpoint, res.infotexts[0], res.images[0])
return res

View File

@ -61,6 +61,14 @@ def add_config(id: str, name: str, model: str, info_text: str, img) -> history.H
# init new history
h = history.History(id, name, model, info_text)
# shorten name
original_prompt = h.name
h.name = h.name[:64]
# replace default prompts
info_texts = info_text.splitlines(True)
info_texts[0] = original_prompt + '\n'
h.info_text = ''.join(info_texts)
# in case of not automatic save, we must store few items in case of manual saved
if not global_state.automatic_save:
global manual_save_history
@ -100,7 +108,7 @@ def manually_save():
new_height = int(new_width * img.height / img.width)
img = img.resize((new_width, new_height), Image.LANCZOS)
images.save_image(image=img, path=global_state.history_path, basename="", forced_filename=f"{h.id}", extension="jpg", save_to_dirs=False)
elif global_state.save_thumbnail == "full":
else:
images.save_image(image=img, path=global_state.history_path, basename="", forced_filename=f"{h.id}", extension="jpg", save_to_dirs=False)
# add history to list