From e4d724eb3f6d2c74aa7e95fe5b2cd498c337fcfd Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Thu, 4 Jan 2024 07:49:40 -0800 Subject: [PATCH] Fix cache_folder bug introduced in 37eff915d6dae6f0782b41b5a5b2ad5b50b0a485 --- modules/chat.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/chat.py b/modules/chat.py index f5488e3a..0d4a076c 100644 --- a/modules/chat.py +++ b/modules/chat.py @@ -567,10 +567,10 @@ def generate_pfp_cache(character): for path in [Path(f"characters/{character}.{extension}") for extension in ['png', 'jpg', 'jpeg']]: if path.exists(): original_img = Image.open(path) - original_img.save(Path('{cache_folder}/pfp_character.png'), format='PNG') + original_img.save(Path(f'{cache_folder}/pfp_character.png'), format='PNG') thumb = make_thumbnail(original_img) - thumb.save(Path('{cache_folder}/pfp_character_thumb.png'), format='PNG') + thumb.save(Path(f'{cache_folder}/pfp_character_thumb.png'), format='PNG') return thumb @@ -596,7 +596,7 @@ def load_character(character, name1, name2): data = json.loads(file_contents) if extension == "json" else yaml.safe_load(file_contents) cache_folder = Path(shared.args.disk_cache_dir) - for path in [Path("{cache_folder}/pfp_character.png"), Path("{cache_folder}/pfp_character_thumb.png")]: + for path in [Path(f"{cache_folder}/pfp_character.png"), Path(f"{cache_folder}/pfp_character_thumb.png")]: if path.exists(): path.unlink() @@ -719,12 +719,12 @@ def upload_your_profile_picture(img): cache_folder.mkdir() if img is None: - if Path("{cache_folder}/pfp_me.png").exists(): - Path("{cache_folder}/pfp_me.png").unlink() + if Path(f"{cache_folder}/pfp_me.png").exists(): + Path(f"{cache_folder}/pfp_me.png").unlink() else: img = make_thumbnail(img) - img.save(Path('{cache_folder}/pfp_me.png')) - logger.info('Profile picture saved to "{cache_folder}/pfp_me.png"') + img.save(Path(f'{cache_folder}/pfp_me.png')) + logger.info(f'Profile picture saved to "{cache_folder}/pfp_me.png"') def generate_character_yaml(name, greeting, context):