From 2b58a89f6a3b5396ea57a6c6df39a57f368b3dc5 Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Tue, 29 Aug 2023 13:11:32 -0700 Subject: [PATCH] Clear instruction template before loading new one --- modules/chat.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/chat.py b/modules/chat.py index 90231ace..a3d0d6e8 100644 --- a/modules/chat.py +++ b/modules/chat.py @@ -462,12 +462,17 @@ def load_character(character, name1, name2, instruct=False): greeting_field = 'greeting' picture = None - # Deleting the profile picture cache, if any + # Delete the profile picture cache, if any if Path("cache/pfp_character.png").exists() and not instruct: Path("cache/pfp_character.png").unlink() + if instruct: + name1 = name2 = '' + folder = 'instruction-templates' + else: + folder = 'characters' + if character not in ['None', '', None]: - folder = 'characters' if not instruct else 'instruction-templates' picture = generate_pfp_cache(character) filepath = None for extension in ["yml", "yaml", "json"]: